Project Zomboid

Project Zomboid

Meditation
Adding Yogi Trait Midgame by Admin Power
`attempted index: minutesMeditated of non-table: null function: grow -- file: Meditation.lua line # 418 | MOD: Meditation java.lang.RuntimeException: attempted index: minutesMeditated of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980) at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1812) 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:64) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:65) at zombie.GameTime.update(GameTime.java:680) at zombie.gameStates.IngameState.UpdateStuff(IngameState.java:566) at zombie.gameStates.IngameState.updateInternal(IngameState.java:1623) at zombie.gameStates.IngameState.update(IngameState.java:1333) at zombie.gameStates.GameStateMachine.update(GameStateMachine.java:101) at zombie.GameWindow.logic(GameWindow.java:298) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.frameStep(GameWindow.java:765) at zombie.GameWindow.run_ez(GameWindow.java:681) at zombie.GameWindow.mainThread(GameWindow.java:495) at java.base/java.lang.Thread.run(Unknown Source) `
Last edited by {playername(-1)}; 14 Jan, 2024 @ 6:16am
< >
Showing 1-9 of 9 comments
Burryaga  [developer] 14 Jan, 2024 @ 5:39am 
I'll look into that asap! Thanks for the report!
{playername(-1)} 14 Jan, 2024 @ 5:43am 
I do not know if this has something to do, in multiplayer as an administrator, I put the yogi trait to my character be able to meditate without having read any magazine and not meditated before.
Last edited by {playername(-1)}; 14 Jan, 2024 @ 5:46am
Burryaga  [developer] 14 Jan, 2024 @ 5:49am 
I see. That is very likely why no one ever reported this bug before. Using administrator commands to bypass natural processes can have completely unpredictable side effects. Nevertheless, this particular side effect should not be possible anymore.
Burryaga  [developer] 14 Jan, 2024 @ 5:51am 
Just to be clear, you must select Yogi at trait selection for properties to load correctly. Bypassing trait selection will cause many other side effects. You may be able to add Yogi to a player and restart the game, however, because the attributes your player needs to have should get created when you join a server (specifically, when your player object is created) as long as you are a Yogi at that point in time.
Burryaga  [developer] 14 Jan, 2024 @ 5:55am 
The error you reported occurred because you did not have a key modData attribute that gets added to you at player creation IF you are a yogi. If the mod is used as intended without administrator tricks, it is impossible to my knowledge for a player to be a Yogi without having the appropriate modData attributes.

If you want to add Yogi to a player late in a save, try restarting the game after becoming a Yogi and let me know if everything works as expected.

MORE DETAILS FOR MODDERS:

The poster skipped the following function by adding a trait outside of normal game flow:

Yogi.loadModData = function(playerIndex, player, learning) if Yogi.meditative(player) or learning then if player:getModData().Yogi then Yogi.daysSurvived = player:getModData().Yogi.daysSurvived Yogi.daysMeditated = player:getModData().Yogi.daysMeditated Yogi.meditatedToday = player:getModData().Yogi.meditatedToday else player:getModData().Yogi = {} player:getModData().Yogi.daysSurvived = 0 player:getModData().Yogi.daysMeditated = 0 player:getModData().Yogi.meditatedToday = false Yogi.daysSurvived = 0 Yogi.daysMeditated = 0 Yogi.meditatedToday = false end player:getModData().Yogi.discoveredMeditation = true Events.EveryDays.Remove(Yogi.practice) Events.EveryDays.Add(Yogi.practice) end end Events.OnCreatePlayer.Add(Yogi.loadModData)

Therefore a function that should have been safe assuming a Yogi has appropriate mod data failed because the player's mod data was never initialized.
Burryaga  [developer] 14 Jan, 2024 @ 5:57am 
Alternatively, if you are server host in -debug mode, you could try...

Yogi.loadModData(0, getPlayer(), true)

...after adding the trait. (Or, if you're playing splitscreen, it would be 1 and getSpecificPlayer(1) for player 2).
Last edited by Burryaga; 14 Jan, 2024 @ 5:58am
{playername(-1)} 14 Jan, 2024 @ 6:01am 
I will try today to get trait legally and also restart.
Burryaga  [developer] 14 Jan, 2024 @ 6:01am 
Originally posted by Inferno:
I do not know if this has something to do, in multiplayer as an administrator, I put the yogi trait to my character be able to meditate without having read any magazine and not meditated before.

If you could update the name of this discussion to reflect that it is not an active error resulting from normal mod use, I would appreciate that. I don't want people to glance at the discussion names and make a snap assumption that the mod has issues.

"Adding Yogi Trait Midgame by Admin Power" might be a more neutral name for this discussion.
Last edited by Burryaga; 14 Jan, 2024 @ 6:02am
{playername(-1)} 14 Jan, 2024 @ 6:18am 
It is a great mod, I ended up uninstalling Lifestyle, it do not convince me at all.
< >
Showing 1-9 of 9 comments
Per page: 1530 50