hypnotoadtrance / MoreTraits

Adds more traits to Project Zomboid.
23 stars 43 forks source link

Specialization Traits Cause XP Multipliers to Disappear #18

Open hypnotoadtrance opened 2 years ago

hypnotoadtrance commented 2 years ago

I thought i had fixed this using the check to prevent De-leveling the player, but users are still reporting it. I'm unable to reproduce it in-game and would like some help figuring out in which circumstances this happens.

7UMENGL1aNG commented 2 years ago

Definition: "Specialization Traits Cause XP Multipliers to Disappear" = T "Specialization Traits don't Cause XP Multipliers to Disappear" = F

SinglePlayer: 1."More Trait"(Only). F 2.All of my subscribe mod. F

MultiPlayer: (1)Host Game: All of my subscribe mod. F

(2)Dedicated Server: 1.All of my subscribe mod. T 2."More Trait" and other Maps mod. F

One Guess:MOD Compatibility and Server Bugs.

(No control variables,not credible)

TheMrBakit commented 2 years ago

I'm not a programmer but i saw that: https://github.com/hypnotoadtrance/MoreTraits/blob/a08e2dd12cc0d928bd0659ea8d3ee9211829c1a9/Contents/mods/More%20Traits/media/lua/client/MoreTraits.lua#L109 could it be the issue? (AddXPNoMultiplier)

if this isn't the issue it could be something with adding xp that reset the multiplier just an idea

hypnotoadtrance commented 2 years ago

addXPNoMultiplier() Is antiquated code and no longer used.

TheMrBakit commented 2 years ago

I did some test in Multiplayer and with what i saw if you level in a skill, you cannot get back your multiplier if you lower it back. I don't know if that help be hope i help in something because i have this issue :)

7UMENGL1aNG commented 2 years ago

THANKS GOD!FINALLY!

Test with three mod: Mod list (The third mod is the font.)

Test with Trait:Specialization:Weapon Start with Wildsman trait you will have +1 Fishing and XP Boost:+ 75% Beginners When your level is 0-1.XP Multipliers won't Disappear.

Book After you raise your level to 2(Unlocked),read "Lv3-4" book,get some xp,it disappears. XP Boost

Control group(No XP Boost): First Aid

Experimental group(With XP Boost): image image

Summarize: If you have XP Boost and Specialization.XP Multipliers will Disappear.

7UMENGL1aNG commented 2 years ago

It's fixed.(A rough test)

hypnotoadtrance commented 2 years ago

6fa28476f4fff7fc5015536f79977e65

7UMENGL1aNG commented 2 years ago

THANK YOU for all you have done for us.

gaschenk commented 1 year ago

Setup: Multiple Users + Dedicated Server

In our case the provided solution or rather description of what's happening isn't all that accurate. In our case an user on a server may be permanently disabled to get any multipliers from books at all even when having no traits selected. This seems to be a bit more complicated of an issue than just not having specializations selected.

Furthermore after some testing we found out that after reconnecting that the affected players may get their multipliers after reconnecting, after having read books. As well as the previous multiplier being persistent until a relog. In case of leveling for example from 0-2 and using the 3x default lv 1 book multiplier the affected player will receive the new multiplier after reading the next book before relogging. Furthermore the main issue stems from receiving negative experience.

gaschenk commented 1 year ago

So specialization cause the xp to disappear most likely due to them cutting off 25% of your xp, which furthermore doesn't get added to the actual specialized skills, which can and will most of the time lead to negative xp bricking the character in terms of book-boost progress.

You can easily test this by yourself if you would once go into debug solo just More Traits and compare how many Digital Watches you need to dismantle for Electrical 2 while having a specialization and while not.

e.g.: Specialization exists: always negative xp at lv2 + around 400\~500 watches No specialization exists: no negative xp + 150\~200 watches

gaschenk commented 1 year ago

Specifically those calls to: https://github.com/hypnotoadtrance/MoreTraits/blob/b56c196acd6a6f46758e68947f080974b2a12979/Contents/mods/More%20Traits/media/lua/client/MoreTraits.lua#L83 with false are an issue.

The default call to this internally is for example

this.AddXP(var1, var2, true, true, false);

The 3rd should just be true in 99% of the time, whereas the second should be true except you're trying to do something very wonky, as it seems to be directly tied to applying xpboosts. Furthermore the last one should be false except you attempt to understand what's going on underhood, as that is tied to a more complex system.

When you just use the default version everything works just fine, well except that Specialization xp sharing is still broken.

And once more a bit more details about the 3rd param: If you're setting false, you yourself will have to handle any other perk that applies negative or positive xp boosts, and would have to do so properly in order to avoid negative xp cases, which may brick a character.

gaschenk commented 1 year ago

Additional Info: Issue at: https://github.com/hypnotoadtrance/MoreTraits/blob/b56c196acd6a6f46758e68947f080974b2a12979/Contents/mods/More%20Traits/media/lua/client/MoreTraits.lua#L1423C55-L1423C55

Whole specialization feature doesn't seem to work as intended or described needs more description, as of now it does nothing except removing xpboost & multipliers when a specialization is choosen.

https://github.com/hypnotoadtrance/MoreTraits/pull/167

the first commit is a very basic way to circumvent exp loss for now.

But if specialization should work the whole specialization feature needs to be rewritten.