Project Zomboid

Project Zomboid

Driving Cars Mod - MP & 3D Models
StryfeKhaos 18. dec. 2016 kl. 19:41
New issue
With the last update, I am now getting exceptions on car spawn:

1482116833737 function: SpawnCars -- file: DriveCarsServer.lua line # 173
java.lang.RuntimeException: attempted index: 1.0 of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1549)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:473)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1727)
at se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1672)
at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:53)
at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:81)
at zombie.Lua.Event.trigger(Event.java:37)
at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:83)
at zombie.iso.IsoChunk.doLoadGridsquare(IsoChunk.java:1239)
at zombie.network.ServerMap$ServerCell.RecalcAll2(ServerMap.java:302)
at zombie.network.ServerMap$ServerCell.Load2(ServerMap.java:179)
at zombie.network.ServerMap.preupdate(ServerMap.java:682)
at zombie.network.GameServer.main(GameServer.java:705)

I did a full wipe, removed all Steam files for the dedi server tool and the game, plus wiped the entire UserData\Zomboid directory to make sure it was completely clean.

It looks like some of the functions and variables defined in DriveCars.lua are not visible in the scope that DriveCarsServer.lua runs in.

First I added:
local CarList = {"yellowcamero", "whitepickup", "greenjeep"};
to SpawnCars before CarList was used.

After multiple other exceptions, I added the following functions to DriveCarsServer.lua:
StrReplace
AbsoluteValue
IsIn
getTextFor

New cars spawn now spawn. I verified that there were no more right click errors, and taking items from cars worked. I didn't verify driving, as I haven't found any non-broken cars with gas yet. :)

Also, SpawnCars will throw exceptions when running the server in 'softreset' mode
(-Dsoftreset as a parameter), even with these fixes. While reseting, it looks like 'square:transmitModdata();' isn't a valid call to make. I don't know if there's a flag to check before calling this, like some kind of 'IsServerDataResetting' or what.
Sidst redigeret af StryfeKhaos; 18. dec. 2016 kl. 19:42
< >
Viser 1-7 af 7 kommentarer
StryfeKhaos 18. dec. 2016 kl. 19:48 
Driving worked as well.
nolanritchie  [udvikler] 19. dec. 2016 kl. 13:23 
i see. i didnt realize server lua and client lua files cant share global vars or functions. i updated a fix for this, try and let me know
StryfeKhaos 19. dec. 2016 kl. 14:46 
Exception in CarsLoading.lua now when SpawnCars is called, maybe because CarList isn't defined in CarsLoading.lua?
StryfeKhaos 19. dec. 2016 kl. 14:57 
Sorry, it wasn't CarList, it was on line 117:
cBag:setTexture(getTextureFor("DriveCarsMP."..CarBaseType .. tostring(RandomDirection)));

I don't think getTextureFor is defined in any script in the server Lua directory.
Sidst redigeret af StryfeKhaos; 19. dec. 2016 kl. 14:57
StryfeKhaos 19. dec. 2016 kl. 16:18 
I just commented out that line and it seemed to work. I don't think the world item object on the server side needs the texture?
Sidst redigeret af StryfeKhaos; 19. dec. 2016 kl. 16:23
nolanritchie  [udvikler] 19. dec. 2016 kl. 17:17 
that line just gives the cars a random direction when they spawn. but anyway, i think i corrected these things. updating now
StryfeKhaos 20. dec. 2016 kl. 7:34 
Yes, seem to be working now! That makes more sense about the random direction. Still trying to decipher the PZ events and API.


Sidst redigeret af StryfeKhaos; 20. dec. 2016 kl. 8:11
< >
Viser 1-7 af 7 kommentarer
Per side: 1530 50