Project Zomboid

Project Zomboid

Tow Truck
 此主题已被置顶,因此可能具有重要性
obtainchi  [开发者] 9 月 13 日 上午 6:44
About PZ and modding a tow truck
I wanted to say a few things about modding in this game. When you want to do things the Lua API can not do it's very disheartening. I get so caught up in trying to find a solution to an issue that 6 hours will just go by in like minutes. First off, I'm not good at this. I can understand the code better now but I still cant do anything more than just basic stuff and what I would call hacks.

That being said, the way that I've had to trick the game to tow a vehicle on a tow hook has a huge issue. Let me explain.

You back in and hook up to a vehicle - I have to tell the game that the vehicle you are trying to tow is really a 'Trailer' and not a truck, van or car. This means I have to change the scriptName of said vehicle to something with the word "trailer" in it. Now, this works great until something happens to the server/game.

If while you are towing a vehicle and the game/server crashes, you no longer have the same vehicle on the hook as you picked up once the server/game restarts. This is the bane of my PZ modding existence. The game cant load the new scriptName vehicle called "Base.SmallCar_Trailer" because it doesnt exist.

In the most recent release of the mod, I have just swapped back to the original scriptName shortly after attaching the tow hook. This works to eliminate the problem with the vehicle swapping out to another vehicle. But it ruins the performance of the towtruck and the ability to tow something, because the source code checks if the word "trailer" is in the name of the vehicle constantly in order to turn off the brakes and forget about mass.

So I've been trying to find ways to use modData in order to save a list of parts, their condition and amount of fluid in them to "restore" the old vehicle in then event the server/game crashes or even if the player quit the game without taking a vehicle off the tow hook.

This has worked with the vanilla vehicles without hitch. But when I tried to save the parts and reload the vehicles from KI5 mods I just get random part swaps, so how can I use this method if the biggest vehicle mods are not supported?

I cant and I wont. Which leads me to a new path. JAVA. What if we can convince indie Stone to change a few java functions? If not, why not do it myself or find a mod that changes it and have a prerequisite/required mod to use this. I'm honestly not sure at this point but if we want a great tow truck experience then I fear we have to go to greater lengths to achieve it.

What say you?
< >
正在显示第 1 - 2 条,共 2 条留言
Primedew 9 月 15 日 下午 4:28 
you could look into autotsar hauler, which kind of does the thing you want, at least it's the closest...then there is car wanna
Beornvig 9 月 18 日 下午 12:11 
Hey there, I was the one who commissioned the K-Series tow-trucks from Ki5. I am happy to support your modding efforts to fix the towing experience at the Java level. Tell me if I can commission that work from you, or can assist in any other way possible. I have not had any issues using your mod with the new tow-trucks in B42 so far, it's been working great. I have not had any crashes or anything though.
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50