Jump to content
  • 0

Multiple Map Markers for Care Packages Not Working!


From time to time I run a Battle Royale Server on Arma 2. One of the features is frequently dropped carepackes. After playing a little I noticed that unless you directly see the carepackage being dropped there is no way to know where they are! So I added a map marker that spawns on the carepackage when it lands and disappears when a player gets close to the carepackage. 

The problem is as follows.  The first carepackage is dropped and the map is updated with a marker at it's location. While it sits and before and player loots it, other carepackages are being dropped around the map but the marker does not show for them. After a player captures the first carepackage, the map marker disappears from the map as intended. The very next carepackage that is dropped, following the capture of the first carepackage, updates the map with a new map marker.  So no map markers are spawning on the carepackages that drop after the first before it is captured. 

How do I make each carepackage get its own marker?


	//_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;
    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.
    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;

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello Rus ,

What you could do , since i think using same marker makes it overwrite the existing one .

Make a few markers with different names and then do BIS_fnc_selectRandom ??

But i am not sure tbh :)

Have to sort this one out to today or tomorr because i use carepackeges for the event server that i am creating

When i know more i'll let you know , prob starting on it tonight .


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Advertisement
  • Supporters
  • Discord

  • Create New...