Jump to content
nolanri

Driving Cars Mod

Recommended Posts

Official Web Page: http://undeniable.info/pz/DrivingCarsMod.php   

List of all the Vehicles with their information here: http://undeniable.info/pz/DrivingCarsMod.php#list

Please Help Contribute if you can!

 

TO DO LIST:

Fix Problems on Multiplayer:

GridSqaure:transmitRemoveItemFromSquare(item) seems to occasionally fail or time out when used multiple times per second. This problem is causing cars to duplicate themselves from time to time as you drive along. I have yet to find a solution to this

 

Maybe we can kindly ask the devs if they can provide a method for the IsoWorldInventoryObject  class such as setPosition(newX, newY)
though I understand this could be more difficult then it sounds as these world inventoy objects are relative to what square they exists on.  So if thats too much to ask, I can live with just a setTextureOffset(newX, newY) method so I can just change the offset of the car Until it moves onto a different square. This would reduce my item drop and pickup command spamming by like 80% which should fix the problems experienced in MP.  What do you say devs?


Make isometric car images for other kinds of cars with all 8 angles
We should really make our own art as I just found most of these cars on google images, though I made slight adjustments to them, we really need you artists to whip us up some isometric vehicles from the 8 angles you see. Including one image of the car being broken.

 

Off Topic: Feeling Bored? Try these games
The game of Stones
The game of Lights

 

Edited by nolanri
info

Share this post


Link to post
Share on other sites
On 6/3/2016 at 6:16 PM, nolanri said:

- add car spawning on world load, cars to spawn ON THE FLOOR in random areas


Here is the car spawn code from Hydrocraft awhile back.

Spoiler

 


function HCSprites.Cars(square)
    if not square:getModData().Hydrocraft then
            local cBagDistro = nil;
            local cBag = nil;
            local street = square:getObjects();
            if not square then return false end
            if street:size() > 0 then
                    for x=0, street:size()-1 do
                            if street:get(x):getTextureName() and string.find(street:get(x):getTextureName(), "blends_street") then
                                    if ZombRand(1000) == 0 then
                                            carType = ZombRand(100);
                                            if carType == 0 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTowtruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTowtruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCTowtruckDirty"];
                                            elseif carType == 1 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMixertruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMixertruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCMixertruckDirty"];
                                            elseif carType == 2 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSchoolbusDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSchoolbusDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCSchoolbusDirty"];
                                            elseif carType == 3 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCFiretruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCFiretruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCFiretruckDirty"];
                                            elseif carType == 4 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCPolicecarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCPolicecarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCPolicecarDirty"];
                                            elseif carType == 5 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCAmbulanceDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCAmbulanceDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCAmbulanceDirty"];
                                            elseif carType > 5 and carType < 11 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCJeepDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCJeepDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCJeepDirty"];
                                            elseif carType > 10 and carType < 21 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCTruckDirty"];
                                            elseif carType > 20 and carType < 31 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMotorhomeDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMotorhomeDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCMotorhomeDirty"];
                                            elseif carType > 30 and carType < 41 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSportscarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSportscarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCSportscarDirty"];
                                            else
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCCarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCCarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCCarDirty"];
                                            end
                                    end
                            end
                    end
            end
            square:getModData().Hydrocraft = "squareused";
            if cBagDistro then
                    ItemPicker.rollContainerItem(cBag, nil, cBagDistro);
            end
    end
end


Events.LoadGridsquare.Add(HCSprites.Cars);

 

Also here is an example on how to get the car to have its own loot ...

Spoiler

 


-- Add items for Dirty Car
SuburbsDistributions["HCCarDirty"] = {
rolls = 2,
items = {
"Base.CorpseMale", 1,
"Base.CorpseFemale", 1,
"Hydrocraft.HCAirfreshener", 1,
"Hydrocraft.HCCarkey", 1,
"Hydrocraft.HCMap", 0.1,
"Base.Wallet", 1,
"Base.Disc", 1,
"Base.WaterBottleEmpty", 1,
"Base.Tissue", 1,
"Hydrocraft.UmbrellaClosed", 0.1,
},
fillRand = 5,
};

 

