Arma2 Battle Royale Carepackage Markers! HELP

DangerRuss

OpenDayZ Rockstar!
So I've asked this question on here in the past but I still can't get this to work quite right.

I will include the 2 scripts in question below. 1 is the helicopter script and the other is the carepackage script.


Here is an explanation of my problem;

The server spawns a helicopter which flies across the map, drops a carepackage somewhere at random, and flies away and eventually despawns.

The carepackage lands somewhere and players can go and loot it.

I decided to add markers on the carepackages so that players can see where they've landed on the map. When a player approaches the carepackage, a message is displayed to the server letting the players know someone is looting it, and then that carepackage marker is removed from the map.

My problem is, I can't seem to get a marker to display on each carepackage because I dont know how to assign a different marker name. After the first carepackage lands, if no player captures it, than no other carepackage after that shows a marker on the map until the first one is captured.

https://pastebin.com/svtx7vN2

https://pastebin.com/mJABEzpQ
 
Here is how I did it with one of my scripts server side

Code:
admin_event_paradrop =
    {
        [] spawn {
            _pos2 = [getMarkerPos "center",0,5500,60,0,20,0] call BIS_fnc_findSafePos;
            _pos1 =  [(_pos2 select 0), (_pos2 select 1), 100];
            _building = "AmmoBoxBig" createVehicle _pos1;
            clearWeaponCargoGlobal _building;
            clearMagazineCargoGlobal _building;
            _building1 = createVehicle ["ParachuteMediumEast", [(_pos1) select 0,(_pos1) select 1, 100], [], 0, "FLY"];
            _building2 = createVehicle ["SmokeShellRed", [(_pos1) select 0,(_pos1) select 1, 100], [], 0, "FLY"];
            _building2 attachto [_building, [0,0,0]];
            _number = round(random 100);
            _randommkr = ("carepackage_event"+(str _number));
            _mrk = createmarker [_randommkr,_pos2];
            _mrk setmarkertype "vehicle";
            _mrk setMarkerSize [10, 10];
            _mrk setmarkercolor ("ColorRed");
            [nil,nil,rTitleText,"A Carepackage has been dropped! Check your map for the location!", "PLAIN",10] call RE;
            [_building] spawn Admin_Fillup_Objects;
            _building attachTo [_building1, [0,0,1.9]];
            _complete = true;
            _complete2 = true;
            while {_complete} do {
                _location = getpos _building;
                if (_location select 2 < 10 && _complete2) then {
                    ("carepackage_event"+(str _number)) setMarkerPos (getpos _building);
                    _complete2 = false;
                };
                if ({isPlayer _x && _x distance _location < 80} count playableunits > 0) then {
                _complete = false;
                deleteMarker ("carepackage_event"+(str _number));
                [nil,nil,rTitleText,"Survivors have closed in on the carepackage!", "PLAIN",10] call RE;
                };
                sleep 2;
            };
          
        };
    };
 
So pretty much I generate a number and turn it into a string and add it on to a marker name then have a loop to track when its cleared and remove the marker.
 
This is how you would probably want to do the carepackage part of the script to get markers that are different each time, haven't tested it tho and haven't done any real coding in a while so hopefully it works lol. Assumed it is a server side script as well.

Code:
//_chutetype, _boxtype, _helistart, _crashwreck
private ["_chutetype","_boxtype","_helistart","_crashwreck","_randommkr","_randomizedLoot","_guaranteedLoot","_chute","_box","_num","_number","_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";
*/

// Different Marker Each Time
if (isnil "Marker_Number") then {
    Marker_Number = 1; // Set default value if doesn't exist and increase by 1 each marker
};
_number = Marker_Number;
Marker_Number = Marker_Number + 1;
_randommkr = ("MarkerDrop"+(str _number)); // "MarkerDrop1", "MarkerDrop2"...
_null = createmarker [_randommkr,_pos];
_null  setMarkerText "Air Drop";
_null  setMarkerType "mil_dot";
_null  setMarkerColor "ColorRed";
  
  
_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";
deleteMarker _randommkr; // random marker removal

_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;
};
 
hey I'll play around with it man thanks!

The code isn't my code it's arma 2 battle royale written by player unknown ages ago. However the script lacks any kind of marker for the carepackages so unless you see it fall you'll never know theres one around. I wanted to change this!
 
