Project Zomboid

Project Zomboid

Tow Truck [B42]
obtainchi  [开发者] 9 月 13 日 上午 6:47
About PZ modding and towing
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 - 3 条,共 3 条留言
Rachel L 9 月 14 日 上午 8:21 
I think you could talk with Black Moon (the modder behind Realistic Car Physics [B42] and Project Summer Car [B42] ) because he already has a java mod and a mod that add new parts for the engine, and it adds them dynamically (not manually) that works even with any modded car, so he could probably help you with the parts changing part.
obtainchi  [开发者] 9 月 18 日 下午 1:26 
Thanks for your input Rachel. I think Ill be offering the users the ability to choose how they want to play the mod with 3 options.

1. You download and play, nothing else to do but towing will be limited to how the game thinks anything other than a "Trailer" should be towed. You will still have the hook to tow but also have the brakes on all the time. Towing from the rear of the vehicle is the best way to combat this.

2. You can replace a single java .class file that will turn the brakes off on things being towed. This makes towing the vehicle from the front or back just as easy and towing offroad is easier as well.

3. You can install an alternate mod that also turns the brakes off but does other things such as "Realistic Car Physics".

I think giving the player the options rather than making it a requirement would be the best thing to do. So you choose how you want the towing experience to be.
最后由 obtainchi 编辑于; 9 月 18 日 下午 1:29
Rachel L 9 月 18 日 下午 4:52 
Option would be the one compati with the realistic car physics I imagine, correct?
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50