Hope this helps. Please credit Hydocraft mod if you use it. Yoss worked hard on it with me. Also if you know how to improve it so cars do not appear in walls, please let me know.

Edited by Hydromancerx

Share this post


Link to post
Share on other sites

This mod looks absolutely amazing but one question. Why is there a WW2 Willy's Jeep there wouldnt it make more sense to have a more modern version such as the J8?

Jeep.jpgWillies

VS.


Jeep 2.jpgJ8 (minus the gun obviously)

Share this post


Link to post
Share on other sites
17 hours ago, Hydromancerx said:


Here is the car spawn code from Hydrocraft awhile back.

  Reveal hidden contents

 



function HCSprites.Cars(square)
    if not square:getModData().Hydrocraft then
            local cBagDistro = nil;
            local cBag = nil;
            local street = square:getObjects();
            if not square then return false end
            if street:size() > 0 then
                    for x=0, street:size()-1 do
                            if street:get(x):getTextureName() and string.find(street:get(x):getTextureName(), "blends_street") then
                                    if ZombRand(1000) == 0 then
                                            carType = ZombRand(100);
                                            if carType == 0 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTowtruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTowtruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCTowtruckDirty"];
                                            elseif carType == 1 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMixertruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMixertruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCMixertruckDirty"];
                                            elseif carType == 2 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSchoolbusDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSchoolbusDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCSchoolbusDirty"];
                                            elseif carType == 3 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCFiretruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCFiretruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCFiretruckDirty"];
                                            elseif carType == 4 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCPolicecarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCPolicecarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCPolicecarDirty"];
                                            elseif carType == 5 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCAmbulanceDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCAmbulanceDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCAmbulanceDirty"];
                                            elseif carType > 5 and carType < 11 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCJeepDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCJeepDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCJeepDirty"];
                                            elseif carType > 10 and carType < 21 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTruckDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCTruckDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCTruckDirty"];
                                            elseif carType > 20 and carType < 31 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMotorhomeDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCMotorhomeDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCMotorhomeDirty"];
                                            elseif carType > 30 and carType < 41 then
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSportscarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCSportscarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCSportscarDirty"];
                                            else
                                                    if ZombRand(2) == 0 then
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCCarDirty", 0.0, 0.0, 0.0);
                                                    else
                                                            cBag = square:AddWorldInventoryItem("Hydrocraft.HCCarDirty2", 0.0, 0.0, 0.0);
                                                    end
                                                    cBagDistro = SuburbsDistributions["HCCarDirty"];
                                            end
                                    end
                            end
                    end
            end
            square:getModData().Hydrocraft = "squareused";
            if cBagDistro then
                    ItemPicker.rollContainerItem(cBag, nil, cBagDistro);
            end
    end
end


Events.LoadGridsquare.Add(HCSprites.Cars);

 

Also here is an example on how to get the car to have its own loot ...

  Reveal hidden contents

 



-- Add items for Dirty Car
SuburbsDistributions["HCCarDirty"] = {
rolls = 2,
items = {
"Base.CorpseMale", 1,
"Base.CorpseFemale", 1,
"Hydrocraft.HCAirfreshener", 1,
"Hydrocraft.HCCarkey", 1,
"Hydrocraft.HCMap", 0.1,
"Base.Wallet", 1,
"Base.Disc", 1,
"Base.WaterBottleEmpty", 1,
"Base.Tissue", 1,
"Hydrocraft.UmbrellaClosed", 0.1,
},
fillRand = 5,
};

 

Hope this helps. Please credit Hydocraft mod if you use it. Yoss worked hard on it with me. Also if you know how to improve it so cars do not appear in walls, please let me know.


The cars are spawning with this, but no items inside. where exactly did you put the second hidden code block?

Share this post


Link to post
Share on other sites

Looks awesome! A few suggestions that I really feel would benefit this mod:

 

Vehicle Handling:

1.) Add acceleration if possible. Start slower and speed up the longer you move

2.) Reduce the drifting

 

Vehicle damage:

