Project Zomboid

Project Zomboid

Driving Cars Mod - MP & 3D Models
StryfeKhaos 2016 年 12 月 18 日 下午 7: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.
最后由 StryfeKhaos 编辑于; 2016 年 12 月 18 日 下午 7:42
< >
正在显示第 1 - 7 条,共 7 条留言
StryfeKhaos 2016 年 12 月 18 日 下午 7:48 
Driving worked as well.
nolanritchie  [开发者] 2016 年 12 月 19 日 下午 1: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 2016 年 12 月 19 日 下午 2:46 
Exception in CarsLoading.lua now when SpawnCars is called, maybe because CarList isn't defined in CarsLoading.lua?
StryfeKhaos 2016 年 12 月 19 日 下午 2: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.
最后由 StryfeKhaos 编辑于; 2016 年 12 月 19 日 下午 2:57
StryfeKhaos 2016 年 12 月 19 日 下午 4: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?
最后由 StryfeKhaos 编辑于; 2016 年 12 月 19 日 下午 4:23
nolanritchie  [开发者] 2016 年 12 月 19 日 下午 5:17 
that line just gives the cars a random direction when they spawn. but anyway, i think i corrected these things. updating now
StryfeKhaos 2016 年 12 月 20 日 上午 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.


最后由 StryfeKhaos 编辑于; 2016 年 12 月 20 日 上午 8:11
< >
正在显示第 1 - 7 条,共 7 条留言
每页显示数: 1530 50