I brought W.I.C.K.E.D. back yes but this question was actually for Player Unknown's Arma 2 Battle Royale that we sometimes run. I'm gonna try and implement it on my server.
 
Is your goal to have a heli fly to a point and drop the package then fly off? and if its destroyed on the way to drop the package at that location?
 
Yes very similar to what DZMS does but I actually like the battle royale version much better. It is independent of any mission, it happens at set intervals, and the helicopter/plane is cleaned up automatically. Also the carepackage doesn't spawn loot until a player gets close to it.

I originally wanted to test this on the battle royale mod but Im actually not running one at the current moment so I'm looking into getting the battle royale version working on overwatch. Tomorrow if I remember I will post the relevant files from battle royale. It is handled in 3 server files. One spawns the plane/heli and drops the carepackage, the other handles the actual carepackage drop, and the third handles the loot.
 
Yes very similar to what DZMS does but I actually like the battle royale version much better. It is independent of any mission, it happens at set intervals, and the helicopter/plane is cleaned up automatically. Also the carepackage doesn't spawn loot until a player gets close to it.

I originally wanted to test this on the battle royale mod but Im actually not running one at the current moment so I'm looking into getting the battle royale version working on overwatch. Tomorrow if I remember I will post the relevant files from battle royale. It is handled in 3 server files. One spawns the plane/heli and drops the carepackage, the other handles the actual carepackage drop, and the third handles the loot.

It sounded like a cool idea so I took a wack at making for something like it, haven't tested it at all tho yet. Setup a mysql server on my PC and setup a DayZ 1.8.9 to test it just haven't gotten around to it yet.

Its 4 files so far, a config with several configurables; loot tables, heli type (plane should work as well), box type, random weapon amount/mag amount or static amount, enable message broadcast, enable markers ect.

Then I have a file for the heli which handles the spawning and waypoints (spawn at point a -> go to point b -> fly to top left of map and despawn) as well as if the heli is destroyed on the way it will drop the package, a file for the carepackage, and a file for handling the loot. Currently the spawning method is just a sleep timer that is 300-900s long and then a 80% chance of spawning after the timer.
 
Code:
//Animated Helicrashs for DayZ 1.7.6.1
//Version 0.2
//Release Date: 05. April 2013
//Author: Grafzahl
//Thread-URL: http://opendayz.net/threads/animated-helicrashs-0-1-release.9084/

private["_useStatic","_crashDamage","_lootRadius","_preWaypoints","_preWaypointPos","_endTime","_startTime","_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", "_aaa", "_blacklist"];

//_crashModel    = _this select 0;
//_lootTable    = _this select 1;
_guaranteedLoot = _this select 0;
_randomizedLoot = _this select 1;
_frequency    = _this select 2;
_variance    = _this select 3;
_spawnChance    = _this select 4;
_spawnMarker    = _this select 5;
_spawnRadius    = _this select 6;
_spawnFire    = _this select 7;
_fadeFire    = _this select 8;
_randomizedWP    = _this select 9;
_guaranteedWP    = _this select 10;

_chutetype = "ParachuteMediumEast";
_boxtype = "Misc_cargo_cont_net1";
_useStatic = false;





if(count _this > 11) then {
    _crashDamage = _this select 11;
} else {
    _crashDamage = 1;
};


diag_log(format["PLANE: Starting spawn logic for Carepackage drops [CD:%1]", _crashDamage]);

