Animated Helicrashs 0.1 - Release

before we make any changes, try this out and see if this helps. In your file posted above. On line 70, change
_lootTable = ["Military","HeliCrash","MilitarySpecial"] call BIS_fnc_selectRandom;
to
_lootTable = "MilitarySpecial";
and see if that works out. There is no "helicrash" loot table anymore, so that might be causeing some issues. By setting the loottable to a single table that we know does exist we will see if it gets fixed.

What I have in my spawncrash script is this which you can try instead. Goes in the same place, line 70 to replace the selectrandom loottable line.
Code:
    //selecting loottable
    if (_crashModel == "UH1Wreck_DZ
") then {
        _lootTable = "HeliCrashWEST";
    } else {
        _lootTable = "HeliCrashEAST";
    };

If this doesnt work then what we do is create a loot table directly in that file

which, I will insert into your sqf file and upload it if you need it.
 
Last edited:
before we make any changes, try this out and see if this helps. In your file posted above. On line 70, change
_lootTable = ["Military","HeliCrash","MilitarySpecial"] call BIS_fnc_selectRandom;
to
_lootTable = "MilitarySpecial";
and see if that works out. There is no "helicrash" loot table anymore, so that might be causeing some issues. By setting the loottable to a single table that we know does exist we will see if it gets fixed.

What I have in my spawncrash script is this which you can try instead. Goes in the same place, line 70 to replace the selectrandom loottable line.
Code:
    //selecting loottable
    if (_crashModel == "UH1Wreck_DZ
") then {
        _lootTable = "HeliCrashWEST";
    } else {
        _lootTable = "HeliCrashEAST";
    };

If this doesnt work then what we do is create a loot table directly in that file

which, I will insert into your sqf file and upload it if you need it.

Gave this a shot but still looks like I'm getting the same errors.
EDIT: I didnt try the second section:
Code:
    //selecting loottable
    if (_crashModel == "UH1Wreck_DZ
") then {
        _lootTable = "HeliCrashWEST";
    } else {
        _lootTable = "HeliCrashEAST";
    };
 
I apologize for the delay. I will do some dayz stuff tommorrow. I ahve been working so,many hours i just come home and sleep. Havent turned on the computer in two weeks, simply exhausted, but i have things are coming back to,normal now
 
I apologize for the delay. I will do some dayz stuff tommorrow. I ahve been working so,many hours i just come home and sleep. Havent turned on the computer in two weeks, simply exhausted, but i have things are coming back to,normal now
No worries. I can certainly relate my friend!
 
Hmm... has anyone got it working on 1.8.3? The loot will not spawn...


RPT:
Code:
9:40:38 "Vehicle destroyed @057079 - UH1H_DZ, worldspace [222.92,[5715.44,7364.18,93.7128]], CharId 0, objID 0, objUID 0, nearby []"
9:40:38 "CRASHSPAWNER: UH-1H just exploded at [5715.44,7364.18,93.7128]!, "
9:40:51 UH1Wreck_DZ: MainTurret - unknown animation source MainTurret
9:40:51 UH1Wreck_DZ: MainGun - unknown animation source mainGun
9:40:51 UH1Wreck_DZ: Gatling - unknown animation source Gatling
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <HeliCrash";
_weights =        dayz_CBLChances select _index;
_cntWeights = count _weig>
9:40:51   Error position: <select _index;
_cntWeights = count _weig>
9:40:51   Error Zero divisor
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 236
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
9:40:51 "CRASHSPAWNER: Loot spawn at '[5701.52,7345.45,0]' with loot table '15.3165'"
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
9:40:51 "CRASHSPAWNER: Loot spawn at '[5702.48,7358.04,0]' with loot table '15.3165'"
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
9:40:51 "CRASHSPAWNER: Loot spawn at '[5700.47,7357.48,0]' with loot table '15.3165'"
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
9:40:51 "CRASHSPAWNER: Loot spawn at '[5699.25,7345.88,0]' with loot table '15.3165'"
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
9:40:51 "CRASHSPAWNER: Loot spawn at '[5710.53,7352.54,0]' with loot table '15.3165'"
9:40:51 Error in expression < = _this select 3;
_uniq = [];

