[AI] Stalker

DMS clean up script assistance (SOLVED) Thank you eraser

9 posts in this topic

Mission SQF is as follows



    Research Mission with new difficulty selection system
    Hardcore now gives persistent vehicle
    easy/mod/difficult/hardcore - reworked by [CiC]red_ned http://cic-gaming.co.uk
    based on work by Defent and eraser1

private ["_num", "_side", "_pos", "_OK", "_difficulty", "_AICount", "_group", "_type", "_launcher", "_staticGuns", "_crate1", "_vehicle", "_pinCode", "_class", "_veh", "_crate_loot_values1", "_missionAIUnits", "_missionObjs", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added", "_cleanup", "_baseObjs", "_crate_weapons", "_crate_weapon_list", "_crate_items", "_crate_item_list", "_crate_backpacks", "_PossibleDifficulty"];

// For logging purposes
_num = DMS_MissionCount;

// Set mission side (only "bandit" is supported for now)
_side = "bandit";

// This part is unnecessary, but exists just as an example to format the parameters for "DMS_fnc_MissionParams" if you want to explicitly define the calling parameters for DMS_fnc_FindSafePos.
// It also allows anybody to modify the default calling parameters easily.
if ((isNil "_this") || {_this isEqualTo [] || {!(_this isEqualType [])}}) then
    _this =

// Check calling parameters for manually defined mission position.
// You can define "_extraParams" to specify the vehicle classname to spawn, either as _vehClass or [_vehClass]
_OK = (_this call DMS_fnc_MissionParams) params

if !(_OK) exitWith
    diag_log format ["DMS ERROR :: Called MISSION nedresearch_mission.sqf with invalid parameters: %1",_this];

//create possible difficulty add more of one difficulty to weight it towards that
_PossibleDifficulty        =     [
//choose difficulty and set value
_difficulty = selectRandom _PossibleDifficulty;

switch (_difficulty) do
    case "easy":
        _AICount = (4 + (round (random 4)));
        _crate_weapons         = (4 + (round (random 2)));
        _crate_items         = (3 + (round (random 3)));
        _crate_backpacks     = (1 + (round (random 1)));

    case "moderate":
        _AICount = (14 + (round (random 6)));
        _crate_weapons         = (12 + (round (random 6)));
        _crate_items         = (15 + (round (random 8)));
        _crate_backpacks     = (0+ (round (random 1)));

    case "difficult":
        _AICount = (6 + (round (random 6)));
        _crate_weapons         = (8 + (round (random 3)));
        _crate_items         = (8 + (round (random 4)));
        _crate_backpacks     = (3 + (round (random 1)));

    //case "hardcore":
        _AICount = (8 + (round (random 8)));
        _crate_weapons         = (10 + (round (random 6)));
        _crate_items         = (15 + (round (random 8)));
        _crate_backpacks     = (4 + (round (random 1)));

//_msgStart = ['#FFFF00',format["A %1 research camp has been spotted, find out what they are up to",_difficulty]];
_msgStart = ['#FFFF00',"LT.Lizzy has set up a test site for the new STATIC 50cal's , raid the test site and steal the prototype Static"];

_crate_weapon_list    = ["Exile_Weapon_AK107","Exile_Weapon_AK107_GL","Exile_Weapon_AK74_GL","Exile_Weapon_AK74","Exile_Weapon_AK47","Exile_Weapon_AKS_Gold","arifle_AK12_F","arifle_AK12_GL_F","arifle_AKM_F","arifle_AKM_FL_F","arifle_AKS_F"];
_crate_item_list    = ["optic_MRCO","optic_DMS","optic_DMS_ghex_F","optic_ERCO_blk_F","optic_ERCO_khk_F","optic_ERCO_snd_F","optic_Arco","optic_Arco_blk_F","optic_Arco_ghex_F","Exile_Item_EMRE","Exile_Item_InstantCoffee","Exile_Item_PowerDrink","Exile_Item_InstaDoc"];
_crate_backpacks_list    = ["O_HMG_01_weapon_F"];

_group =
    [[(_pos select 0)+2,(_pos select 1)+4,0],[(_pos select 0)-10,(_pos select 1)+0,0]],                    // Position AI in tent + 2nd squad
    _AICount,                // Number of AI
    _difficulty,            // "random","hardcore","difficult","moderate", or "easy"
    "assault",                 // "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
    _side                     // "bandit","hero", etc.
] call DMS_fnc_SpawnAIGroup_MultiPos;

// add vehicle patrol
_veh =
        [(_pos select 0)-100,(_pos select 1)+240,0]
] call DMS_fnc_SpawnAIVehicle;

// add static guns
_staticGuns =
        // make statically positioned relative to centre point, keep static as they are on top of building
        [(_pos select 0) -10,(_pos select 1)+10,0],
        [(_pos select 0) -10,(_pos select 1)-10,0]
] call DMS_fnc_SpawnAIStaticMG;