while {true} do {

    _preWaypoints = round(random _randomizedWP) + _guaranteedWP;
   
    private["_timeAdjust","_timeToSpawn","_spawnRoll","_crash","_hasAdjustment","_newHeight","_adjustedPos"];
    // Allows the variance to act as +/- from the spawn frequency timer
    _timeAdjust = round(random(_variance * 2) - _variance);
    _timeToSpawn = time + _frequency + _timeAdjust;

    //Random Heli-Type
    _heliModel = "MV22_DZ";

    //Random-Startpositions, Adjust this for other Maps then Chernarus
    _heliStart = [[100.7007,100.05298,300],[5000.715,5000.18848,300]] call BIS_fnc_selectRandom;


    _crashName    = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");

    diag_log(format["PLANE: %1%2 chance to start a %3 Carepackagedrop at %4 with %5 drop points", round(_spawnChance * 100), '%', _crashName, _timeToSpawn, _preWaypoints]);

    // Apprehensive about using one giant long sleep here given server time variances over the life of the server daemon
    while {time < _timeToSpawn} do {
        sleep 5;
    };

    _spawnRoll = random 1;

    // Percentage roll
    if (_spawnRoll <= _spawnChance) then {

        //Spawn the AI-Heli flying in the air
        _startTime = time;
        _crashwreck = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];

        //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
        _crashwreck setVariable["Sarge",1];

        _crashwreck engineOn true;
        _crashwreck flyInHeight 120;
        _crashwreck forceSpeed 160;
        _crashwreck setspeedmode "NORMAL";

        /*
        //Create an Invisibile Landingpad at the Crashside-Coordinates
        _landingzone = createVehicle ["HeliHEmpty", [_position select 0, _position select 1], [], 0, "CAN_COLLIDE"];
        _landingzone setVariable["Sarge",1];
        */
       
        //Only a Woman could crash a Heli this way...
        _aigroup = creategroup east;
        _helipilot = _aigroup createUnit ["SurvivorW2_DZ",getPos _crashwreck,[],0,"FORM"];
        _helipilot moveindriver _crashwreck;
        _helipilot assignAsDriver _crashwreck;

        sleep 0.5;

       
        _unsorted = [];
       
        for "_x" from 1 to _preWaypoints do {
       
            _preWaypointPos = [getMarkerPos "center",random 2500,random 360,false] call SHK_pos;
            _unsorted = _unsorted + [_preWaypointPos];
           
            };


           
           
        _sorted = [];
        _pos = [800,2400];

    {
     _closest = _unsorted select 0;
     {if ((_x distance _pos) <= (_closest distance _pos)) then {_closest = _x}} forEach _unsorted;
     
     _sorted = _sorted + [_closest];

    _helper = [];
    _i=0;
    while {!([_helper, _closest] call BIS_fnc_areEqual)} do { 
        _helper = _unsorted select _i;
        _i=_i+1;
        };

    _unsorted set [(_i-1),"delete_me"];
    _unsorted = _unsorted - ["delete_me"];
    } forEach _unsorted;
           
    diag_log(format["PLANE: %1 started flying from %2 to first waypoint NOW!(TIME:%3)", _crashName,  str(_heliStart), round(time)]);
       

       
        for "_x" from 0 to ((count _sorted)-1) do {
       
           
            //_preWaypointPos = [_spawnMarker,0,8000,10,0,1000,0,_blacklist] call BIS_fnc_findSafePos;
            diag_log(format["PLANE: Adding DROPWaypoint #%1 on %2", (_x+1),str(_sorted select _x)]);
            _wp = _aigroup addWaypoint [(_sorted select _x), 0];
            _wp setWaypointType "MOVE";
            _wp setWaypointBehaviour "CARELESS";
           
           
            waituntil {(_crashwreck distance (_sorted select _x)) <= 250 || not alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};   
           
            diag_log(format["PLANE IS AT DROPWAYPOINT #%1 on %2", (_x+1),str(getpos _crashwreck)]);
            sleep 2;
            nul = [_chutetype, _boxtype, _helistart, _crashwreck, _randomizedLoot, _guaranteedLoot] spawn server_carepackagedrop;
           
            if (not alive _crashwreck || (damage _crashwreck) >= _crashDamage || (getPosATL _crashwreck select 2) < 5 ) exitWith {diag_log(format["DROPPED 1 LAST PACKAGE WHILE GETTING SHOT DOWN #%1 on %2", _x,str(getpos _crashwreck)]); };
           
        };
       
       
        _wp2 = _aigroup addWaypoint [_heliStart, 0];
        _wp2 setWaypointType "MOVE";
        _wp2 setWaypointBehaviour "CARELESS";
        diag_log(format["PLANE IS AT END WAYPOINT on %1",str(_heliStart)]);
        waituntil {(_crashwreck distance _heliStart) <= 1000 || not alive _crashwreck || (getPosATL _crashwreck select 2) < 5 || (damage _crashwreck) >= _crashDamage};
       
        sleep 5;   
       
        //Clean Up the Crashsite
        deletevehicle _crashwreck;
        deletevehicle _helipilot;
        diag_log(format["PLANE DELETED"]);
   
       
       
        _endTime = time - _startTime;
        diag_log(format["PLANE: %2 Carepackagedrops completed! Runtime: %1 Seconds", round(_endTime), _preWaypoints]);
       
   
    };
       

};
 
Code:
private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];

