How to Spawn Pristine Cars

HospitalChair

Well-Known Member
I was under the impression it was handled in cfgspawnabletypes.xml but even changing the item chance to 1.00 doesn't seem to spawn with those parts.
Also looking for a way to add items in the trunk as well like a can of gas and water/oil.

Here is how i currently have my hatchback. in spawnabletypes.xml

<type name="OffroadHatchback">
<attachments chance="1.00">
<item name="HatchbackWheel" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackWheel" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackWheel" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackWheel" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackWheel" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="CarRadiator" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="CarBattery" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="SparkPlug" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HeadlightH7" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HeadlightH7" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackDoors_Driver" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackDoors_CoDriver" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackHood" chance="1.00" />
</attachments>
<attachments chance="1.00">
<item name="HatchbackTrunk" chance="1.00" />
</attachments>
</type>

Any help would be great, thanks!
 

HospitalChair

Well-Known Member
Update: I only found one spawn last night while working on my server and the car spawned fully repaired. The only change i made was on this line
<item name="HatchbackWheel" chance="1.00" /> I changed the "1.00" to "1" with no decimals. Will hopefully be testing some more tonight.
 
Update: I only found one spawn last night while working on my server and the car spawned fully repaired. The only change i made was on this line
<item name="HatchbackWheel" chance="1.00" /> I changed the "1.00" to "1" with no decimals. Will hopefully be testing some more tonight.
What did you find? I have had the same problems, I change the value and nothing changes on any of the cars. I even did what you said and changed from 1.00 to 1 and it gets rid of everything off the cars. I’m hopelessly stuck and can’t find any relevant information regarding this. I want to spawn in fully repaired cars with gasoline in. I either still have randomly assembled cars or just chassis with no attachments.
 
I did a write-up a while back on my site here that should help: Adding New Vehicles in DayZ SA v1.0+

I have yet to figure out how to spawn them with fluids good to go etc, but I spawn them fully fixed with a can of gas as cargo. It's up to the player to fill it up with the gas then use the can to get water and fill the radiator. That's the best I could figure out so far.
 
I know this may be a bit late but I found out how to spawn a car on players in your Private/Hosted DayZ server
Add the following to your init.c file


EntityAI car;
vector NewPosition;
vector OldPosition;
OldPosition = player.GetPosition();
NewPosition[0] = OldPosition[0] + 2;
NewPosition[1] = OldPosition[1] + 0.2;
NewPosition[2] = OldPosition[2] + 2;

car = GetGame().CreateObject( "OffroadHatchback", NewPosition, false, true, true );
car.GetInventory().CreateAttachment("HatchbackHood");
car.GetInventory().CreateAttachment("HatchbackTrunk");
car.GetInventory().CreateAttachment("HatchbackDoors_Driver");
car.GetInventory().CreateAttachment("HatchbackDoors_CoDriver");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel"); //spare
car.GetInventory().CreateAttachment("SparkPlug");
car.GetInventory().CreateAttachment("EngineBelt");
car.GetInventory().CreateAttachment("CarBattery");
car.GetInventory().CreateAttachment("CarRadiator");

auto carfluids = Car.Cast( car );
carfluids.Fill( CarFluid.FUEL, 1000 );
carfluids.Fill( CarFluid.OIL, 1000 );
carfluids.Fill( CarFluid.BRAKE, 1000 );
carfluids.Fill( CarFluid.COOLANT, 1000 );

car.SetAllowDamage(false);
 
I know this may be a bit late but I found out how to spawn a car on players in your Private/Hosted DayZ server
Add the following to your init.c file


EntityAI car;
vector NewPosition;
vector OldPosition;
OldPosition = player.GetPosition();
NewPosition[0] = OldPosition[0] + 2;
NewPosition[1] = OldPosition[1] + 0.2;
NewPosition[2] = OldPosition[2] + 2;

car = GetGame().CreateObject( "OffroadHatchback", NewPosition, false, true, true );
car.GetInventory().CreateAttachment("HatchbackHood");
car.GetInventory().CreateAttachment("HatchbackTrunk");
car.GetInventory().CreateAttachment("HatchbackDoors_Driver");
car.GetInventory().CreateAttachment("HatchbackDoors_CoDriver");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel");
car.GetInventory().CreateAttachment("HatchbackWheel"); //spare
car.GetInventory().CreateAttachment("SparkPlug");
car.GetInventory().CreateAttachment("EngineBelt");
car.GetInventory().CreateAttachment("CarBattery");
car.GetInventory().CreateAttachment("CarRadiator");

auto carfluids = Car.Cast( car );
carfluids.Fill( CarFluid.FUEL, 1000 );
carfluids.Fill( CarFluid.OIL, 1000 );
carfluids.Fill( CarFluid.BRAKE, 1000 );
carfluids.Fill( CarFluid.COOLANT, 1000 );

car.SetAllowDamage(false);
where does this go exactly? the init.c can be finicky.
 
Top