Jump to content

Static Vehicle Spawn Positions


Judge Bread

Recommended Posts

Static Vehicle Spawn Positions

Current version: 1.0

 

Information:

 

I have been developing a system to allow server admins to dictate where certain types of vehicles spawn at specific positions on the map. This is to cope with the spawning of vehicles in places that cause them to be unusable. An example of this is the C130J_US_EP1 spawning in the middle of a forest or on the side of a mountain where there isn't enough room to actually take off. This system does not replace the dynamic vehicle spawning system developed by the Epoch developers but simply adds a step in the process to check for a static spawn position as set up by the server admin before using the dynamic spawn system.

 

This is my first such release and although I have tested it thoroughly, I do advise you to test it on your test systems before deploying it to live. The system was tested on Taviana and thus you will need to modify the spawn locations for your own map. The file to edit your spawn locations is FS_StaticVehicleSpawnLocations.sqf.

 

Bugs and feedback to enhance the system is welcome but please make sure you clearly state them with reasoning.

 

The attached zip file contains all the files required, information about the system and a set of the following detailed instructions.

 

 

 

Installation:

 

Server:

 

- Open the server_monitor.sqf found in the system directory.

- Find these lines (yours might look different depending on the epoch version you have).

    //  spawn_vehicles
    _vehLimit = MaxVehicleLimit - _totalvehicles;
    if(_vehLimit > 0) then {
        diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
        for "_x" from 1 to _vehLimit do {
            [] spawn spawn_vehicles;
        };
    } else {
        diag_log "HIVE: Vehicle Spawn limit reached!";
    };

- Change to this

    //  spawn_vehicles
    _vehLimit = MaxVehicleLimit - _totalvehicles;
    if(_vehLimit > 0) then {
        diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
        if (DZE_FS_UseStaticVehicleSpawn) then {
            [_vehLimit] spawn fs_spawnVehicles;
        }
        else {
            for "_x" from 1 to _vehLimit do {
                [] spawn spawn_vehicles;
            };
        };
    }
    else {
        diag_log "HIVE: Vehicle Spawn limit reached!";
    };

   
- Extract the FS_SpawnVehiclesV1.zip archive in the root directory of your server. You should now have a folder called FS_SpawnVehicles in your root directory.

- The files in this folder will manage the spawning of new vehicles for the server if 'DZE_FS_UseStaticVehicleSpawn' is true.

 

 

Mission:

 

- Global variable DZE_FS_UseStaticVehicleSpawn (true/false) can be used to state if static vehicle spawning should be used or not. (Default: false).
Add this along with all other global variables

DZE_FS_UseStaticVehicleSpawn = true;

- In the mission's init.sqf file under this

    //Compile vehicle configs    
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_13.Tavi\dynamic_vehicle.sqf";

Add this

    if (true) then {
        private "_handle";
        _handle = [] execVM "\z\addons\dayz_server\FS_SpawnVehicles\FS_StaticVehicleSpawnCompiles.sqf";
        waitUntil{scriptDone _handle};
    };

Configuration:

 

- Open the FS_SpawnVehicles folder.

- Open FS_StaticVehicleSpawnLocations.sqf.

 

- This file contains the configurations for the system.

 

- You can configure it in two ways.

   1) Simply add to the existing configuration.

   2) Create your own configuration.

 

 

1) Using existing configurations:

 

- In FS_StaticVehicleSpawnLocations.sqf you will find the 3 pre-defined location arrays LandSpawnLocations, AirSpawnLocations and SeaSpawnLocations. DO NOT DELETE THESE.

 

- Simply, add position (x,y) or positionATL (x,y,z) arrays (e.g. [x,y,z]) to the relevant location array you want to modify. Only x and y coordinates are used in the spawn process.

 

 

2) Creating custom configurations:

 

- Create a new Location Array with a unique name. I have used 'C130JSpawnLocations' as an example.

Note: following example is already present in the file therefore do not replicate it instead make your own.

e.g.
C130JSpawnLocations = [
    [16590,11435.5,0.001],
    [7540.4,7783.1,0.001],
    [10416.6,17588.1,0.002],
    [10060.83,18570.948,0]
];

- To configure a vehicle to use the newly created location array, it must be added to the StaticVehicleSpawnConfig.

 