// Create Buildings - use seperate file as found in the mercbase mission
_baseObjs =
] call DMS_fnc_ImportFromM3E_3DEN;

// If hardcore give pincoded vehicle, if not give non persistent
if (_difficulty isEqualTo "moderate") then
    _pinCode = (1000 +(round (random 8999)));
    _vehicle = ["Exile_Chopper_Huey_Armed_Desert",[(_pos select 0) +17, (_pos select 1) -0],_pinCode] call DMS_fnc_SpawnPersistentVehicle;
    _msgWIN = ['#0080ff',format ["Convicts have taken ownership of LT.Lizzy's field test site, vehicle entry code is %1...",_pinCode]];
    _vehicle = ["Exile_Car_Ural_Covered_Yellow",[(_pos select 0)-150,(_pos select 1)+0,0],[], 0, "CAN_COLLIDE"] call DMS_fnc_SpawnNonPersistentVehicle;
    _msgWIN = ['#0080ff',"Convicts have taken over the research camp"];

// Create Crate type
_crate1 = ["Box_NATO_Wps_F",_pos] call DMS_fnc_SpawnCrate;

// setup crate iteself with items
_crate_loot_values1 =
    [_crate_weapons,_crate_weapon_list],                        // Weapons
    [_crate_items,_crate_items_list],                            // Items + selection list
    [_crate_backpacks,_crate_backpacks_list]                    // Backpacks

// Define mission-spawned AI Units
_missionAIUnits =
    _group         // We only spawned the single group for this mission

// Define mission-spawned objects and loot values
_missionObjs =
    _staticGuns+_baseObjs+[_veh],            // armed AI vehicle, base objects, and static guns
    [_vehicle],                                //this is prize vehicle
    [[_crate1,_crate_loot_values1]]            //this is prize crate

// define start messages in difficulty choice

// Define Mission Win message defined in persistent choice

// Define Mission Lose message
_msgLOSE = ['#FF0000',"The Field Test for the 50cal prototype has packed up and left . LT.Lizzy seems pleased."];

// Define mission name (for map marker and logging)
_missionName = "Research Camp";

// Create Markers
_markers =
] call DMS_fnc_CreateMarker;

// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;

// Parse and add mission info to missions monitor
_added =
        (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
] call DMS_fnc_AddMissionToMonitor;

// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
    diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];

    // Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
    _cleanup = [];
        _cleanup pushBack _x;
    } forEach _missionAIUnits;

    _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));

        _cleanup pushBack (_x select 0);
    } foreach (_missionObjs select 2);

    _cleanup call DMS_fnc_CleanUp;

    // Delete the markers directly
    {deleteMarker _x;} forEach _markers;

    // Reset the mission count
    DMS_MissionCount = DMS_MissionCount - 1;

// Notify players
[_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;


if (DMS_DEBUG) then
    (format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog;


Everything in the above SQF works .. however i am using call DMS_fnc_ImportFromM3E_3DEN; to spawn in the objects from the object.sqf

Object.SQF below





This object.sqf is correctly referenced in the mission.sqf for the purpose of calling the objects to spawn when mission spawns and to spawn them in relative position to the crate or center pos. 

My Issue is the mission.sqf.
All objects that are NOT part of the object.sqf ie: Crate , Helicopter reward vehicle , turrets  , Ai bodies etc  are removed on mission complete/fail.
However , all objects that ARE part of the object.sqf ie: Every wall , building etc are NOT removed.

Can anyone point me at what function is required to correctly address the call DMS_fnc_ImportFromM3E_3DEN;  and have all of those objects removed?



Edited by [AI] Stalker

Share this post

Link to post
Share on other sites

@eraser1 @red_ned  , am i correct in thinking i need a reference such as

 _cleanup pushBack (_x select 0); 

} foreach ( _baseObjs select 3); 

really am shooting in the dark here. My assumption is to reference the _baseobject line which references the m3den import object function ... but i am admittedly a dish washer in a 5 Star kitchen when it comes to this.

Share this post

Link to post
Share on other sites


Is your object file called "nedresearch_objects"? If one of the objects is "not found on map" (see your server rpt) the mission objects won't get cleaned up.

Objects are called & converted through the call:

// Create Buildings - use seperate file as found in the mercbase mission
_baseObjs =
    "nedresearch_objects",   //change this line to your objects name & place it in @ExileServer\addons\a3_dms\objects
] call DMS_fnc_ImportFromM3E_3DEN;

Share this post

Link to post
Share on other sites

Cheers @eraser1

I can confirm that this works, not that you could ever doubt the master.

My server is running like a beast now that the DMS mission objects are getting cleaned up. It was getting very laggy towards the end of the 3.5hr mark.

Bam, once again eraser1 cleans up.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.