After using the debug console mod, I've found that the reason our traits go away from character creation is that the trait levels are being reset to zero when the trait xp is modified.
Example from several tests: A new character with "Honest" trait (honor level of 1 or more) is immediately reset to honor level 0 when successfully turning in a herd of animals.
Beliefs:
Because the trait is actively going from 1 to zero, that means "this.Hero.SetTraitLevel(trait, traitLevel);" in HeroTraitDeveloper.cs is triggering.
That means somewhere in BELOW in DefaultCharacterDevelopmentModel the int traitLevel is being set to a zero by default:
Honestly everything LOOKS right based on the 10 or so files I've compared. However, I think I might know what's going on.
During the initial character creation charactercreationcontent, this happens:
This is the code to apply to the character your level of traits. Note that it is ONLY modifying the character level, it is not changing anything about xp.
However, you can see in the following code from HreoTraitDeveloper that the xp being used to compare values is coming from an actual xp lookup for a trait.
If during character creation the character is not being assigned actual XP...then first check during an addition or subtraction tells the game that you are ACTUALLY just adding to the original value: which is likely zero.
So, the brackets for Levels for traits are -2 to 2. Numerically for xp that -6k -> -4k (-2) ,-4k->-1k (-1), -1k -> 1k (0), (1k -> 4k(1), 4k->6k (2)
Now, remember that you are receiving 20,30, maybe 50 points of xp per event. that means you need to accomplish 20 quests (on average) succesfully. While it might not be the case, but I think it is very likely that people ARE leveling...but it's just not seen yet. Sadly there is no debug command to add trait xp, only set trait levels.
first post that led to this: https://forums.taleworlds.com/index...much-trouble-follow-on-post-connected.407336/
Example from several tests: A new character with "Honest" trait (honor level of 1 or more) is immediately reset to honor level 0 when successfully turning in a herd of animals.
Beliefs:
Because the trait is actively going from 1 to zero, that means "this.Hero.SetTraitLevel(trait, traitLevel);" in HeroTraitDeveloper.cs is triggering.
That means somewhere in BELOW in DefaultCharacterDevelopmentModel the int traitLevel is being set to a zero by default:
插入代码块:
public override void GetTraitLevelForTraitXp(
Hero hero,
TraitObject trait,
int xpValue,
out int traitLevel,
out int clampedTraitXp)
{
clampedTraitXp = xpValue;
int num1 = trait.MinValue < -1 ? -6000 : (trait.MinValue == -1 ? -2500 : 0);
int num2 = trait.MaxValue > 1 ? 6000 : (trait.MaxValue == 1 ? 2500 : 0);
if (xpValue > num2)
clampedTraitXp = num2;
else if (xpValue < num1)
clampedTraitXp = num1;
traitLevel = clampedTraitXp <= -4000 ? -2 : (clampedTraitXp <= -1000 ? -1 : (clampedTraitXp < 1000 ? 0 : (clampedTraitXp < 4000 ? 1 : 2)));
if (traitLevel < trait.MinValue)
{
traitLevel = trait.MinValue;
}
else
{
if (traitLevel <= trait.MaxValue)
return;
traitLevel = trait.MaxValue;
}
}
Honestly everything LOOKS right based on the 10 or so files I've compared. However, I think I might know what's going on.
During the initial character creation charactercreationcontent, this happens:
插入代码块:
Hero.MainHero.SetTraitLevel(trait, Hero.MainHero.GetTraitLevel(trait) + traitLevelToAdd);
However, you can see in the following code from HreoTraitDeveloper that the xp being used to compare values is coming from an actual xp lookup for a trait.
插入代码块:
public void AddTraitXp(TraitObject trait, int xpAmount)
{
xpAmount += this.GetPropertyValue((PropertyObject) trait);
int traitLevel;
int traitXp;
Campaign.Current.Models.CharacterDevelopmentModel.GetTraitLevelForTraitXp(this.Hero, trait, xpAmount, out traitLevel, out traitXp);
this.SetPropertyValue((PropertyObject) trait, traitXp);
if (traitLevel == this.Hero.GetTraitLevel(trait))
return;
this.Hero.SetTraitLevel(trait, traitLevel);
}
So, the brackets for Levels for traits are -2 to 2. Numerically for xp that -6k -> -4k (-2) ,-4k->-1k (-1), -1k -> 1k (0), (1k -> 4k(1), 4k->6k (2)
Now, remember that you are receiving 20,30, maybe 50 points of xp per event. that means you need to accomplish 20 quests (on average) succesfully. While it might not be the case, but I think it is very likely that people ARE leveling...but it's just not seen yet. Sadly there is no debug command to add trait xp, only set trait levels.
first post that led to this: https://forums.taleworlds.com/index...much-trouble-follow-on-post-connected.407336/

