This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] [Trinity 3.3.5] Static Weapon Skills  (Read 673 times)

Degen

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 22
    • View Profile
[SOLVED] [Trinity 3.3.5] Static Weapon Skills
« on: July 05, 2016, 03:27:27 pm »
Searched all over and couldn't find any info on this.

I'm trying to change a character's weapon skill (Let's say One-handed Swords) to be 1 out of 500 at level 1, and not have the cap increase by 5 every time they level up. Does anyone have an idea on how to do this?

Edit: I think I found what I'm looking for in the player.cpp, but the c++ is gibberish to me and I can't figure out how to change what I want to change. If anyone knows their way around all these global variables, I'd love some insight.

Another edit: I finally solved this after much trial and error. Tried my best to describe it below but there are probably things I've overlooked so don't take this as a tutorial.



Max weapon skill is defined in Unit.h, I set it to 1000 instead of 5 * player level.
Code: [Select]
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
to...
Code: [Select]
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return 1000; }


Player.cpp also needs to be edited where "5 * plevel" is hardcoded in.
Code: [Select]
uint32 skilldif = 5 * plevel - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType));
to...
Code: [Select]
uint32 skilldif = 1000 - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType));

The skilldif variable in this calculation will now round down from 1000 instead of 5. Edit it accordingly.
Code: [Select]
float chance = float(3 * lvldif * skilldif) / plevel;

Being constantly far away from weapon skill cap means combat will be mostly misses. I myself solved this by removing miss chance completely, but there are probably better ways..
« Last Edit: January 01, 1970, 01:00:00 am by Admin »