Jump to content

Payden

Member
  • Posts

    4
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Payden

  1. On our ESLK PVE servers, players are not required to claim or mark missions where bandits are not present.  They are encouraged but not required to let other players know that they've looted the mission crate.

    Since this caused a surprising amount of friction when a player would travel across the map only to find an empty crate, we added code to the standard missions that puts a "crate-visited" mark on the map when a player gets within 10M of the crate.  The crate may or may not be empty but at least everyone knows someone has been to the mission crate.

    Here are the present and visit loops (idea lifted from the @juandayz Bombcrate mission):

    Spoiler

    // Wait for a player to be "present"
    while {_waitTime > (_currentTime - _startTime) && !_playerPresent} do {
        uisleep _presentLoopTime;
        _currentTime = floor(time);
        {if((isPlayer _x) && (_x distance _lootBox <= _presentDistance)) then {_playerPresent = true};}forEach playableUnits;
    };

    // Wait for player to visit the crate
    while {_waitTime > (_currentTime - _startTime) && !_visitedCrate} do {
        uisleep _visitLoopTime;
        _currentTime = floor(time);
        {if((isPlayer _x) && (_x distance _lootBox <= _visitDistance)) then {_visitedCrate = true};}forEach playableUnits;
    };

    Here is our complete version of the Construction mission - thanks to @salival for all the help with the coding details.

    Spoiler

    private ["_spawnChance","_spawnRoll","_markerRadius","_loot","_lootAmount","_lootBox","_position","_eventMarker",
    "_lootPos","_presentDistance","_visitDistance","_startTime","_waitTime","_timeLeft","_visitMarker","_presentLoopTime","_visitLoopTime"];
     
    _spawnChance      = 0.8;   // Percentage chance of event happening
    _markerRadius      = 350;   // Radius the loot can spawn and used for the marker
    _waitTime          = 1200;  // Time to wait before despawning mission
    _presentDistance = 80;    // Distance from crate before a player is considered "present"
    _visitDistance      = 10;    // Distance from crate before crate is considered "visited"
    _presentLoopTime = 10;    // Sleep timer for loop watching for players to be present
    _visitLoopTime      = 4;     // Sleep timer for loop watching for players to visit the crate
     
    // Random chance of event happening
    _spawnRoll = random 1;
    if (_spawnRoll > _spawnChance) exitWith {};

    _startTime = floor(time);

    // Random location
    _position = [getMarkerPos 'center',0,5000,10,0,2000,0] call BIS_fnc_findSafePos;
    _lootPos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;

    diag_log format["%1: Creating Construction box at %2",__FILE__,_lootPos];

    _clutter = createVehicle ["ClutterCutter_small_2_EP1", _lootPos, [], 0, "CAN_COLLIDE"];
    _clutter setPos _lootPos;

    // Create box
    _lootBox = createVehicle ["USVehicleBox",_lootPos,[], 0, "NONE"];
    clearMagazineCargoGlobal _lootBox;
    clearWeaponCargoGlobal _lootBox;

    _lootLists = [
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],["ItemWoodStairs",3],["MortarBucket",7],["CinderBlocks", 24]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],["ItemWoodStairs",4],["PartPlankPack",21],["PartPlywoodPack",21]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",2],["metal_floor_kit",11],["ItemWoodFloor",11]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",2],["metal_floor_kit",14],["ItemWoodFloor",14]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",2],["outhouse_kit",2],["half_cinder_wall_kit",7],["full_cinder_wall_kit",4]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",2],["outhouse_kit",2],["ItemWoodStairs",4],"workbench_kit",["ItemComboLock",2],
             ["ItemWoodWallLg",4],"ItemWoodWallGarageDoor","ItemWoodWallWindowLg"]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",2],["ItemWoodStairs",4],"workbench_kit",["ItemComboLock",2],["ItemWoodWallLg",4],
             "ItemWoodWallGarageDoor","ItemWoodWallWindowLg"]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],["PartGeneric",11],["metal_floor_kit",11],"Itemvault"]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],["ItemWoodWallGarageDoor",4],["ItemWoodWallWindowLg",4],["ItemWoodWallLg",9]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],"workbench_kit","Itemvault",["full_cinder_wall_kit",7],["ItemComboLock",2],
             ["cinder_garage_kit",2],["cinder_door_kit",2]]
        ],
        [    ["M9_SD_DZ"],
            [["15Rnd_9x19_M9SD",3],"workbench_kit",["ItemWoodStairs",3],["wood_shack_kit",3],["deer_stand_kit",2],
             ["ItemWoodLadder",4],["desert_net_kit",5],["forest_net_kit",2],["ItemSandbagLarge",2],"Itemvault","ItemLockbox"]
        ]
    ];

    _loot = _lootLists call BIS_fnc_selectRandom;

    // Add loot
    {
        if (typeName (_x) == "ARRAY") then {
            _lootBox addWeaponCargoGlobal [_x select 0,_x select 1];
        } else {
            _lootBox addWeaponCargoGlobal [_x,1];
        };
    } forEach (_loot select 0);
    {
        if (typeName (_x) == "ARRAY") then {
            _lootBox addMagazineCargoGlobal [_x select 0,_x select 1];
        } else {
            _lootBox addMagazineCargoGlobal [_x,1];
        };
    } forEach (_loot select 1);

    _startTime = time;
     
    _eventMarker = createMarker [ format ["loot_eventMarker_%1", _startTime], _position];
    _eventMarker setMarkerShape "ELLIPSE";
    _eventMarker setMarkerColor "ColorGreen";
    _eventMarker setMarkerAlpha 0.5;
    _eventMarker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
     
    // Send center message to users
    [nil,nil,rTitleText,"Ikea Truck lost its Cargo, Check your Map for the Location!", "PLAIN",10] call RE;

    diag_log(format["%1: Loot event setup, waiting for %2 seconds", __FILE__,_waitTime]);

    _playerPresent = false;
    _visitedCrate = false;
    _currentTime = floor(time);

    // Wait for a player to be "present"
    while {_waitTime > (_currentTime - _startTime) && !_playerPresent} do {
        uisleep _presentLoopTime;
        _currentTime = floor(time);
        {if((isPlayer _x) && (_x distance _lootBox <= _presentDistance)) then {_playerPresent = true};}forEach playableUnits;
    };

    // Wait for player to visit the crate
    while {_waitTime > (_currentTime - _startTime) && !_visitedCrate} do {
        uisleep _visitLoopTime;
        _currentTime = floor(time);
        {if((isPlayer _x) && (_x distance _lootBox <= _visitDistance)) then {_visitedCrate = true};}forEach playableUnits;
    };

    // Add the pickup marker to the center of the mission of the crate has been visited
    if (_visitedCrate) then {
        _visitMarker = createMarker [ format ["loot_event_visitMarker_%1", _startTime], _position];
        _visitMarker setMarkerShape "ICON";
        _visitMarker setMarkerType "hd_pickup";
        _visitMarker setMarkerColor "ColorBlack";
        _visitMarker setMarkerAlpha 1;
    };

    // Wait for full mission time before cleaning up
    _timeLeft = _waitTime - (_currentTime-_startTime);
    if (_timeLeft > 0) then uisleep _timeLeft;
     
    // Clean up crate and markers
    deleteMarker _eventMarker;
    deleteVehicle _lootBox;
    deleteVehicle _clutter;
    if !(isNil "_visitMarker") then {deleteMarker _visitMarker;};

     

     

  2. Greetings all!

    Not sure where to post this, couldn't find an "introduction" section, please move it if appropriate.

    Anyway, relatively new to the forums, recently re-addicted to Arma 2 DayZ.

    Some of you will know Duke (ESLK).  I'm a recent addition to the clan and hope to be helping Duke with some of his scripting.

    Not new to scripting - career software engineer with USAF, Lockheed Martin and Northrop Grumman ... recently retired so looking for work with ESLK:)

    Chasing around a problem with drinking/filling a canteen from a crafted well this morning, turns out:

    - Can't fill water bottle at crafted well

        From water_fill.sqf:

        _wells = ["Land_pumpa","Land_Barrel_water","Land_Misc_Well_C_EP1","Land_Misc_Well_L_EP1","land_smd_water_pump"];

        Crafted: Map_Misc_WellPump, Map_Misc_Well and Map_Pump also can be crafted

    Need to twist Duke's arm to help me figure out how you go about either fixing this on our local server or passing it along so it can get rolled into the next update.

    Enough about me - happy to be here and enjoying getting into the weeds behind a game that may very well sink my marriage ;)

    Thanks!

    Mike (aka Payden)

     

×
×
  • Create New...