Jump to content
Sign in to follow this  
MrCouper

Vehicle mods

Recommended Posts

I've seen people making replacement models for the in-game cars. I was wondering how do I go about modeling some of my own?
If anybody could point me in the right direction it would be much appreciated, thanks in advance :)

Share this post


Link to post
Share on other sites

Hey dude, sorry, I know this reply is a bit late... Also sorry if this explanation  is confusing as heck, but hey, I'm gonna try.

 

After you make the model, you've gotta convert it to what PZ uses, a .txt file. For blender, you can export/import PZ models using scripts. I'll attach them to this post. I didn't make these, I can't script for crap. I found them somewhere on here, but can't remember where. If you need to know how to run scripts with blender, just lemme know.

After you've got the model zombified and ready to go, you can set it up as a mod. Name it something like Vehicles_MYCAR.txt.

 

So if you're on steam, you're gonna go to C:\Users\YOUR NAME\Zomboid\Workshop, then make a copy of ModTemplate and rename it to whatever you want for your mod.

Preview.png will be the image that appears in the steam workshop, workshop.txt gives the workshop all the info for your mod.

Then move on into Contents\mods\ModTemplate(which you'll also rename to your mod). Mod.info has all the info that's in the mod menu in the game. Name is how the name will appear, and ID is whatever the folder is named. Poster.png is what appears in the mod menu.

 

Alright, time to get to the meat and potatoes. The rest of this will be done in the media folder.

If you're using the mod template, go ahead and delete the maps folder.

 

We need to place a to throw the models, so create a models folder and put Vehicles_MYCAR.txt in there.

Now we need somewhere for the textures, so head back to media and make a textures folder. In that folder, make a Vehicles folder, so you've got media/textures/vehicles. In there, place your model's texture, Vehicle_MYCARShell.png.

 

Back to the media folder again. Make a folder called scripts, make a folder in there called vehicles (so it's media/scripts/vehicles). Best thing to do here would be to copy one of the vehicle scripts from the game. It's easiest if you copy one similar to what you're making. Let's say you're making a four door sedan. Hey, the taxi's a four door sedan, so why not use that? Copy vehicle_taxi.txt from your ProjectZomboid/media/scripts/vehicles folder into your mod's scripts folder and pop that sucker open. I recommend using notepad++ for this instead of window's default notepad.

On line 11, you should see file = Vehicles_CarTaxi. Change Vehicles_CarTaxi to Vehicles_MYCAR (or whatever your model file  is called, without the extension). Upper and lower case matter when you're loading in any file, so make sure you check that.

 

Now go down to line 20 and change texture = Vehicles/Vehicle_CarTaxiShell to texture = Vehicles/VehicleMYCARShell. Or whatever, again, without the extension.

If you made new lights, damage and rust masks for you car, you change those on lines 28-34. Currently, though, they don't work for mods.

Now you just need to tweak this sucker.

 

Extents and physicsChassisShape are basically the collision area of the car. 

You might need to change the wheel position, those are the offset setting for wheel FrontLeft, wheel FrontRight, etc. Lines 103-134 in the taxi's file.

You'll probably need to tweak the seat positions, too. Lines 136-189, my dude. Again, the offset will change where it's at. Outside will be where you get out of the car.

To change where you can enter the car, go on down until you see area SeatFrontLeft, line 199. It'll say xywh = buncha numbers. The x axis will be, y will be along the length of it, w is width of the green box, and I guess h is height, but I haven't experimented with that yet. You might need to change the other areas too, but it works the same way.

Now the car is ready to go, you just need to get the mod to load it. Head back to the media folder for, ideally, the last time. Buuuut if you're anything like me it won't be, because you'll have made some dumb, small spelling error or something like that.

 

So you need something to load the models into the game. Create a folder called lua. In the brand spankin' new lua folder, make a text file, and rename it to MYCAR.lua. Make sure you give it a unique name or else it could conflict with other mods. Since I can't code, script and am barely able to form a coherent sentence, I just copied and modified the model loader I found in Jab's crowbar mod.

 

require 'Reloading/ISReloadManager'
local MOD_ID = "MODNAME";
local MOD_NAME = "MODNAME";
local MOD_VERSION = "1.00";
local MOD_AUTHOR = "YOURNAME";

 

local function info()
    dir = getDir(MOD_ID); 
    loadStaticZomboidModel("Vehicles_MYCAR",
    dir.."/media/models/Vehicles_MYCAR.txt",
    dir.."/media/textures/Vehicles/Vehicle_MYCARShell.png");

 

print("Mod Loaded: " .. MOD_NAME .. " by " .. MOD_AUTHOR .. " (v" .. MOD_VERSION .. ")");
end

Events.OnInitWorld.Add(info);

 

Save it, start the game and test 'er out.

 

I'm not great at explaining things, so please, feel free to ask if anything needs clarified, my dude.

Export.txt

Import.txt

Share this post


Link to post
Share on other sites

Hey Filibuster!!

Big fan of your work.... Especially like the Bronco & Suburban... and more recently CRX (though you said you just uploaded it for another person).

 

Just wanted to say that, and Thanks!

 

 

 

Share this post


Link to post
Share on other sites

Was thinking the same thing... how it's too bad we have to shuffle new cars into the handful of slots instead of just having a huge variety... When we get more slots it will REALLY become an Easter Egg hunt searching for our favorite rides!!

 

*COuGh* 79TransAm *CouGh*  haha

Share this post


Link to post
Share on other sites

Fili does indeed make some sweet rides, his 69 charger with a custom general lee paint job is my normal ride ;)

 

Still waiting for that WIP to show up in the workshop..its going to look awesome in my parking lot :D

Dont blame you for waiting til it can be done as a non-replacement though.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...