[Release] Configurable Crash Spawns (Crashspawner)

BDC

Well-Known Member
Edit: It turns out that, in my fervor to make a post, I accidentally posted this in the wrong section yesterday. Oops!
--------------------

Howdy guys, this one's something I whipped up for the server admins out there and is something I run on both of mine. I wanted the ability to be able to quickly modify the Crashspawner for the server-spawned heli crashes without having to constantly re-compile a dayz_server.pbo. This addon modifies server_monitor.sqf and server_spawncrashsite.sqf which are located in \dayz_server\system and \dayz_server\compiles folders respectively. This is fairly simple and for those that have access to their dayz_server.pbo with experience in editing and re-compiling it, this one's for you.

1) Server_Monitor.SQF

On or around line 260, you'll find the small section that defines dayz_Crashspawner []. You'll see lines like these:

Code:
//[3, 4, 3, (40 * 60), (15 * 60), 0.75, 'center', 8000, true, false] call server_spawnCrashSite;
        //[3, 4, 5, (40 * 60), (15 * 60), 0.80, 'center', 4200, true, false] call server_spawnCrashSite;
        //[3, 4, 6, (40 * 60), (15 * 60), 0.75, 'center', 10000, true, false] call server_spawnCrashSite; // original for taviana18

This call to the server_spawnCrashSite function has several variables passed to it. Find the last line that starts with "[3, 4, 6...]", etc and comment it out with //. After that line, add this:

Code:
[dayz_Helicrash_GuaranteedLoot, dayz_Helicrash_RandomizedLoot, dayz_Helicrash_SpawnOnStart, dayz_Helicrash_SpawnFrequency, dayz_Helicrash_SpawnVariance, dayz_Helicrash_SpawnChance, 'center', dayz_Helicrash_SpawnRadius, dayz_Helicrash_SpawnFire, dayz_Helicrash_FadeFire] call server_spawnCrashSite;

These variables will be defined in Init.SQF.

2) Init.SQF

The list of these variables can be placed just below the "// Server Variables" section or basically anywhere. I prefer to keep them towards the top of the file.

Code:
// DayZ Helicrash (CrashSpawner) Configurable Parameters - Server_Monitor.SQF/Server_SpawnCrashSite.SQF
dayz_Helicrash_GuaranteedLoot = 3; // Max number of guaranteed spawned loot piles (default: 3)
dayz_Helicrash_RandomizedLoot = 6; // Max number of spawned random loot piles (default: 6)
dayz_Helicrash_SpawnOnStart = 6; // Number of helicrashes that spawn on server start (default: 6)
dayz_Helicrash_SpawnChance = 0.75; // helicrash spawn chance (default: 0.75)
dayz_Helicrash_SpawnRadius = 10000; // Spawn radius in meters of helicrashes from center map marker (default Taviana: 10000, default Chernarus: 4200)
dayz_Helicrash_SpawnFrequency = 2400; // frequency the crashspawner will produce a new crash (in seconds) (default: 2400)
dayz_Helicrash_SpawnVariance = 900; // random variance applied to spawn frequency (in seconds) (default: 900)
dayz_Helicrash_SpawnFire = true; // spawns fireball at crash site (default: true)
dayz_Helicrash_FadeFire = false; // Fades spawned fireball over time (default: false)
dayz_Helicrash_AlternateLoottables = true; // Use alternate crash site loot tables (defaults are HelicrashEAST and HelicrashWEST - configs\CfgBuildingLoot.hpp)
dayz_Helicrash_EASTLootTable = "HeliCrashEAST"; // Russian/east OPFOR helicopters
dayz_Helicrash_WESTLootTable = "HeliCrashWESTSpecial"; // American/British/west BLUFOR helicopters

3) Server_SpawnCrashSite.SQF

On or around line 15, we'll find this line:

Code:
diag_log("CRASHSPAWNER: Starting spawn logic for Crash Spawner");

Add this chunk directly below it:

Code:
diag_log("CRASHSPAWNER: Parameters:");
diag_log format["CRASHSPAWNER: Number to spawn on server start - %1",dayz_Helicrash_SpawnOnStart];
diag_log format["CRASHSPAWNER: Number of guaranteed loot piles - %1",dayz_Helicrash_GuaranteedLoot];
diag_log format["CRASHSPAWNER: Number of randomized loot piles - %1",dayz_Helicrash_RandomizedLoot];
diag_log format["CRASHSPAWNER: Helicrash spawn chance            - %1",dayz_Helicrash_SpawnChance];
diag_log format["CRASHSPAWNER: Spawn radius meters from center - %1",dayz_Helicrash_SpawnRadius];
diag_log format["CRASHSPAWNER: Spawn frequency (seconds)        - %1",dayz_Helicrash_SpawnFrequency];
diag_log format["CRASHSPAWNER: Spawn frequency variance        - %1",dayz_Helicrash_SpawnVariance];
diag_log format["CRASHSPAWNER: Spawn crash fireball            - %1",dayz_Helicrash_SpawnFire];
diag_log format["CRASHSPAWNER: Fade crash fireball                - %1",dayz_Helicrash_FadeFire];

This section will detail more of what's going on to the server's Arma2OAserver.RPT log file.

Scroll down a bit further to about line 30 or so and we'll see this:

Code:
_timeAdjust = ((round(random(_variance * 2))) - _variance);
    _timeToSpawn = time + _frequency + _timeAdjust;

Comment both of these lines out and add this directly below:

Code:
_timeAdjust = ((round(random(dayz_Helicrash_SpawnVariance * 2))) - dayz_Helicrash_SpawnVariance);
    _timeToSpawn = time + dayz_Helicrash_SpawnFrequency + _timeAdjust;

A little bit further down, around line 45 or so, we'll find this chunk:

Code:
//selecting loottable
    if (_crashModel == "Mi8Wreck_DZ") then {
        _lootTable = "HeliCrashEAST";
    } else {
        _lootTable = "HeliCrashWEST";
    };

Comment this entire chunk out. Just below that, we have the section that defines the two loot tables depending upon the type of wreck ("Mi8Wreck_dz", etc). Comment the entire section out and replace it with this:

Code:
//or just helicrash loottable
    if (_crashModel == "Mi8Wreck_DZ" ||  _crashModel == "Mi24Wreck") then {
        _lootTable = "HeliCrashEAST";
        if (dayz_Helicrash_AlternateLoottables) then { // init.sqf
            _lootTable = dayz_Helicrash_EASTLootTable;
        };
    } else {
        _lootTable = "HeliCrashWEST";
        if (dayz_Helicrash_AlternateLoottables) then { // init.sqf
            _lootTable = dayz_Helicrash_WESTLootTable;
        };
    };

All that is needed after this is simply re-compiling the dayz_server.pbo one time. From here, all of the crashspawner variables can be easily modified in the init.sqf with no more hassle.

Hope this helps somebody out.

B
 
Back
Top