Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

Sign in to follow this  
Dr.Nymphoz

Respawn a vehicle

Recommended Posts

Hello everyone, may anyone help here? How can i respawn a vehicle that was spawned on server by script in init.c ? i need something like this parameter <restock>30</restock>.

My script to spawn a vehicle on server:

void spawnVehicle(string type, vector position)
{
    EntityAI car = GetGame().CreateObject(type, position);
    car.SetPosition(position);
        autoptr array<string> m_Attachments = {
        "HeadlightH7","HeadlightH7","SparkPlug","CarBattery","CarRadiator","EngineBelt",
        "CivSedanDoors_Driver","CivSedanDoors_CoDriver","CivSedanDoors_BackLeft","CivSedanDoors_BackRight","CivSedanHood","CivSedanTrunk",
        "CivSedanWheel","CivSedanWheel","CivSedanWheel","CivSedanWheel"};
        if (car)        
            foreach (string att : m_Attachments)
            car.GetInventory().CreateAttachment(att);
        auto carfluids = Car.Cast( car );
        carfluids.Fill( CarFluid.FUEL, 100 );
        carfluids.Fill( CarFluid.OIL, 1000 );
        carfluids.Fill( CarFluid.BRAKE, 1000 );
        carfluids.Fill( CarFluid.COOLANT, 1000 );
 }
void main()
{
    //VEHICLE
spawnVehicle( "CivilianSedan", "8742.036133 8.230740 2331.631104");
spawnVehicle( "CivilianSedan", "8877.351563 9.299133 2257.636230");
}

i would use a vehicle spawn with "cfgspawnabletypes.xml" without scripts but i don't know how to spawn a vehicle with full fuel not using a script... (sorry for my poor english).

Share this post


Link to post
Share on other sites
Sign in to follow this  

×