Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //_chutetype, _boxtype, _helistart, _crashwreck
- private ["_chutetype","_boxtype","_helistart","_crashwreck","_randomizedLoot","_guaranteedLoot","_chute","_box","_num","_weights","_index","_itemType","_lootRadius","_lootPos","_pos","_bam","_i","_nearby","_smoke","_itemTypes","_cntWeights","_lootTable","_playerName","_null","_message2","_markername","_check"];
- _chutetype = _this select 0;
- _boxtype = _this select 1;
- _helistart = _this select 2;
- _crashwreck = _this select 3;
- _randomizedLoot = _this select 4;
- _guaranteedLoot = _this select 5;
- _lootRadius = 1;
- _lootTable = ["HeliCrash","MilitarySpecial","Military"] call BIS_fnc_selectRandom;
- _chute = createVehicle [_chutetype,_helistart,[],0,"CAN_COLLIDE"];
- _chute setVariable["Sarge",1];
- _chute setPos [(getpos _crashwreck select 0), (getPos _crashwreck select 1), (getPos _crashwreck select 2)-10];
- _box = createVehicle [_boxtype,_helistart,[],0,"CAN_COLLIDE"];
- _box setVariable["Sarge",1];
- _box setPos [(getpos _crashwreck select 0), (getPos _crashwreck select 1), (getPos _crashwreck select 2)-10];
- _box attachto [_chute, [0, 0, 0]];
- _i = 0;
- while {_i < 45} do {
- scopeName "loop1";
- if (((getPos _box) select 2) < 1) then {breakOut "loop1"};
- sleep 1;
- _i=_i+1;
- };
- switch (true) do {
- case not (alive _box): {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];};
- case alive _box: {detach _box;_box setpos [(getpos _box select 0), (getpos _box select 1), 0];_bam = _boxtype createVehicle [(getpos _box select 0),(getpos _box select 1),(getpos _box select 2)+0];deletevehicle _box;};
- };
- _bam setVariable["Sarge",1];
- deletevehicle _chute;
- sleep 2;
- _pos = [getpos _bam select 0, getpos _bam select 1,0];
- //Map Marker
- _null = createMarker ["MarkerDrop",_pos];
- "MarkerDrop" setMarkerText "Air Drop";
- "MarkerDrop" setMarkerType "mil_dot";
- "MarkerDrop" setMarkerColor "ColorRed";
- //Map Marker
- /*
- // add _check and _markername to private at top
- _check = true;
- while {_check} do {
- _random = round(random 1000);
- _markername = format["MarkerDrop%1",_random]; //creates random marker name
- if (getMarkerColor _markername == "")then {
- _null = createMarker [_markername,_pos];
- _markername setMarkerText "Air Drop";
- _markername setMarkerType "mil_dot";
- _markername setMarkerColor "ColorRed";
- _check = false;
- //Map Marker2
- };
- };
- */
- _smoke = createVehicle ["SmokeShellred",_pos,[],0,"CAN_COLLIDE"];
- _smoke setVariable["Sarge",1];
- //Wait until player is near, wait 90 seconds and delete marker/box.
- waitUntil{
- sleep 1;
- (({isPlayer _x && _x distance _pos <= 5} count playableUnits > 0));
- };
- //_message2 = format[" %1 is at the carepackage!",_playerName];
- _message2 = format[" A player is looting the carepackage!",_playerName];
- [nil,nil,rTitleText,_message2, "PLAIN",6] call RE;
- sleep 5;
- deleteMarker "MarkerDrop";
- _num = (round(random _randomizedLoot)) + _guaranteedLoot;
- _itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
- _index = dayz_CBLBase find _lootTable;
- _weights = dayz_CBLChances select _index;
- _cntWeights = count _weights;
- //Creating the Lootpiles outside of the _crashModel
- for "_x" from 1 to _num do {
- //Create loot
- _index = floor(random _cntWeights);
- _index = _weights select _index;
- _itemType = _itemTypes select _index;
- //Let the Loot spawn in a non-perfect circle around _crashModel
- _lootPos = [_pos, ((random 2) + (sizeOf(_boxtype) * _lootRadius)), random 360] call BIS_fnc_relPos;
- [_itemType select 0, _itemType select 1, _lootPos, 0] call spawn_loot;
- diag_log(format["CAREPACKAGE: Loot spawn at '%1' with loot %2", _lootPos, _itemType]);
- // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
- _nearby = _pos nearObjects ["ReammoBox", (sizeOf(_boxtype)+3)];
- {
- _x setVariable ["permaLoot",true];
- } forEach _nearBy;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement