Project Zomboid

Project Zomboid

More Traits
4,505 Comments
9avz 8 hours ago 
Yeah, you can actually fix it this whole AddXP thing with a simple recursion guard. I'll give you a gymgoer example as this is the one I fixed. So, go to this file:

steamapps/workshop/content/108600/1299328280/mods/More Traits/42/media/lua/client/More Traits.lua

In this file, find a function called GymGoer (or any other one with AddXP calls you want to fix). Outside the function definition create a local boolean variable for the lock and initialize it as false. Then, in the beginning of a function, return if that lock var is true. And then just wrap AddXP call in setting lock to true and then to false right after.
9avz 8 hours ago 
Here's GymGoer function with comments for clarity:

-- Define boolean var for a "lock"
local xp_lock = false
function GymGoer(_player, _perk, _amount)
-- Return if "locked"
if xp_lock then return end;
local player = _player;
local perk = _perk;
local amount = _amount;
local modifier = 200;

if SandboxVars.MoreTraits.GymGoerPercent then
modifier = SandboxVars.MoreTraits.GymGoerPercent;
end

modifier = modifier * 0.01;
9avz 8 hours ago 
if player:HasTrait("gymgoer") and player:getCurrentState() == FitnessState.instance() then
if perk == Perks.Fitness or perk == Perks.Strength then
-- This is a check I added to not add anything for 0 XP events
if amount ~= 0 then
-- Removed the amount fix, as it is not needed anymore
-- Recursion guard
xp_lock = true;
player:getXp():AddXP(perk, amount * (modifier - 1), false, false, false);
-- Release Lock
xp_lock = false;
end
end
end
end
9avz 8 hours ago 
You should define different variables for each function you want to "guard" this way, though. If you have a mod for visible xp changes, you won't see proper xp additions until you change multiplier from default 200(2x) to smth else, i.e. 250 for some reason. But it still works nonetheless.

Also, no implementation errors found all over the comments can often be fixed by simply replacing HaloTextHelper calls with smth else (player:Say or player:addLineChatElement)
Davion_Valavaern May 7 @ 12:38am 
Okay, did some digging found the rabbit hole, and for everyone else having issues with Gym Goer, Antigun, or any of the Secialization perks, here's a post from the very nice mod author explaining things: https://theindiestone.com/forums/index.php?/topic/75473-4201-rev25246-recursion-addxp-function-does-not-respect-calllua-flag/

