Project Zomboid

Project Zomboid

Meditation
Inferno 14. jan. 2024 kl. 4.09
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) `
Sist redigert av Inferno; 14. jan. 2024 kl. 6.16
< >
Viser 19 av 9 kommentarer
Burryaga  [utvikler] 14. jan. 2024 kl. 5.39 
I'll look into that asap! Thanks for the report!
Inferno 14. jan. 2024 kl. 5.43 
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.
Sist redigert av Inferno; 14. jan. 2024 kl. 5.46
Burryaga  [utvikler] 14. jan. 2024 kl. 5.49 
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  [utvikler] 14. jan. 2024 kl. 5.51 
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  [utvikler] 14. jan. 2024 kl. 5.55 
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  [utvikler] 14. jan. 2024 kl. 5.57 
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).
Sist redigert av Burryaga; 14. jan. 2024 kl. 5.58
Inferno 14. jan. 2024 kl. 6.01 
I will try today to get trait legally and also restart.
Burryaga  [utvikler] 14. jan. 2024 kl. 6.01 
Opprinnelig skrevet av 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.
Sist redigert av Burryaga; 14. jan. 2024 kl. 6.02
Inferno 14. jan. 2024 kl. 6.18 
It is a great mod, I ended up uninstalling Lifestyle, it do not convince me at all.
< >
Viser 19 av 9 kommentarer
Per side: 1530 50