switch (_iClass) do {
case "weapon": {

_item = >
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9
9:40:51 Error in expression <m 1 to _num do {

_index = floor(random _cntWeights);
_index = _weights select _>
9:40:51   Error position: <_cntWeights);
_index = _weights select _>
9:40:51   Error Undefined variable in expression: _cntweights
9:40:51 File z\addons\dayz_server\compile\server_spawnCrashSite.sqf, line 242
9:40:51 Error in expression <
_item setPosATL _iPos;
sleep 0.01;



_item 
>
9:40:51   Error position: <_item 
>
9:40:51   Error Undefined variable in expression: _item
9:40:51 File z\addons\dayz_code\compile\spawn_loot.sqf, line 85
 
i am at work right now but when i get home i can upload a version i had that didnt use the loot tables, rather it had an array of loot in the file itself and chose randomly.


that rpt looks like you edited the loot tables and have an error there? or the loot system might have changed drastically also with this update?
those _weights errors are rather common with this script.

perhaps this error is causing all the problems tho, iclass is something outside the standard script
Code:
9:40:51   Error position: <_iClass) do {
case "weapon": {

_item = >
9:40:51   Error Undefined variable in expression: _iclass
 
Hm, I don´t think the loottables have changed, as the original crashspawner from 1.8.3 uses the same tables... right now, I´m trying to merge the new static spawner and the animated.

Please upload your script, that would phan-tas-tique.
 
This should work for epoch. It has an array at the bottom where you can add loot items. There was a version that included chances for items, but if you want one item to be more likely to show up, then put it in the array multiple times (I prefer this because you get a visual clue immediately of how likely an item is to be spawned). That is what the weighted array functions for loot does anyways.
Like this
Code:
//EXAMPLE WEIGHTED ARRAY
["ak47"],["ak47"],["ak47"],["ak47"],["ak47"],
["m16a2"],["m16a2"],["m16a2"],
["m107"]
Code:
/*
Script Name: crash_spawner.sqf
Original Author: Grafzahl / Finest
Modified by BushWookie for Epoch and to break the tail instead of just blowing up in the air
*/

private["_timeAdjust","_timeToSpawn","_spawnRoll","_crash","_hasAdjustment","_newHeight","_adjustedPos","_useStatic","_crashDamage","_lootRadius","_preWaypoints","_preWaypointPos","_endTime","_startTime","_safetyPoint","_heliStart","_deadBody","_exploRange","_heliModel","_lootPos","_list","_craters","_dummy","_wp2","_wp3","_landingzone","_aigroup","_wp","_helipilot","_crash","_crashwreck","_smokerand","_staticcoords","_pos","_dir","_position","_num","_config","_staticLoot","_iArray","_crashModel","_guaranteedLoot","_randomizedLoot","_frequency","_variance","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_permanentFire","_crashName"];
//############### //Config Start\\ ###############\\
_SpawnMax        = 100;                //Maximum percent chance of spawning a crash number between 0 - 100
_SpawnMin        = 50;                //Minimum percent chance of spawning a crash number between 0 - 100
_guaranteedLoot = 3;                //Guaranteed Loot Spawns
_randomizedLoot = 4;                //Random number of loot piles aswell as the guaranteed ones
_spawnFire      = true;                //Spawn Smoke/Fire at the helicrash
_fadeFire      = false;            //Fade the Smoke/Fire overtime
_preWaypoints    = 2;                //Amount of waypoints the heli flys to before crashing
_crashDamage    = 1;                //Amount of dammage the heli can take before crashing (between 0.1 and 1) Lower the number and the heli can take less damage before crashing 1 dammage is fully destroyed and 0.1 something like a DMR could one shot the heli
_heliModel        = "UH1Y_DZE";        //The type of heli used
_crashModel    = "UH1Wreck_DZ";    //The type of Crash model used after the heli crashes
_exploRange    = 250;                //How far away from the predefined crash point should the heli start crashing
_minLootRadius    = 4;                //Minimum distance for loot to spawn from the crash site in meters
_maxLootRadius    = 8;                //Maximum distance for loot to spawn from the crash site in meters
//############### \\Config End// ###############\\

//DO NOT edit below this unless you know what your doing
_maxLootRadius = _maxLootRadius - _minLootRadius;
_spawnRadius = HeliCrashArea;
_heliStart = [[3461.92,5021.77,0],[8582.35,14077.7,0]] call BIS_fnc_selectRandom;
_safetyPoint = [8450.08,20240,0];
_crashName= getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
_spawnMarker    = 'center';
_spawnChance = _SpawnMax - _SpawnMin;
_spawnChance = (random _spawnChance) + _SpawnMin;
_spawnRoll = round(random 100);
diag_log(format["CRASHSPAWNER: %1%2 chance to start a crashing %3 ", _spawnChance, '%', _crashName]);
if (_spawnRoll <= _spawnChance) then
{
    _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
    diag_log(format["CRASHSPAWNER: %1 started flying from %2 to %3 NOW!(TIME:%4)", _crashName,  str(_heliStart), str(_position), round(time)]);
    _startTime = time;
    _crashwreck = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
    _crashwreck setCombatMode "BLUE";
    _crashwreck engineOn true;
    _crashwreck flyInHeight 150;
    _crashwreck forceSpeed 150;
    _crashwreck setspeedmode "LIMITED";
    _landingzone = createVehicle ["HeliHEmpty", [_position select 0, _position select 1,0], [], 0, "CAN_COLLIDE"];
    _aigroup = creategroup civilian;
    _helipilot = _aigroup createUnit ["SurvivorW2_DZ",getPos _crashwreck,[],0,"FORM"];
    _helipilot setCombatMode "BLUE";
    _helipilot moveindriver _crashwreck;
    _helipilot assignAsDriver _crashwreck;
    sleep 0.5;
    if(_preWaypoints > 0) then
    {
        for "_x" from 1 to _preWaypoints do
        {
            _preWaypointPos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
            _wp = _aigroup addWaypoint [_preWaypointPos, 0];
            _wp setWaypointType "MOVE";
            _wp setWaypointBehaviour "CARELESS";
        };
    };

    _wp2 = _aigroup addWaypoint [position _landingzone, 0];
    _wp2 setWaypointType "MOVE";
    _wp2 setWaypointBehaviour "CARELESS";
    _wp2 setWaypointStatements ["true", "_crashwreck setdamage 1;"];
    _wp3 = _aigroup addWaypoint [_safetyPoint, 0];
    _wp3 setWaypointType "CYCLE";
    _wp3 setWaypointBehaviour "CARELESS";
    waituntil {(_crashwreck distance _position) <= 1000 || not alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};
    _crashwreck flyInHeight 100;
    _crashwreck forceSpeed 100;
    _crashwreck setspeedmode "NORMAL";
    waituntil {(_crashwreck distance _position) <= _exploRange || not alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};
    _crashwreck setHit ["mala vrtule", 1];
    _ran15 = random 15;
    _crashwreck setVelocity [_ran15,_ran15,-25];
    _crashwreck setdamage .9;
    waitUntil{sleep 1; getpos _crashwreck select 2 <= 30};
    _helipilot setdamage 1;
    _crashwreck setVelocity [_ran15,_ran15,-20];
    waitUntil{sleep 1; getpos _crashwreck select 2 <= 10};
    _crashwreck setdamage 1;
    waitUntil{sleep 1; getpos _crashwreck select 2 <= 5};
    diag_log(format["CRASHSPAWNER: %1 just exploded at %2!, ", _crashName, str(getPosATL _crashwreck)]);
    _pos = [getpos _crashwreck select 0, getpos _crashwreck select 1,0];
    _dir = getdir _crashwreck;
    heliCrash = _pos;
    publicVariable "heliCrash";
    deletevehicle _crashwreck;
    deletevehicle _helipilot;
    deletevehicle _landingzone;
    _crash = createVehicle [_crashModel, _pos, [], 0, "CAN_COLLIDE"];
    PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crash];
    if (_spawnFire) then
    {
        PVDZE_obj_Fire = [_crash,2,time,false,_fadeFire];
        publicVariable "PVDZE_obj_Fire";
        _crash setVariable ["fadeFire",_fadeFire,true];
    };
 
    //------------------------------STATIC LOOT TABLES---------------------------------------------
    //Edit the items array they are selected randomly
    _staticLoot = [
    ["ItemSodaMdew","magazine"],
    ["ItemSodaOrangeSherbet","magazine"],
    ["PartVRotor","magazine"],
    ["PartGlass", "magazine"], 
    ["ItemTankTrap","magazine"],
    ["PartFueltank","magazine"],
    ["NVGoggles","weapon"],
    ["SVD_CAMO", "weapon"],
    ["M24", "weapon"],
    ["M240_DZ", "weapon"],
    ["AmmoBoxSmall_762", "object"],
    ["AmmoBoxSmall_556", "object"],
    ["DZ_LargeGunBag_EP1", "object"],
    ["PipeBomb", "magazine"],
    ["100Rnd_762x54_PK", "magazine"] 
    ] call bis_fnc_selectrandom;
    //-------------------------------END STATIC LOOT--------------------------------------
 
 
    _num = round(random _randomizedLoot) + _guaranteedLoot;
    for "_x" from 1 to _num do
    {
        _maxLootRadius = (random _maxLootRadius) + _minLootRadius;
        _lootPos = [_pos, _maxLootRadius, random 360] call BIS_fnc_relPos;
        [_staticLoot select 0, _staticLoot select 1, _lootPos, 5] call spawn_loot;
        diag_log(format["CRASHSPAWNER: Loot spawn at '%1' '", _lootPos]);
        _nearby = _pos nearObjects ["ReammoBox", sizeOf(_crashModel)];
        {
            _x setVariable ["permaLoot",true];
        } forEach _nearBy;
    };
    //Adding 5 dead soldiers around the wreck ... WHY do they have to be dead?
    //replace createVehicle with Createunit to have a few survivors who will shoot at players.
        for "_x" from 1 to 5 do {
            _lootPos = [_pos, ((random 4)+3), random 360] call BIS_fnc_relPos;
            _deadBody = createVehicle[["Body1","Body2"] call BIS_fnc_selectRandom,_lootPos,[], 0, "CAN_COLLIDE"];
            _deadBody setDir (random 360);
        };
    _endTime = time - _startTime;
    diag_log(format["CRASHSPAWNER: Crash completed! Wreck at: %2 - Runtime: %1 Seconds || Distance from calculated POC: %3 meters", round(_endTime), str(getPos _crash), round(_position distance _crash)]);
};
 
Try editing your original file .. this just removes the reliance on loottables which seems to be a problem with the spawncrashes .. I think because the names of the loottables have changed from helicrash to helicrashwest and helicrasheast .. or something like that ...
Find this code
Code:
  for "_x" from ((round(random _randomizedLoot)) + _guaranteedLoot) to 1 step -1  do {
                //create loot
                _itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
                _CBLBase = dayz_CBLBase find _lootTable;
                _weights = dayz_CBLChances select _CBLBase;
                _cntWeights = count _weights;
                _index1 = floor(random _cntWeights);
                _index2 = _weights select _index1;
                _itemType = _itemTypes select _index2;
and replace or comment it out /* .... .... */ with this

Code:
    //------------------------------STATIC LOOT TABLES---------------------------------------------
    //Edit the items array they are selected randomly
    _itemtype = [
    ["ItemSodaMdew","magazine"],
    ["ItemSodaOrangeSherbet","magazine"],
    ["PartVRotor","magazine"],
    ["PartGlass", "magazine"],
    ["ItemTankTrap","magazine"],
    ["PartFueltank","magazine"],
    ["NVGoggles","weapon"],
    ["SVD_CAMO", "weapon"],
    ["M24", "weapon"],
    ["M240_DZ", "weapon"],
    ["AmmoBoxSmall_762", "object"],
    ["AmmoBoxSmall_556", "object"],
    ["DZ_LargeGunBag_EP1", "object"],
    ["PipeBomb", "magazine"],
    ["100Rnd_762x54_PK", "magazine"]
    ] call bis_fnc_selectrandom;
    //-------------------------------END STATIC LOOT--------------------------------------
 
Back
Top