Jump to content

Adding a new part to the game's Step Van


Blockbot20

Recommended Posts

Hi, I'm making a mod that adds a removable (with some electrical skill) back-up beeper to spawn with the game's step vans, while adding a little extra trunk room (the downside being putting the vehicle in reverse will make a looping loud beep from the vehicle, which will attract zombies until the part can be uninstalled). This will not be visible from looking at the step van, but checking at the mechanics tab will reveal whether it's installed or not. It will always be installed when the vehicle spawns into the world.

 

I know of older versions of the game where something very similar was on all commercial vehicles, but I couldn't find the code for that in those versions files, and the seemed to have a problem where the sound would play as soon as the reverse button was pressed, and rapidly tapping would quickly, repeatedly play the sound. My goal was to avoid that and place a minimum time limit between each beep. Hopefully, this is understandable and enough information.

 

This is my first mod, I have a little familiarity with coding, but not much with lua, so I'd like to apologize, I had to take inspiration from similar vehicle mods already on the workshop.

 

Unfortunately, I'm not quite sure what exactly is causing this issue. Booting up the game with only this mob enabled shows no change from the base game. The step vans in the world will not have the part on them and will not beep in reverse. The console give the following: ERROR: template "BackUpBeeper" not found. (The name I have used throughout the code to specify this back-up beeper.)

 

I have below attached files I suspect to be causing the problem. "beeper_vehiclesitems" gives the qualities of the back-up beeper itself, while "template_beeper" explains the qualities of the item in the vehicle, if that's the correct information. I also have attached the revised step van code for the game. The changes I have made it to where the back-up beeper ("template = BackUpBeeper") and an increase of 10 to the step van's trunk size, increasing it to 170.

 

These were taken after the example of the base game's code for adding vehicle items, so I'm not quite sure what bits are necessary for this item. For example, some of the code that specified an item of a vehicle had a "lua" segment at the end, which I believe gave the variables such as "create" and "update" and I believe all of them had "test" under the specifications for uninstalling the part. This can be seen as the last written code in my "template_beeper". Is this necessary? What, exactly, does it do?

 

I have additionally attached below the code which specifies what functions of the back-up beeper (I have my intended functions for the beeper at the top of this message) The code runs through the game as the mod is but it may cause errors in the future once the mod's functionality changes.

 

I apologize if this was too much to read, I just wasn't sure how to get the mod functioning properly. Thank you.

 

 

beeper_vehiclesitems.txt template_beeper.txt vehicle_stepvan.txt ReverseBeeper.lua

Edited by Blockbot20
Link to comment
Share on other sites

To add on here to what I was saying, it could be an issue with naming. The aforementioned error message printed in one chain through the whole console (from printing in two chains through the console) when I changed the part name and item name in beeper_vehiclesitems and template_beeper to not have the name "BackUpBeeper"

Link to comment
Share on other sites

Additionally, I currently had the script which checks to when the back up beeper should play (which, if I am correct in the importance of correct folder location, is in the "client" folder, it does not check if the negative velocity is being applied by the driver, as in the player driving the vehicle puts it in reverse (it seems it would play, for example, if the van was rammed and knocked backward). What would such a command be for the code to check whether it is the player driving that puts the vehicle in reverse? The code in question is the "if"  statement at line 35 and 36, if you can see the ReverseBeeper.lua file there.

 

Thank you for taking the time to read through these.

Edited by Blockbot20
Link to comment
Share on other sites

To clarify, the same edits made to the vehicle_stepvan file were also made to the vehicle_stepvan_mail, vehicle_stepvan_scarlet, and vehicle_stepvan_heralds files. This seems to cover all of the step vans in the game. Unfortunately, I did not different results when testing these vans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...