[AI] Stalker

DMS clean up script assistance (SOLVED) Thank you eraser

9 posts in this topic

Mission SQF is as follows

 

Spoiler

/*
    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 =
    [
        [10,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],
        [
            []
        ],
        _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
[
    ["_pos",[],[[]],[3],[],[],[]],
    ["_extraParams",[]]
];

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        =     [
                                
                                "moderate",
                                "moderate"
                                
                            ];
//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":
    default
    {
        _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]
        
    ],
    _group,
    "assault",
    _difficulty,
    _side
] 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]
    ],
    _group,
    "assault",
    "static",
    "bandit"
] call DMS_fnc_SpawnAIStaticMG;


// Create Buildings - use seperate file as found in the mercbase mission
_baseObjs =
[
    "nedresearch_objects",
    _pos
] 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]];
}
else
{
    _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 =
[
    _pos,
    _missionName,
    _difficulty
] 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 =
[
    _pos,
    [
        [
            "kill",
            _group
        ],
        [
            "playerNear",
            [_pos,DMS_playerNearRadius]
        ]
    ],
    [
        _time,
        (DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
    ],
    _missionAIUnits,
    _missionObjs,
    [_missionName,_msgWIN,_msgLOSE],
    _markers,
    _side,
    _difficulty,
    []
] 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

 

Spoiler

[
    ["Land_i_Barracks_V2_F",[6.33105,39.5234,0],179.893],
    ["Land_i_Barracks_V2_F",[7.16602,-41.241,0],0.289607],
    ["Land_i_Barracks_V2_F",[-21.4307,-1.78882,0],89.1835],
    ["Land_CncWall4_F",[32.4512,42.2449,0],270.035],
    ["Land_CncWall4_F",[32.4058,36.8765,0],270.035],
    ["Land_CncWall4_F",[32.4102,31.5898,0],270.035],
    ["Land_CncWall4_F",[34.7031,29.2109,0],180.429],
    ["Land_CncWall4_F",[34.5991,-12.6211,0],183.627],
    ["Land_CncWall4_F",[32.5195,52.4548,0],270.035],
    ["Land_CncWall4_F",[32.4932,47.2764,0],270.035],
    ["Land_CncWall4_F",[32.4292,5.6001,0],269.696],
    ["Land_CncWall4_F",[32.416,0.231201,0],269.696],
    ["Land_CncWall4_F",[32.4517,-5.05493,0],269.696],
    ["Land_CncWall4_F",[32.4561,-10.2334,0],269.696],
    ["Land_CncWall4_F",[-26.918,54.9822,0],0.228304],
    ["Land_CncWall4_F",[-32.2861,55.0454,0],0.228304],
    ["Land_CncWall4_F",[-37.5728,55.0591,0],0.228304],
    ["Land_CncWall4_F",[-6.05371,54.8027,0],0.228304],
    ["Land_CncWall4_F",[-11.4219,54.866,0],0.228304],
    ["Land_CncWall4_F",[-16.7085,54.8794,0],0.228304],
    ["Land_CncWall4_F",[-21.8867,54.9233,0],0.228304],
    ["Land_CncWall4_F",[14.7192,54.6914,0],0.228304],
    ["Land_CncWall4_F",[9.35107,54.7546,0],0.228304],
    ["Land_CncWall4_F",[4.06494,54.7681,0],0.228304],
    ["Land_CncWall4_F",[-1.11328,54.8118,0],0.228304],
    ["Land_CncWall4_F",[32.9746,-30.3486,0],269.555],
    ["Land_CncWall4_F",[30.189,54.6829,0],359.893],
    ["Land_CncWall4_F",[24.8203,54.7148,0],359.893],
    ["Land_CncWall4_F",[19.5342,54.6973,0],359.893],
    ["Land_CncWall4_F",[34.9917,-28.084,0],0.0328615],
    ["Land_CncWall4_F",[32.9746,-35.7175,0],269.555],
    ["Land_CncWall4_F",[33.0234,-41.0037,0],269.555],
    ["Land_CncWall4_F",[33.0405,-46.1821,0],269.555],
    ["Land_CncWall4_F",[33.0405,-51.2139,0],269.555],
    ["Land_CncWall4_F",[34.5874,12.9314,0],358.669],
    ["Land_CncWall4_F",[32.3335,10.5867,0],269.696],
    ["Land_CncWall4_F",[-39.5928,47.4082,0],269.465],
    ["Land_CncWall4_F",[-39.6011,52.7769,0],269.465],
    ["Land_CncWall4_F",[-39.5352,42.1223,0],269.465],
    ["Land_CncWall4_F",[-39.5103,36.9441,0],269.465],
    ["Land_CncWall4_F",[-39.4355,32.0042,0],269.465],
    ["Land_CncWall4_F",[-39.4268,26.6357,0],269.465],
    ["Land_CncWall4_F",[-39.3701,21.3494,0],269.465],
    ["Land_CncWall4_F",[-39.3447,16.1709,0],269.465],
    ["Land_CncWall4_F",[-39.3369,11.1394,0],269.465],
    ["Land_CncWall4_F",[-39.3281,5.771,0],269.465],
    ["Land_CncWall4_F",[-39.2715,0.484619,0],269.465],
    ["Land_CncWall4_F",[-39.2461,-4.69385,0],269.465],
    ["Land_CncWall4_F",[-38.8872,-51.5032,0],269.465],
    ["Land_CncWall4_F",[-38.9858,-30.6384,0],269.465],
    ["Land_CncWall4_F",[-38.9771,-36.0068,0],269.465],
    ["Land_CncWall4_F",[-38.9204,-41.2932,0],269.465],
    ["Land_CncWall4_F",[-38.895,-46.4717,0],269.465],
    ["Land_CncWall4_F",[-39.1514,-9.86572,0],269.465],
    ["Land_CncWall4_F",[-39.1431,-15.2344,0],269.465],
    ["Land_CncWall4_F",[-39.0854,-20.5203,0],269.465],
    ["Land_CncWall4_F",[-39.0605,-25.6985,0],269.465],
    ["Land_CncWall4_F",[-20.8486,-53.7847,0],0.226546],
    ["Land_CncWall4_F",[-26.2168,-53.7219,0],0.226546],
    ["Land_CncWall4_F",[-31.5034,-53.7083,0],0.226546],
    ["Land_CncWall4_F",[-36.6816,-53.6648,0],0.226546],
    ["Land_CncWall4_F",[0.015625,-53.9636,0],0.226546],
    ["Land_CncWall4_F",[-5.35254,-53.9009,0],0.226546],
    ["Land_CncWall4_F",[-10.6392,-53.8872,0],0.226546],
    ["Land_CncWall4_F",[-15.8174,-53.8438,0],0.226546],
    ["Land_CncWall4_F",[20.7886,-54.0742,0],0.226546],
    ["Land_CncWall4_F",[15.4204,-54.011,0],0.226546],
    ["Land_CncWall4_F",[10.1343,-53.9983,0],0.226546],
    ["Land_CncWall4_F",[4.95605,-53.9543,0],0.226546],
    ["Land_CncWall4_F",[25.1353,-54.0906,0],0.226546],
    ["Land_CncWall4_F",[30.5034,-54.1538,0],0.226546],
    ["Land_CncWall4_F",[23.4336,-11.2883,0],269.494],
    ["Land_CncWall4_F",[23.3794,-6.00977,0],269.861],
    ["Land_CncWall4_F",[20.4028,12.2004,0],181.223],
    ["Land_CncWall4_F",[23.3286,9.39453,0],269.861],
    ["Land_CncWall4_F",[23.3491,4.10815,0],269.861],
    ["Land_CncWall4_F",[23.3384,-1.07031,0],269.861],
    ["Land_CncWall4_F",[20.8403,-14.1062,0],359.681],
    ["Land_CncWall4_F",[20.6108,-24.7502,0],178.022],
    ["Land_CncWall4_F",[20.561,23.0918,0],2.77044],
    ["Land_CncWall4_F",[26.7607,-30.8042,0],270.028],
    ["Land_CncWall4_F",[25.0928,-26.5007,0],229.155],
    ["Land_CncWall4_F",[24.7295,24.8779,0],309.249],
    ["Land_CncWall4_F",[26.1636,29.2161,0],269.796],
    ["Land_Sign_WarningMilitaryArea_F",[39.2969,-11.6011,0],268.387],
    ["Land_Sign_WarningMilitaryArea_F",[39.3101,-29.1194,0],268.387],
    ["Land_Sign_WarningMilitaryArea_F",[39.2554,30.7261,0],268.474],
    ["Land_Sign_WarningMilitaryArea_F",[39.4282,11.4768,0],268.474],
    ["Land_Cargo_Patrol_V3_F",[-32.6519,48.4187,-4.76837e-007],133.398],
    ["Land_Cargo_Patrol_V3_F",[-32.2607,-47.165,-4.76837e-007],45.3795],
    ["Land_Cargo_Patrol_V3_F",[27.0962,-47.6379,-4.76837e-007],311.837],
    ["Land_Cargo_Patrol_V3_F",[26.3516,48.3674,-4.76837e-007],232.923],
    ["Land_Cargo_HQ_V3_F",[-26.5986,-28.3396,-4.76837e-007],178.182],
    ["Land_Cargo_HQ_V3_F",[-26.4868,28.9883,-4.76837e-007],178.182],
    ["Exile_Construction_SandBags_Long_Preview",[-8.5752,13.4312,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.52832,10.603,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.42188,7.5459,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.42139,4.55811,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.37451,1.72998,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.26807,-1.32715,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.29883,-4.13062,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.25195,-6.95874,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.49121,-6.82471,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.45068,-9.59302,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.40381,-12.4211,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-8.29736,-15.4783,0],87.0763],
    ["Exile_Construction_SandBags_Long_Preview",[-9.41553,-17.5996,0],324.136],
    ["Exile_Construction_SandBags_Long_Preview",[-11.834,-19.3252,0],324.136],
    ["Exile_Construction_SandBags_Long_Preview",[-9.45557,16.0457,0],234.392],
    ["Exile_Construction_SandBags_Long_Preview",[-11.251,18.5259,0],234.392],
    ["Land_HelipadSquare_F",[11.3882,-1.23022,0],359.577],
    ["Land_CncWall4_F",[15.8027,-14.2065,0],359.681],
    ["Land_CncWall4_F",[10.7378,-14.3572,0],359.681],
    ["Land_CncWall4_F",[15.1621,12.2686,0],180.878],
    ["Land_CncWall4_F",[9.92139,12.4258,0],180.878]
];

 

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
Advertisement

Hey

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
    _pos
] call DMS_fnc_ImportFromM3E_3DEN;

Share this post


Link to post
Share on other sites

Do you get any error like objects is "not found on map" (see your server rpt) ? The mission objects won't get cleaned up if the object is not found on operative map.

Share this post


Link to post
Share on other sites

no errors. just no clean up of m3eden objects from the object.sqf.

everything else created in the mission.sqf is cleaned up. Crates , Ai , vehicles , turrets etc

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
Advertisement

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.