I've ran into an issue were I am trying to end the loop that is running and checking the distance . My idea is to run the tailrotor failure script like this.
_uh1 = uh1;
_pilots = pilots;
_array = ["move_1", "move_2", "move_3", "move_4"];
_i = 0;
_dammage = getDammage _uh1;
while {alive _uh1} do
{
for [{_i=0}, {_i < count _array}, {_i=_i+1}] do
{
If ((getPos _uh1) distance (getMarkerpos (_array select _i)) < 200) then
{
hint format ["Near Marker: %1 (%2m)",_array select _i,(getPos _uh1) distance (getMarkerpos (_array select _i))];
[uh1,false] exec "tailrotor.sqs";
}
else
{
hint format ["Marker: %1 (%2m) is to far away.",_array select _i,(getPos _uh1) distance (getMarkerpos (_array select _i))];
};
sleep 1.0;
};
sleep 2.0;
};
The hint's are still there just to see that the script is still running.
The tailrotor script run's fine but since the helo is still alive when it goes down so that everyone doesnt die. The chkdistance script keeps running the loop. I would like to have when the helo is landed and after the troops are all out then the vehicle explodes hince ending the chkdistance script. This is the tailrotor failure script that I found that runs fine.
; tail-rotor fail script by Vektorboson
; SYNTAX
; [CHOPPER, <RANDOMKILLS, MAXKILLS>] exec "effects\tailrotor.sqs"
; CHOPPER is the helicopter
; RANDOMKILLS is either true or false (random people are killed)
; MAXKILLS is maximum of randomkills
playsound "instalarm";
_heli = _this select 0
_random = true
_maxkills = 4
?count _this == 2: _random = _this select 1; _maxkills = 4
?count _this == 3: _random = _this select 1; _maxkills = _this select 2
; Position of helicopter engine (adjust this for different helicopters!)
_enginePos = [0, -7, 1]
drop ["\ca\data\cl_fired", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]], [0], 0.1, 0.2, "", "", _heli]
~0.05
drop ["\ca\data\cl_fired", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]], [0], 0.1, 0.2, "", "", _heli]
~0.02
drop ["\ca\data\cl_fired", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]], [0], 0.1, 0.2, "", "", _heli]
_AddDir = 0.1
~(random 1)
#loop
_dir = getDir _heli
?_AddDir < 5: _AddDir = _AddDir + 0.05
_heli setDir (_dir + _AddDir)
_v = Velocity _heli
_heli setVelocity [((_v select 0) / 1.001), ((_v select 1) / 1.001), -5]
drop ["\ca\data\cl_basic", "", "Billboard", 7, 7, _enginePos, [0,0,0], 0, 1, 1, 0.001, [1,5], [[0,0,0,0],[0,0,0,0.7],[0,0,0,0]], [0], 0.1, 0.2, "", "", _heli]
~0.01
?getPos _heli select 2 > 2: goto "loop"
?alive _heli: _heli setDammage 0.8; _heli setFuel 0;
?!alive _heli: exit
?!_random: exit
; now the randomkills
_crew = crew _heli
_c = count _crew
_i = 0
_kills = 0
#crew
_unit = _crew select _i
?random 1 > 0.8 && _unit != player: _unit setdammage (random 1)
?random 1 > 0.8 && _unit != player && _kills < _maxkills: _unit setdammage 1; _kills = _kills + 1
_i = _i + 1
?_i < _c: goto "crew"