Jump to content
Sign in to follow this  
lucilk

remove composition

Recommended Posts

i have a set of scripts that will create a composition at a random location and after he finished he returns the composition objects to be deleted later.

Problem is that everything works fine until one specific line.

Let me show how this works:

//================add_camp.sqf======================
...
//creating the camp
_newComp = ["captive_camp",getdir _rlocation, _pos] call create_composition;
...
//create a squad and make them defend the position
waituntil {!isnil "bis_fnc_init"};
_config = (configFile >> "CfgGroups" >> "East" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group");
_newGroup = [_pos, EAST, _config] call BIS_fnc_spawnGroup;
_groupleader = leader _newgroup;
sleep 3;
[_newGroup, getPos _groupleader] call bis_fnc_taskDefend;
...
//create a array with all objects created
_mission_GC = [] + units _newGroup + _newComp;
...
//add a action on the captive unit/ broadcast over network and jip and send the name of composition and the objects array (_mission_GC)
[nil,_pow1,"per",raddAction,"<t color='#0000FF'>Rescue Hostages</t>", "ied_scripts\insurgency\action_join.sqf",["captive_camp",_mission_GC]] call RE;

//============action_join.sqf=======================
...
_mission  = _args select 0;
...
//here i have a switch that determine what type of action he should perform
switch (_mission) do {
...
case "captive_camp":
{
_mission_GC = _args select 1;

//we need the group
{_x switchmove "";
_x setcaptive false;
_x enableai "ANIM";
_x enableai "autotarget";
[_x] joinsilent _caller;
} foreach units group _unit_with_action;


//call the script over the network so that the server catch it
[nil,nil,RexecVM,"ied_scripts\insurgency\garbage_collector.sqf","captive_camp",_mission_GC] call RE;

};//end case

}

//================garbage_collector.sqf======================
...
//same thing here i have a switch >> determine what mission and then case

case "captive_camp":
{
[_mission_GC] spawn {
_mission_GC = _this select 0;
sleep 5;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!THIS IS THE PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{deletevehicle _x;sleep 1;} foreach _mission_GC;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!THIS IS THE PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
};//end spawn

};//end case

Everything works fine but when server tries to delete the objects he crashes the game, i mean CTD.(nothing interesting in RPT)

But wait there is more, he doesn't always do it :| sometimes works fine the first time but second camp that has the same path will CTD the game...

Please help

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×