Arma2 Battle Royale Carepackage Markers! HELP

Discussion in 'Script/Addon help' started by DangerRuss, Jul 6, 2017.

  1. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,224
    Likes Received:
    68
    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
     
  2. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    665
    Likes Received:
    78
    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;
                };
              
            };
        };
     
  3. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    665
    Likes Received:
    78
    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.
     
  4. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    665
    Likes Received:
    78
    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;
    };
    
     
  5. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,224
    Likes Received:
    68
    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!
     
  6. Zeehond23

    Zeehond23 Valued Member!

    Joined:
    Mar 7, 2013
    Messages:
    583
    Likes Received:
    52
    running a server again danger? :p
     
  7. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,224
    Likes Received:
    68
    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.
     
    Zeehond23 likes this.
  8. Zeehond23

    Zeehond23 Valued Member!

    Joined:
    Mar 7, 2013
    Messages:
    583
    Likes Received:
    52
    if you get the script working I'd love to give it a go on my server(s)
     
  9. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    665
    Likes Received:
    78
    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?
     

Share This Page