- The StaticVehicleSpawnConfig is a simple array and works like a look up table. It itself consists of arrays that have two strings that make up the configuration.

- The first element/string of the configuration is the vehicle class that will make use of the newly created location array.

- The second is the exact name of the newly created location array.

 

- The first and second element should be added like this: ["VehicleClass","LocationArrayName"]

- Add the location array name exactly as created (copy-paste it to make sure it is exact). Add all new configurations above the LandVehicle, Air and Sea configurations. This will ensure it gets checked and used before getting picked up by the Land/Air/Ship configurations.
 

e.g.
StaticVehicleSpawnConfig = [
    ["C130J_US_EP1","C130JSpawnLocations"],    // C130J_US_EP1 Static Spawn Config <-- NEWLY ADDED CONFIGURATION
    ["LandVehicle","LandSpawnLocations"],      // All Land Vehicles (Do not remove)
    ["Air","AirSpawnLocations"],               // All Air Vehicles (Do not remove)
    ["Ship","SeaSpawnLocations"]               // All Sea Vehicles (Do not remove)
];

- The example shows that the "C130JSpawnLocations" array will be used for the "C130J_US_EP1" vehicle class.

 

 

Now when the server starts it will attempt to use the above locations and configuration to find a suitable position for the vehicle. If it is unable to then it will fall back to using the dynamic spawn system.

 

 

 

EDIT (15/06/2014) => DOWNLOAD LINK FIXED. LAST TESTED WITH VERSION 1.0.4

FS_SpawnVehicles.zip

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
  • 3 weeks later...
  • 1 month later...

script works beautifully on my server. Only question i would ask is is there a way to specify the direction that the vehicles are pointing in when they spawn? i've got some planes set to static spawn for the convenience of fresh spawns getting around the large map, but sometime the planes spawn point off in a direct from which there isnt enough space to taxi back onto the runways

Link to comment
Share on other sites

  • 3 weeks later...

The vehicle spawn is working for me.. But I'm getting this spam in the rpt error...

19:58:25 Error in expression <s select _index;
_itemType = _itemTypes select _index;
};
[_veh,[_dir,_objPos>
19:58:25   Error position: <select _index;
};
[_veh,[_dir,_objPos>
19:58:25   Error Zero divisor
19:58:25 File z\addons\dayz_server\FS_SpawnVehicles\FS_SpawnVehicles.sqf, line 320

How can i solve this? I didn't changed anything in this file.

Link to comment
Share on other sites

  • 3 weeks later...

Locked for future use.

this is not working..

should ALL "air" spawn near the defined coords ??

do I have to define whats "AIR"

or should it know whats air ??

like 1 jet spawned at airfield coord the rest out in the woods.

 

/****    LOCATION CONFIGURATIONS START    ****/

// All land vehicles
LandSpawnLocations = [
];

// All Air vehicles
AirSpawnLocations = [
[14696.3,16683.7,0], // awols
[4682.77,4593.8,0.001], // hero field
[18388.4,2269.16,0.001] // south af
];


// All Sea/Ship vehicles
SeaSpawnLocations = [
];

// Specific C130J_US_EP1 spawn locations.
C130JSpawnLocations = [
//[14696.3,16683.7,0.001], // Dubovo Airfield
//[4682.77,4593.8,0] // Yaroslav airport
];

// Static Vehicle Configurations.
// Vehicle Class (as string), Vehicle spawn location array name (as string)
StaticVehicleSpawnConfig = [
//["C130J_US_EP1","C130JSpawnLocations"], // C130J_US_EP1 Static Spawn Config
["LandVehicle","LandSpawnLocations"], // All Land Vehicles (Do not remove)
["Air","AirSpawnLocations"], // All Air Vehicles (Do not remove)
["Ship","SeaSpawnLocations"] // All Sea Vehicles (Do not remove)
];

Link to comment
Share on other sites

I have been looking around and had a few attempts myself of keeping dynamic spawns but having custom static spawn locations for vehicles on restart.

Mainly for anyone who donates enough to get the perk as a thankyou.

I can get the vehicle to spawn on server start but as soon as you get inside it is removed.

From what i can see the vehicle has no ID so the DB has a fit and deletes it.

Anyone got any ideas ?

 

Cheers

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
  • Advertisement
  • Discord

×
×
  • Create New...