Jump to content

[Fixed] Animated Crash Spawner 1051


f3cuk

Recommended Posts

Yeah no problem :)

 

 

 

I'll do you some once i've done Origins for PryMary

 

*Edit*

 

I might as well do all maps, people can always change them if they don't like them and at least then F3cuk can say his scripts supports all maps.

 

 

Yeah that would be awesome. I'll add them to the OP when done :)

 

I love you guys & this forum... Everyone is so helpful :) *2 x thumbs up*

 

Pry

Link to comment
Share on other sites

Nice script. How can I adjust the loot that spawns on the actual heli crashes? Also how can I reduce the radius of the map marker? Thanks.

 

Hi Link. You can change the loot table to whatever kind of loot you want to spawn. If you look at the top portion of the script you'll notice different aircraft actually have different types of loot.

To change the size of the marker change _markerRadius (Note: Make sure its always a higher number then _exploRange.). Setting a _exploRange lower then 250 is not advised cause sometime the helicopter wont get close enough to the area to actually trigger the explosion. When that happens it will keep flying circles around the waypoint and only crash when taken down or no fuel.

Link to comment
Share on other sites

Ok cool. Another question is, I notice that heli's that get looted by players have their markers left on the map and they dont dissappear until restart. How can I remove markers that get added after a certain period of time, e.g. delete marker 20 minutes after it marks on map or delete after heli has been tempered with by a player.

Link to comment
Share on other sites

Ok cool. Another question is, I notice that heli's that get looted by players have their markers left on the map and they dont dissappear until restart. How can I remove markers that get added after a certain period of time, e.g. delete marker 20 minutes after it marks on map or delete after heli has been tempered with by a player.

 

Hmm. Let me look into that, it should disappear after a certain while.

Link to comment
Share on other sites

Hmm. Let me look into that, it should disappear after a certain while.

 

It actually does not. Try this, haven't tested but this should check if a player is near the crash site and remove the marker if if's the case.

 

Edit: Removed shit code.

Link to comment
Share on other sites

Nice script f3cuk! Thanks for sharing.

 

I get this in rpt after heli explodes.

20:07:59 "_iClass isNil, exiting loot spawn!"
20:07:59 Error in expression <IS_fnc_relPos;
_index1 		= floor(random _cntWeights);
_index2 		= _weights selec>
20:07:59   Error position: <_cntWeights);
_index2 		= _weights selec>
20:07:59   Error Undefined variable in expression: _cntweights
20:07:59 File z\addons\dayz_server\modules\crash_spawner.sqf, line 238
20:07:59 Error in expression <tTable));
_weights 			= dayz_CBLChances select _CBLBase;
_cntWeights 		= count _>
20:07:59   Error position: <select _CBLBase;
_cntWeights 		= count _>
20:07:59   Error Zero divisor
20:07:59 File z\addons\dayz_server\modules\crash_spawner.sqf, line 231

Any ideas, am running overpoch with loot table adjusted accordingly.

 

Thanks in advance

Link to comment
Share on other sites

Hi 2sugars,

Thanks, but i wanna make it clear that this is not my script. There's a few people that have worked on this, but mainly credits should go to Grafzahl and Finest. I merely did some bugfixes and enhancements.

 

--

Hmm i dont know if all of the used loot tables work for Overpoch. Make sure you got these

  • MilitarySpecial
  • Hospital
  • HeliCrash

If not, change them to tables you do have. If you are unsure please post your loot table file.

Link to comment
Share on other sites

Thanks for quick reply - i'll look into it & post changes

 

Cheers!

 

EDIT

 

Ok just realised I had done a fresh install & not updated loot table to Overwatch weapons etc. I still had

DZE_MissionLootTable = true;

in my init. Removed it & loot spawning now.

 

Thanks for the help!

Link to comment
Share on other sites

I know. Have worked on a new version tonight. Not quite finished, will release a tested version tomorrow.
 

The new version will include

  • Marker cleanup after the first person has secured the crashsite;
  • Corrected marker placement (it always spawned on pre-defined crash site, even if taken down or crashed somewhere else);
  • Added a "Survivors have secured the crash site" message;
  • Added vehicle start damage to planes (will cause them to smoke);
  • Changed the starting positions for Chernarus (with help of Richie);
  • Lowered the speed of planes;
  • Lowered the altitude of planes;
  • Set the correct facing direction on the crash model;
  • Fixed issue where you would sometimes see the pilot bailing and getting deleted as soon as landed.

 

Have not tested this yet. But if anyone wants to try:

