Jump to content
Sign in to follow this  
kocrachon

Permantly stop script...

Recommended Posts

Right now I have a looping script set up to spawn enemy AI every so often until my squad destroys a communications outpost. How do I set up a trigger to stop that script running for the remainder of the game? I have a trigger that is set to not alive bunker1. So what do I write in the on activation to stop my script?

Here is the script i am running, its a script from kiljoys evolution server that I applied to my own mission.

if (not (local server)) exitwith {};
rscripts=rscripts+1;
for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
_starts = [ka1,ka2,ka3,ka4];
_poscreate = position (_starts select (round random 3));

_pilot = createGroup (east);
"SoldierEPilot" createUnit [_poscreate, _pilot];
_recy = [_pilot,"none",objNull] spawn {[_this select 0,_this select 1,_this select 2] call EVO_gRecy};
//if(isNull (units _pilot select 0)) exitWith {};
_heli = createVehicle ["Ka50", _poscreate, [], 5000, "FLY"];
_heli setpos [getpos _heli select 0, getpos _heli select 1, 500];
_heli setdir (random 359);
_heli engineon true;

//"MarianQuandt" createUnit [position tpos1, _pilot];
(units _pilot select 0) assignAsDriver _heli;
(units _pilot select 0) moveInDriver _heli;
//(units _pilot select 0) setBehaviour "AWARE";
_pilot setCombatMode "RED";

_handle = [_pilot] execVM "scripts\flightpath.sqf";
{_x addEventHandler ["killed", {handle = [_this select 0] execVM "scripts\bury.sqf"}]} forEach (units _pilot);
_heli addEventHandler ["killed", {handle = [_this select 0] execVM "scripts\bury.sqf"}];

sleep 1.0;
waitUntil {not (alive _heli) or isNull (driver _heli)};
sleep 1.0;
if (alive _heli) then {_heli setdammage 1;};
if (alive (units _pilot select 0)) then {(units _pilot select 0) setdammage 1};
sleep 600.0;
};

Edited by HavocDemon

Share this post


Link to post
Share on other sites

Execute the script like this

myScript=[]execVM "script.sqs"[/Code]

Then you can stop it with

Terminate myScript

Share this post


Link to post
Share on other sites

Here is the script that launches it...

if(not (local server)) exitWith {};

switch (Param1) do
{
   case 0:
   {
   };
   case 1:
   {
if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};	
   };
   case 2:
   { 	
   };
   case 3:
   {
if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};
   }; 
   case 4:
   { 
   };
    case 5:
   { 
   	if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};
   };     
};

_thread = [] execVM "scripts\MainThread.sqf";
_events = [] execVM "scripts\EventsS.sqf";
_handle = [] execVM "scripts\makesu.sqf";
_handle = [] execVM "scripts\makesuB.sqf";
_handle = [] execVM "scripts\makeka.sqf";
_handle = [] execVM "scripts\makeka.sqf";
_inc = [] execVM "scripts\reinforce.sqf";
//_para = [] execVM "scripts\makepara.sqf";
_sin = [] execVM "scripts\sinitS.sqf";
if (debug) then {_servs = [] execVM "scripts\debug.sqf"};

{
if (_x isKindOf "OfficerE") then
{
	_pobj = [_x] execVM "scripts\objoff.sqf";
}
} forEach list alleast;

the script I want to change is _handle = [] execVM "scripts\makeka.sqf. So does that mean the edit should look like this..

if(not (local server)) exitWith {};

switch (Param1) do
{
   case 0:
   {
   };
   case 1:
   {
if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};	
   };
   case 2:
   { 	
   };
   case 3:
   {
if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};
   }; 
   case 4:
   { 
   };
    case 5:
   { 
   	if(not local player) then {_handle = [] execVM "scripts\timeskip.sqf"};
   };     
};

_thread = [] execVM "scripts\MainThread.sqf";
_events = [] execVM "scripts\EventsS.sqf";
myscript1 = [] execVM "scripts\makesu.sqf";
myscript2 = [] execVM "scripts\makesuB.sqf";
myscript3 = [] execVM "scripts\makeka.sqf";
myscript4 = [] execVM "scripts\makeka.sqf";
_inc = [] execVM "scripts\reinforce.sqf";
//_para = [] execVM "scripts\makepara.sqf";
_sin = [] execVM "scripts\sinitS.sqf";
if (debug) then {_servs = [] execVM "scripts\debug.sqf"};

{
if (_x isKindOf "OfficerE") then
{
	_pobj = [_x] execVM "scripts\objoff.sqf";
}
} forEach list alleast;

Edited by HavocDemon

Share this post


Link to post
Share on other sites

What's the problem, did you try the terminate command?

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  

×