1.) Zombies should do more damage, maybe 3-5% depending on your speed

2.) Only the mechanic profession should be able to repair cars. Any other profession should have to find a magazine or book. 

3.) Using just a screwdriver is way overpowered. Maybe require some duct tape, electronic scrap, wire, and a screwdriver to directly repair or make a car repair kit. Maybe you could use the same menu as repairing a weapon when you right-click the car and mouse over repair. If you did this, you could use the current weapon repair system and show what parts are required for a fix, what chance it has to work, how much it will fix, and what the car's current durability is. I'm not sure if all of that can be done in Lua, however.

Share this post


Link to post
Share on other sites

I want to give a little idea for the realization of tiles required, in this case using vehicle models made in (sketchup) are good reference to draw your art or even design your own car, positioning it in the right way could remove all the faces in pictures and make them perfect for the mod tiles, only the task to some extent is a lot of work but it could work.

https://3dwarehouse.sketchup.com/model.html?id=b7dcce972806d2d72543e01b3a3ce7d9

 

An example

 

https://mega.nz/#!7ZZ2yaRa!_c_C-gxFr42SRmv_KNer6TMGEV0p08_uJo4eNlTGbv0

Share this post


Link to post
Share on other sites

First off, thanks for the release and all your great work on this :)

 

21 hours ago, Spracky said:

Vehicle damage:

1.) Zombies should do more damage, maybe 3-5% depending on your speed

2.) Only the mechanic profession should be able to repair cars. Any other profession should have to find a magazine or book. 

3.) Using just a screwdriver is way overpowered. Maybe require some duct tape, electronic scrap, wire, and a screwdriver to directly repair or make a car repair kit. Maybe you could use the same menu as repairing a weapon when you right-click the car and mouse over repair. If you did this, you could use the current weapon repair system and show what parts are required for a fix, what chance it has to work, how much it will fix, and what the car's current durability is. I'm not sure if all of that can be done in Lua, however.


I will say I couldn't agree with all of this more though :). Zombies at high speeds would be quite the hit in reality and repairing a car is definitely something that should require a bit of materials and skills/recipes from a trait and/or profession (it's only right to lock things behind traits and professions in Project Zomboid :P lol).

Share this post


Link to post
Share on other sites
1 hour ago, benkuhnert6 said:

i seem to be having a bug where cars dont come up as contaniors for me and i cant add fuel to them D:

 

can you show a screen shot?

Share this post


Link to post
Share on other sites

Fantastic work!

 

Getting a similar bug to benkuhnert6 unfortunately .. cars show up as containers but I can't seem to do anything with them.

 

If I do find one with gas in it and find the key, choosing "Start Car" doesn't do anything except spawn a new registration paperwork item.  I've added a couple of screenshots20160607220900_1.jpg.

 

20160607220852_1.jpg

20160607220857_1.jpg

Share this post


Link to post
Share on other sites

Screenshots on my previous post aren't showing up in order .. the 1st screenshot is actually after I've tried to start the car (and the papers have appeared)

 

The car has gas (I can see the gas icon if I hover over it)

 

Hope that helps!

Share this post


Link to post
Share on other sites

MarkusM and Benkuhnert6, I had the same problem you guys were having. I figured out via trial and error that the bug on my game was caused by a mod, particularly ZomboidXBow. Once I disabled it, I can finally access the vehicle as a separate container.

 

Hope this helps!

Share this post


Link to post
Share on other sites
9 hours ago, Tapsilog said:

MarkusM and Benkuhnert6, I had the same problem you guys were having. I figured out via trial and error that the bug on my game was caused by a mod, particularly ZomboidXBow. Once I disabled it, I can finally access the vehicle as a separate container.

 

Hope this helps!

I was gonna suggest to start disabling other mods one by one and see what happens.  I hope your sure it was mod " ZomboidXBow " because i'll add a note that you might have incompatibility with this enabled

Edited by nolanri

Share this post


Link to post
Share on other sites

It was in my case. I tried to reinstate the bug by activating the mod to try and confirm, and I can say that ZomboidXBow does indeed cause it for my end.

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...

×
×
  • Create New...