tl;dr: Indie Stone slightly borked the AddXP function going from 41 to 42, so More Trait's method of altering the XP amount creates a recursive(infinite) loop.
Davion_Valavaern May 6 @ 10:16pm 
"Gym Goer" seems to be throwing up huge numbers of errors when used with the "Fitness Overhaul" mod, particularly when used with the treadmill or weight bench.
Aspen May 5 @ 2:43am 
would it be possible to make the sun sensitivity trait be countered with sunglasses as well as an umbrella? i have something like this irl and am RARELY outside in daylight without sunglasses
ghl0921 Apr 30 @ 11:07pm 
If you combine the error logs from my three messages in the order I posted them, that's the complete error info. Thanks for fixing this!
ghl0921 Apr 30 @ 11:04pm 
zombie.MovingObjectUpdateSchedulerUpdateBucket.postupdate(MovingObjectUpdateSchedulerUpdateBucket.java:89)
at zombie.MovingObjectUpdateScheduler.postupdate(MovingObjectUpdateScheduler.java:180)
at zombie.iso.IsoWorld.updateWorld(IsoWorld.java:4171)
at zombie.iso.IsoWorld.updateInternal(IsoWorld.java:4278)
at zombie.iso.IsoWorld.update(IsoWorld.java:4192)
at zombie.gameStates.IngameState.updateInternal(IngameState.java:1811)
at zombie.gameStates.IngameState.update(IngameState.java:1507)
at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:101)
at zombie.GameWindow.logic(GameWindow.java:388)
at zombie.GameWindow.frameStep(GameWindow.java:928)
at zombie.GameWindow.run_ez(GameWindow.java:821)
at zombie.GameWindow.mainThread(GameWindow.java:619)
at java.base/java.lang.Thread.run(Unknown Source)
ghl0921 Apr 30 @ 11:04pm 
zombie.characters.IsoGameCharacter.actionStateChanged(IsoGameCharacter.java:14661)
at zombie.characters.IsoPlayer.actionStateChanged(IsoPlayer.java:10259)
at zombie.characters.action.ActionContext.invokeAnyStateChangedEvents(ActionContext.java:623)
at zombie.characters.action.ActionContext.postUpdateInternal(ActionContext.java:99)
at zombie.characters.action.ActionContext.update(ActionContext.java:73)
at zombie.characters.IsoGameCharacter.postUpdateInternal(IsoGameCharacter.java:12476)
at zombie.characters.IsoGameCharacter.postupdate(IsoGameCharacter.java:12435)
at zombie.characters.IsoPlayer.postupdateInternal(IsoPlayer.java:4360)
at zombie.characters.IsoPlayer.postupdate(IsoPlayer.java:4352)
at
ghl0921 Apr 30 @ 11:04pm 
at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
at zombie.Lua.Event.trigger(Event.java:72)
at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:364)
at zombie.ai.states.SwipeStatePlayer.enter(SwipeStatePlayer.java:246)
at zombie.ai.StateMachine.stateEnter(StateMachine.java:245)
at zombie.ai.StateMachine.ensureSubstateActive(StateMachine.java:127)
at zombie.ai.StateMachine.lambda$changeState$1(StateMachine.java:55)
at zombie.util.lambda.Consumers$Params1$CallbackStackItem.accept(Consumers.java:39)
at zombie.util.list.PZArrayUtil.forEach(PZArrayUtil.java:974)
at zombie.util.list.PZArrayUtil.forEach(PZArrayUtil.java:1000)
at zombie.ai.StateMachine.changeState(StateMachine.java:51)
at zombie.ai.StateMachine.changeState(StateMachine.java:34)
at
ghl0921 Apr 30 @ 11:04pm 
`Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@9a985301
function: progun -- file: MoreTraits.lua line # 1998 | MOD: More Traits
java.lang.RuntimeException: No implementation found
at se.krka.kahlua.integration.expose.MultiLuaJavaInvoker.call(MultiLuaJavaInvoker.java:112)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:192)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:988)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:173)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1963)
at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1790)
ghl0921 Apr 30 @ 11:04pm 
Hey, just wanted to report a bug — every time I kill a zombie, the game throws an error. Mind taking a look and fixing it? Thanks!
BullsEyeBen1 Apr 30 @ 7:44pm 
Gym goer breaks my game regardless of my mod load order. Mod is great besides that
darrenx77 Apr 30 @ 3:56pm 
Still a great Mod for 42. Not seeing the errors some are reporting although mostly picking simple skill adjustment perks. Very nice to see an update just a few weeks ago <3
🥀 Apr 29 @ 8:22pm 
Mod has tons of glitches, please fix
F1tgal911 Apr 29 @ 9:34am 
Tons of errors. This mod was good once upon a time but unfortunately not maintained anymore.
Glock Apr 28 @ 12:02pm 
error fix
MqKosmos Apr 27 @ 12:48pm 
Works great on my Server, so far
Thanks! :spirallove:
:letsgo:
kowe Apr 26 @ 4:42am 
can't exercise with this mod :(
popikamiles2 Apr 24 @ 5:57pm 
im pissing
Seacucumberstove Apr 21 @ 1:31pm 
Getting tons of errors when using this mod for some reason!
GOJIWA Apr 21 @ 1:09pm 
mod doesn't work when i hosting even without anti-cheats
ManiacSkittles Apr 21 @ 12:10am 
Mod just isnt working at all, not sure why but i am trying to host a server for me and my girlfriend. The mod seems to be registering just fine but doesnt actually give the options for the other traits
KakekPrakoso Apr 19 @ 11:12pm 
martial skill error
ShaolimMatadorDePorco Apr 15 @ 12:49pm 
Hello, how can i select 2 or more specialization traits ?
Theres something i can edit in modfile ?
Zamu Apr 13 @ 12:49pm 
`Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@aff34ec1
function: EveryOneMinute -- file: MoreTraits.lua line # 4367 | MOD: More Traits
java.lang.RuntimeException: No implementation found
`

Getting this error while hooking a melee on the belt or the back or even using the hotbar...
OverDoseZA Apr 13 @ 1:09am 
Just did troubleshooting with this mod alongside "Skill Recovery Journal", where it would throw up errors if the "Anti-Gun Pacifist" trait from this mod is enabled and you are shooting at zombies. I removed that "Anti-Gun Pacifist" trait, and kept "More Traits" & "Skill Recovery Journal" enabled, and the issue went away when shooting zombies. Also, with "Anti-Gun Pacifist" enabled, there are no errors when shooting into the distance (i.e. not aiming at zombies).
omittingsilence Apr 12 @ 3:08am 
I can't have fun with this one, too op
Jenek Apr 5 @ 1:26pm 
I think dynamic traits broke. I only have the 2 mods (More Traits and Dynamaic Traits from this mod) and I can no longer acquire Gourmand by being cooking lv. 9.
Peter Hemingway Apr 3 @ 1:47pm 
Martial Artist does not work. Throws an error and does 0 damage every time you swing at a zombie. Been on the discord and got royally ignored by everyone on it.

Wouldn't hold out hope for help.
БЫКОВ Apr 3 @ 9:34am 
The Superimmune perk is not working, after full healing, the healing timer just resets and the illness symptoms begin to happen again.
ToykoyoX Mar 31 @ 9:37am 
It seems that right now the trait: "Pack Mule" isnt working with the trait "Strong"... Wanted to point this out so other knows
Foslix Mar 30 @ 5:42am 
got a stacktrace error from this prob due to trait removal in the newest build
GFreenD Mar 30 @ 2:01am 
Constant errors on line 401, and 402 along with some other ones
DarkSlayerEX Mar 29 @ 8:32pm 
I had the same ANSI file encoding issue as well. I uninstalled the mod, deleted the mod folder, and resubscribed, and the file downloaded properly with the proper encoding.

You may want to try that.
Alharemi Mar 29 @ 7:53am 
please resave files in other coding. As I understand b42 doesn't support ANSI and many letters are ??? now
Renjie.liu Mar 29 @ 2:38am 
function: AddXP -- file: MoreTraits.lua line # 83 | MOD: More Traits
function: GymGoer -- file: MoreTraits.lua line # 3205 | MOD: More Traits.
.AKAsnowman Mar 28 @ 4:10pm 
is there a way to remove certain traits from the character creation menu? like super immune for an example?
zikami Mar 28 @ 11:47am 
still experiencing errors from lines before I even play 336-338, 342,380,381,383, 386-388,390, 396-402 they say
Callframe at: setMutualExclusive
function: initToadTraits -- file: MoreTraitsMainCreationMethods.lua line # --- | MOD: More Traits

java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
mono Mar 26 @ 9:33pm 
The "Gordon" trait seems to only recognize naturally generated crowbars, while crowbars forged by players themselves do not receive a boost.
poopsock Mar 25 @ 12:38pm 
@zipdye i already have both mods installed and are running. now i cant tell which one it is either, but if you go to that console and search "STACK TRACE", and then find the one that's referencing one of those two mods, we could track down the issue and send it to the devs
zipdye Mar 25 @ 11:35am 
the error log from the console is literally 2.5~ million characters long, so unfortunately i probably can't :steamsad:

from what i can gather it's a compatibility issue with even more traits, as when i disable either one they both work flawlessly, but when they're together they cause issues. whether that's an issue with this mod or even more traits (or both), i don't know. if you want to recreate it just get both mods and add all off the positive traits from both.
poopsock Mar 25 @ 11:11am 
@20come70correr theres a patch mod out there called more traits fix, I've yet to see if it works with the new update, but it was made for 42.5

@zipdye can you recreate the error messages and then post the errors from the console?
20come70correr Mar 25 @ 10:13am 
There is an error when lighting a fire. It does not light on the blue 42
zipdye Mar 25 @ 10:12am 
there's a bug with the new update, every time you kill a zombie with one of the traits (can't say which one for sure), there's hundreds - if not thousands - of errors that pop up, always freezing and sometimes even crashing the game.
BobaTheTerrible Mar 23 @ 5:48pm 
how do you eat zombies on B42 because I don't really know how I could get them on my shoulder n butcher them like the previous version due to the new moving bodies mechanic
Kafir from Catharsis Mar 23 @ 3:50pm 
@voltaxticrift1 I can't seem to find WeightGain or weightloss. i tried searching for it in notepad
poopsock Mar 23 @ 4:28am 
anyone else getting an error message at line 4367 in the moretraits.lua file?

Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@b6a941c1
function: EveryOneMinute -- file: MoreTraits.lua line # 4367 | MOD: More Traits
java.lang.RuntimeException: No implementation found