/*
Script Name: animated_crash_spawner.sqf
Original Author: Grafzahl / Finest
Modified by BushWookie & Forgotten for Epoch
Modified by f3cuk for Epoch 1051
Script Version: 1.3.1
*/
 
private["_finder","_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","_itemType","_itemChance","_weights","_index","_iArray","_crashModel","_lootTable","_guaranteedLoot","_randomizedLoot","_frequency","_variance","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_permanentFire","_crashName","_marker", "_markerRadius","_hint","_itemTypes"];

_spawnChance            = 100;                // Percent chance of spawning a crash number between 0 - 100
_guaranteedLoot            = 8;                // Guaranteed Loot Spawns
_randomizedLoot            = 8;                // Random number of loot piles as well as the guaranteed ones
_spawnFire                = true;                // Spawn Smoke/Fire at the helicrash
_fadeFire                = false;            // Fade the Smoke/Fire overtime
_preWaypoints            = 2;                // Amount of way points the heli flies to before crashing
_crashDamage            = 1;                // Amount of damage the heli can take before crashing (between 0.1 and 1) Lower the number and the heli can take less damage before crashing 1 damage is fully destroyed and 0.1 something like a DMR could one shot the heli
_exploRange                = 200;                // 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            = 10;                // Maximum distance for loot to spawn from the crash site in meters
_lootTable                = "HeliCrash";        // Name of the loot table the heli gets loot from (DO NOT edit unless you know what your doing)
_markerRadius            = 400;                // Radius for the marker
_spawnMarker             = "center";
_heliModel                = ["UH1Y_DZE","UH1H_DZE","MV22","Mi17_DZ","UH60M_EP1","UH1H_TK_EP1","UralWreck","UH60M_EP1","UH1H_TK_EP1","UH60M_MEV_EP1","A10","Ka52Black","Mi24_D","AH1Z","AV8B","Su25_TK_EP1"] call BIS_fnc_selectRandom;
_crashModel                = "UH1Wreck_DZ";
_plane                    = false;
_porh                    = "helicopter";

_spawnRadius            = HeliCrashArea;
_heliStart                = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;

_safetyPoint            = [0,16000,0];
_crashName                = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
_spawnRoll                = round(random 100);

_finder                    = "";

if(_heliModel == "Su25_TK_EP1") then {
    _lootTable        = "MilitarySpecial";
    _crashModel        = "SU25Wreck";
    _plane            = true;
    _guaranteedLoot    = 4;
};

if(_heliModel == "AV8B") then {
    _lootTable        = "MilitarySpecial";
    _crashModel        = "AV8BWreck";
    _plane            = true;
    _guaranteedLoot    = 5;
};

if(_heliModel == "AH1Z") then {
    _lootTable        = "MilitarySpecial";
    _crashModel        = "AH1ZWreck";
    _guaranteedLoot    = 4;
};

if(_heliModel == "Mi24_D") then {
    _lootTable        = "MilitarySpecial";
    _crashModel        = "Mi24Wreck";
    _guaranteedLoot    = 5;
};

if(_heliModel == "Ka52Black") then {
     _lootTable        = "MilitarySpecial";
    _crashModel        = "Ka52Wreck";
    _guaranteedLoot    = 3;
};

if(_heliModel == "Mi17_DZ") then {
    _crashModel        = "Mi8Wreck";
};

if(_heliModel == "UH60M_EP1") then {
    _crashModel        = "UH60Wreck_DZ";
};

if(_heliModel == "A10") then {
    _lootTable        = "MilitarySpecial";
    _crashModel        = "A10Wreck";
    _plane            = true;
    _guaranteedLoot    = 2;
};

if(_heliModel == "MV22") then {
     _lootTable        = "Hospital";
    _crashModel        = "MV22Wreck";
    _plane            = true;
    _guaranteedLoot    = 24;
};

if(_heliModel == "UH60M_MEV_EP1") then {
    _lootTable        = "Hospital";
    _crashModel        = "UH60Wreck_DZ";
    _guaranteedLoot    = 16;
};

diag_log(format["CRASHSPAWNER: %1%2 chance to start a crashing %3 with loot table '%4'", _spawnChance, '%', _crashName, _lootTable]);