waitUntil{!isNil "BIS_fnc_selectRandom"};
if (isDedicated) then {
    _position = [getMarkerPos "center",0,7000,10,0,2000,0] call BIS_fnc_findSafePos;

    _randomvehicle = ["Misc_cargo_cont_net1","Misc_cargo_cont_net2","Misc_cargo_cont_net3"] call BIS_fnc_selectRandom;
    //_vehicleloottype = ["Residential","Industrial","Military","Farm","Supermarket","Hospital"] call BIS_fnc_selectRandom;
    _vehicleloottype = ["Residential","Military"] call BIS_fnc_selectRandom;

    _veh = createVehicle [_randomvehicle,_position, [], 0, "CAN_COLLIDE"];
    dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
    _veh setVariable ["ObjectID",1,true];

    if (_randomvehicle == "Misc_cargo_cont_net1") then { _num = round(random 12) + 5; };
    if (_randomvehicle == "Misc_cargo_cont_net2") then { _num = round(random 12) + 5; };
    if (_randomvehicle == "Misc_cargo_cont_net3") then { _num = round(random 12) + 5; };

    switch (_vehicleloottype) do {
        case "Military": {
            _itemType = [["KPFS_M1_Garand_M84", "weapon"], ["sg552lb_commando_acog", "weapon"], ["sg552_commando_sd", "weapon"], ["M9SD", "weapon"], ["LEN_L119A1_Acog_PF_SD_W", "weapon"], ["SCAR_H_STD_EGLM_Spect", "weapon"], ["M4A1_Aim", "weapon"], ["AKS_74_kobra", "weapon"], ["AKS_74_U", "weapon"], ["AK_47_M", "weapon"], ["M24", "weapon"], ["AA12_PMC", "weapon"], ["m107_TWS_EP1_DZ", "weapon"], ["BAF_AS50_TWS", "weapon"], ["M14_EP1", "weapon"], ["UZI_EP1", "weapon"], ["BAF_LRR_scoped_W", "weapon"], ["hecate2", "weapon"], ["KPFS_M1_Carbine", "weapon"], ["KPFS_M1_Garand", "weapon"], ["M4A3_CCO_EP1", "weapon"], ["Binocular", "weapon"], ["Binocular_Vector", "military"], ["ItemKnife", "military"], ["ItemGPS", "weapon"], ["ItemMap", "military"], ["DZ_LargeGunBag_EP1", "object"], ["DZ_GunBag_EP1", "object"], ["DZ_Backpack_EP1", "object"], ["", "medical"], ["", "MilitarySpecial"], ["", "military"], ["ItemEtool", "weapon"], ["Skin_Sniper1_DZ", "magazine"]];
            _itemChance = [0.05, 0.05, 0.01, 0.02, 0.2, 0.15, 0.01, 0.08, 0.05, 0.05, 0.01, 0.1, 0.01, 0.02, 0.01, 0.05, 0.08, 0.1, 0.04, 0.02, 0.01, 0.06, 0.1, 0.1, 0.01, 0.05, 0.06, 0.04, 0.02, 0.1, 1.0, 2.5, 0.05, 0.02];
        };
        case "Residential": {
            _itemType = [["ItemSodaMdew", "magazine"], ["ItemWatch", "generic"], ["ItemCompass", "generic"], ["ItemMap", "weapon"], ["KPFS_BAR", "weapon"], ["KPFS_M1_Carbine", "weapon"], ["ItemFlashlight", "generic"], ["ItemKnife", "generic"], ["ItemMatchbox", "generic"], ["", "generic"], ["LeeEnfield", "weapon"], ["KPFS_M1_Garand", "weapon"], ["CZ_VestPouch_EP1", "object"], ["DZ_CivilBackpack_EP1", "object"], ["DZ_ALICE_Pack_EP1", "object"], ["KPFS_M1_Thompson", "weapon"], ["DZ_Backpack_EP1", "object"], ["", "military"], ["", "MilitarySpecial"], ["mg51_eotech", "weapon"], ["Binocular", "weapon"], ["PartWoodPile", "magazine"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Sniper1_DZ", "magazine"], ["DZ_GunBag_EP1", "object"], ["sg551_COMMANDO_LG97_AIM_CAMO", "weapon"]];
            _itemChance = [0.01, 0.15, 0.05, 0.03, 0.13, 0.05, 0.03, 0.08, 0.06, 2, 0.06, 0.04, 0.01, 0.03, 0.03, 0.01, 0.01, 0.03, 0.5, 0.01, 0.06, 0.06, 0.01, 0.01, 0.08, 0.03];
        };
        case "Industrial": {
            _itemType = [["", "generic"], ["", "trash"], ["", "military"], ["WeaponHolder_PartGeneric", "object"], ["WeaponHolder_PartWheel", "object"], ["WeaponHolder_PartFueltank", "object"], ["WeaponHolder_PartEngine", "object"], ["WeaponHolder_PartGlass", "object"], ["WeaponHolder_PartVRotor", "object"], ["WeaponHolder_ItemJerrycan", "object"], ["WeaponHolder_ItemHatchet", "object"], ["ItemKnife", "military"], ["ItemToolbox", "weapon"], ["ItemWire", "magazine"], ["ItemTankTrap", "magazine"]];
            _itemChance = [0.18, 0.29, 0.04, 0.04, 0.05, 0.02, 0.01, 0.04, 0.01, 0.04, 0.11, 0.07, 0.02, 0.06, 0.04];   
        };
        case "HeliCrash": {
            _itemType = [[FN_FAL, "weapon"], ["bizon_silenced", "weapon"], [M14_EP1, "weapon"], [FN_FAL_ANPVS4, "weapon"], [M107_DZ, "weapon"], ["BAF_AS50_scoped", "weapon"], ["Mk_48_DZ", "weapon"], [M249_DZ, "weapon"], [BAF_L85A2_RIS_CWS, "weapon"], [DMR, "weapon"], ["", "military"], ["", "medical"], ["MedBox0", "object"], ["NVGoggles", "weapon"], ["AmmoBoxSmall_556", "object"], ["AmmoBoxSmall_762", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Sniper1_DZ", "magazine"]];
            _itemChance = [0.02, 0.05, 0.05, 0.02, 0.01, 0.02, 0.03, 0.05, 0.01, 0.1, 1, 0.5, 0.1, 0.01, 0.1, 0.1, 0.08, 0.05];
        };
        case "Farm": {
            itemType = [["WeaponHolder_ItemJerrycan", "object"], ["", "generic"], ["huntingrifle", "weapon"], ["LeeEnfield", "weapon"], ["Winchester1866", "weapon"], ["", "trash"], ["Crossbow", "weapon"], ["PartWoodPile", "magazine"], ["WeaponHolder_ItemHatchet", "object"], [MR43, "weapon"], ["TrapBear", "magazine"]];
            itemChance = [0.06, 0.28, 0.01, 0.04, 0.03, 0.22, 0.03, 0.11, 0.17, 0.06, 0.01];   
        };
        case "Supermarket": {   
            _itemType = [["ItemWatch", "generic"], ["ItemCompass", "generic"], ["ItemMap", "weapon"], ["Makarov", "weapon"], ["Colt1911", "weapon"], ["ItemFlashlight", "generic"], ["ItemKnife", "generic"], ["ItemMatchbox", "generic"], ["", "generic"], ["LeeEnfield", "weapon"], ["revolver_EP1", "weapon"], ["CZ_VestPouch_EP1", "object"], ["DZ_CivilBackpack_EP1", "object"], ["DZ_ALICE_Pack_EP1", "object"], ["Winchester1866", "weapon"], ["WeaponHolder_ItemTent", "object"], ["", "food"], ["", "trash"], ["Crossbow", "weapon"], ["Binocular", "weapon"], ["PartWoodPile", "magazine"], [MR43, "weapon"]];
            _itemChance = [0.15, 0.01, 0.05, 0.02, 0.02, 0.05, 0.02, 0.05, 0.05, 0.01, 0.01, 0.01, 0.02, 0.03, 0.01, 0.01, 0.3, 0.15, 0.01, 0.05, 0.02, 0.01];
        };
        case "Hospital": {
            _itemType = [["", "trash"], ["", "hospital"], ["MedBox0", "object"]];
            _itemChance = [0.2, 0.5, 0.5];
        };
    };

    diag_log("DEBUG: Spawning a " + str (_randomvehicle) + " at " + str(_position) + " with loot type " + str(_vehicleloottype) + " With total loot drops = " + str(_num));

    waituntil {!isnil "fnc_buildWeightedArray"};

    _weights = [];
    _weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
    for "_x" from 1 to _num do {
        _index = _weights call BIS_fnc_selectRandom;
        sleep 1;
        if (count _itemType > _index) then {
            _iArray = _itemType select _index;
            _iArray set [2,_position];
            _iArray set [3,10];
            _iArray call spawn_loot;
            _nearby = _position nearObjects ["WeaponHolder",20];
            {
                _x setVariable ["permaLoot",true];
            } forEach _nearBy;
        };
    };
};
 
Code:
//_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"];

_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
  
    _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;
        };


This is how battleroyale does it. In the spawn_carepackages.sqf you can see my failed attempt at adding markers to the crates when they're on the ground. It only calls a marker on the first crate to drop. So if 5 crates drop before a person gets to the first you will only see one. Once the person gets that first marker it lets everyone on the server know they're looting it, and the marker disappears. Then the 6th carepackage to drop will be marked, but there are still 4 unmarked carepackages on the map.
Also I should note that I'm running Overwatch 0.2.5 so its possible newer scripts that are created for epoch/vanilla will not run properly on my server!
 
Last edited:
The way I made mine it should be pretty much compatible with any mod, just would need a few adjustments like loot tables and maybe 1 other thing to do with spawned in vehicles. I made my script completely separate from the carepackage script so its just an addition on top of the default events.
 
execVM in the config in the server_functions maybe? im gonna modify this some so it will work on my server and give it a try... also you a lot of duplicates in your weapon array!
Code:
["M16A4_DZ",3],["M16A4_DZ",3]
Code:
["M16A2_DZ",3],["M16A2_DZ",3]
Code:
["M4A1_SD_DZ",3],["M4A1_SD_DZ",3]
Code:
["M4A1_CCO_SD_DZ",3],["M4A1_CCO_SD_DZ",3]
Code:
["FNFAL_DZ",3],["FNFAL_DZ",3]
Code:
["AK74_SD_DZ",3],["AK74_SD_DZ",3]
Code:
["AK74_DZ",3],["AK74_DZ",3],["AK74_DZ",3],["AK74_DZ",3],["AK74_Kobra_SD_DZ",3],["AK74_Kobra_SD_DZ",3]
 
Last edited:
execVM "\z\addons\dayz_server\Carepackage\CP_Config.sqf"; in bottom of server_functions.sqf

RPT errors

Code:
21:49:54 Error in expression <ineammount];
};

for "_i" from 0 to  do {
_array = _magazinearray call bis_fnc_s>
21:49:54   Error position: <{
_array = _magazinearray call bis_fnc_s>
21:49:54   Error Missing ;
21:49:54 File z\addons\dayz_server\Carepackage\CP_Fill.sqf, line 31
21:49:54 Error in expression <ineammount];
};

for "_i" from 0 to  do {
_array = _magazinearray call bis_fnc_s>
21:49:54   Error position: <{
_array = _magazinearray call bis_fnc_s>
21:49:54   Error Missing ;
21:49:54 File z\addons\dayz_server\Carepackage\CP_Fill.sqf, line 31
21:49:54 Error in expression <t _unitGroup;

{
_pilot setSkill [_x,1]
_gunner     setSkill [(_x select 0),(_x sel>
21:49:54   Error position: <_gunner     setSkill [(_x select 0),(_x sel>
21:49:54   Error Missing ;
21:49:54 File z\addons\dayz_server\Carepackage\CP_Heli.sqf, line 52
21:49:54 Error in expression <t _unitGroup;

{
_pilot setSkill [_x,1]
_gunner     setSkill [(_x select 0),(_x sel>
21:49:54   Error position: <_gunner     setSkill [(_x select 0),(_x sel>
21:49:54   Error Missing ;
21:49:54 File z\addons\dayz_server\Carepackage\CP_Heli.sqf, line 52
21:49:54 Warning Message: Script z\addons\dayz_server\Carepackage\CP_Cleanup.sqf not found
21:49:54 ":: Carepackage :: Config finished..."
21:49:54 Error in expression <: Carepackage :: Config finished...";


while (1 == 1) do {
_timer = (round (ran>
21:49:54   Error position: <while (1 == 1) do {
_timer = (round (ran>
21:49:54   Error while: Type Bool, expected code
21:49:54 File z\addons\dayz_server\Carepackage\CP_Config.sqf, line 53
21:49:54 Error in expression <er || !isMultiplayer) then {
 
Back
Top