if (_spawnRoll <= _spawnChance) then
{

    if(_plane) then {
        _porh = "plane";
    };
    
    [nil,nil,rTitleText,format["A %1 is in distress! Watch for it and go to the crash site to secure the loot!",_porh], "PLAIN",10] call RE;

    _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||LT:%5)", _crashName,  str(_heliStart), str(_position), round(time), _lootTable]);
    
    _startTime             = time;
    _crashwreck         = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
    _crashwreck         setCombatMode "BLUE";
    _crashwreck         engineOn true;
    _crashwreck         flyInHeight 150;

    if (_plane) then
    {
        _crashDamage = .73;
        _crashwreck    setdamage .7;
        _crashwreck forceSpeed 250;
        _crashwreck setspeedmode "LIMITED";
    }
    else
    {
        _crashwreck forceSpeed 150;
        _crashwreck setspeedmode "NORMAL";
    };
    
    _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 || !alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};
    
    if (_plane) then
    {
        _crashwreck flyInHeight 100;
        _crashwreck forceSpeed 150;
        _crashwreck setspeedmode "NORMAL";
        _exploRange = 360;
    }
    else
    {
        _crashwreck flyInHeight 100;
        _crashwreck forceSpeed 100;
        _crashwreck setspeedmode "NORMAL";
    };
    
    waituntil {(_crashwreck distance _position) <= _exploRange || !alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};
    
    deletevehicle         _helipilot;
    
    if (_plane) then
    {
        _crashwreck     setdamage 1;
        _vel             = velocity _crashwreck;
        _dir             = direction _crashwreck;
        _speed             = 100;
        _crashwreck     setVelocity [(_vel select 0)-(sin _dir*_speed),(_vel select 1)-(cos _dir*_speed),(_vel select 2) - 30];
    }
    else
    {
        _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, getpos _crashwreck]);
    
    _pos                 = [getpos _crashwreck select 0, getpos _crashwreck select 1,0];
    _dir                 = getdir _crashwreck;
    heliCrash             = _pos;
    publicVariable        "heliCrash";
    deletevehicle         _crashwreck;
    deletevehicle         _landingzone;
    
    _crash = createVehicle [_crashModel, _pos, [], 0, "CAN_COLLIDE"];
    _crash = setdir _dir;
    _crashsite = getPos _crash;
    
    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];
    };
    
    _num                 = round(random _randomizedLoot) + _guaranteedLoot;

    if (DZE_MissionLootTable) then {
        _itemTypes = [] + getArray(missionConfigFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
    } else {
        _itemTypes = [] + getArray(configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
    };
    _CBLBase             = dayz_CBLBase find(toLower(_lootTable));
    _weights             = dayz_CBLChances select _CBLBase;
    _cntWeights         = count _weights;
    
    for "_x" from 1 to _num do
    {
        _maxLootRadius     = (random _maxLootRadius) + _minLootRadius;
        _lootPos         = [_pos, _maxLootRadius, random 360] call BIS_fnc_relPos;
        _index1         = floor(random _cntWeights);
        _index2         = _weights select _index1;
        _itemType         = _itemTypes select _index2;
        
        [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;
        
        diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2'", _lootPos, _lootTable]);
        
        _nearby = _pos nearObjects ["ReammoBox", sizeOf(_crashModel)];
        {
            _x setVariable ["permaLoot",true];
        } forEach _nearBy;
    };
    
    _endTime = time - _startTime;

    [nil,nil,rTitleText,format["The %1 has crashed, go and secure the loot!",_porh], "PLAIN",10] call RE;
    
    diag_log(format["CRASHSPAWNER: Crash completed! Wreck at: %2 - Runtime: %1 Seconds || Distance from calculated POC: %3 meters", round(_endTime), str(_crashsite), round(_position distance _crash)]);
    
    _marker_position = [_crashsite,0,_markerRadius,0,1,2000,0] call BIS_fnc_findSafePos;
    _marker = createMarker [ format ["loot_event_marker_%1", _startTime], _marker_position];
    _marker setMarkerShape "ELLIPSE";
    _marker setMarkerColor "ColorYellow";
    _marker setMarkerAlpha 0.5;
    _marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
    
    waitUntil
    {
        sleep 5;
        _playerPresent = false;
        {
            if((isPlayer _x) && (_x distance _crashsite <= 25)) then {
                _playerPresent = true;
                _finder = name _x;
            };
            
        } foreach playableUnits;
        
        (_playerPresent)
    };

    [nil,nil,rTitleText,format["Survivors have secured the crash site!"], "PLAIN",10] call RE;
        
    deleteMarker    _marker;
    
    diag_log(format["CRASHSPAWNER: Crash found by %1, removing the marker" , _finder]);

};
Link to comment
Share on other sites

Nope all that does is set the crash model to the pre-defined location instead of the location where the helicopter actually went down..

--

Release 1.3.1

 

Added

  • Marker cleanup after the first person has secured the crashsite;
  • Added a "Survivors have secured the crash site" message;
  • Added vehicle start damage to planes (will cause them to smoke);
  • Ability to hide or show marker;
  • Ability to hide or show crahsname.
Fixed
  • Corrected marker placement (it always spawned on pre-defined crash site, even if taken down or crashed somewhere else);
  • Fixed issue where you would sometimes see the pilot bailing and getting deleted as soon as landed;
  • Set the correct facing direction on the crash model;
  • Crashing into sea stops loot from spawning at the bottom of the ocean, does not display a marker and show a message that the helicopter or plane has crashed into the ocean.
Misc
  • Changed the starting positions for Chernarus (with help of Richie);
  • Lowered the speed of planes;
  • Lowered the altitude of planes;
  • Enhanced damage models;
  • Enhanced loot tables per vehicle.

--

@Richie: How far are you with the coordinates for the other maps?

Link to comment
Share on other sites

Updated coordinates for Chernarus, further away from the coast as requested :) :

_heliStart                = [[1857.282, 1308.5925],[4352.8975, 1510.6484],[6753.3057, 1499.1018],[10255.822, 1002.6187],[12153.48, 2613.8552],[14293.017, 6304.6133],[13948.054, 8105.2158],[13689.33, 9308.6455],[13855.004, 10010.268],[14753.25, 12003.689]] call BIS_fnc_selectRandom;

Origins version of Taviana :

_heliStart                = [[7637.1768, 4182.0859],[2154.2883, 17062.283],[8839.4092, 10396.975],[8821.5313, 19403.178],[15097.905, 15839.728],[17291.035, 7203.6821],[18815.258, 2757.0435],[13402.826, 12238.75],[12001.367, 15047.333],[5200.9824, 8429.251],[9564.2949, 5238.4321]] call BIS_fnc_selectRandom;

Normal version of Taviana 2.0 (Can be used with or instead of Origins Taviana)

 

_heliStart                = [[11558.516, -56.829834],[7787.207, 3972.2046],[2279.2651, 6822.7891],[5548.9434, 8449.1914],[9465.4697, 7223.2925],[17441.467, 5454.5791],[13474.444, 11853.039],[8848.6611, 18823.994],[16224.908, 13310.733],[15171.845, 7629.0879]] call BIS_fnc_selectRandom;

 

Next up is Origins Taviana, normal Taviana,Napf, Sauerland and Panthera - That should be them all ?

Link to comment
Share on other sites

I have some problems with the markers. Sometimes markers for heli crashes show with the black mil dot and sometimes they don't, The helicrashes with the black mil dot have their yellow eclipse marker removed when players go close to it, however the black mil dot remains on the map and doesn't get deleted along with the yellow eclipse marker, I think this may need fixing.

 

Also I have noticed at night time that the heli crashes are no longer on fire, why is this? I have the config set as the following;

_spawnFire                = true;                // Spawn Smoke/Fire at the helicrash
_fadeFire                = false;                // Fade the Smoke/Fire overtime

Thanks.

Link to comment
Share on other sites

Release 1.3.2

 

Fixed

  • Issue where marker would only be set once;
  • Issue where sometimes plane would instantly crash.

Misc

  • Intensified fire/smoke.

---

 

I have some problems with the markers. Sometimes markers for heli crashes show with the black mil dot and sometimes they don't, The helicrashes with the black mil dot have their yellow eclipse marker removed when players go close to it, however the black mil dot remains on the map and doesn't get deleted along with the yellow eclipse marker, I think this may need fixing.

 

Also I have noticed at night time that the heli crashes are no longer on fire, why is this? I have the config set as the following;

_spawnFire                = true;                // Spawn Smoke/Fire at the helicrash
_fadeFire                = false;                // Fade the Smoke/Fire overtime

Thanks.

 

The issues with the markers have been fixed in 1.3.2. The problem you are experiencing with crashes no longer being on fire probably has to do with rain that has put out the fire, i do not know how to counter this (nor do i find it realistic so i will not perue a 'fix' for this), what i did do is make the fire / smoke more intense.

 

I have the yellow marker but no black mil_dot / text.

 

This has been fixed in the latest version.

 

--

@Richie: I think so, any other request shall be handled separately. Thanks for your help :)

Link to comment
Share on other sites

i had a problem one time the dynamic crash happen and i got a box that popped out that said weapons config / bin some thing like that this was b4 your updates to the files today i will test the new updates

 

and can we please get Napf cords =] thanks again

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
×
×
  • Create New...