Hi all,
Trying to make an automatic reload for the S-750 Rhea, i discovered a strange Arma engine behavior.
I placed via editor one player, one S-750 and R-750 (sensors are active by default).
Then a black Wasp as enemy, disabled damage and a loiter waypoint around the SAM system in order to make it fire again and again.
So, when out of missile, you need to reload the SAM.
I placed in init field of the launcher:
this addEventHandler ["fired",{
params ["_unit"];
if (magazinesAmmo _unit select 0 select 1 == 1) then {
_unit addMagazineTurret ["magazine_Missile_s750_x4",[0],4]
}
}];
That works, but there is no delay to reload the SAM and I'd like to add a decent one for more realism. So I tried, as test, to spawn a code:
this addEventHandler ["fired",{
params ["_unit"];
if (magazinesAmmo _unit select 0 select 1 == 1) then {
_unit spawn {
params ["_unit"];
waitUntil {magazinesAmmo _unit isEqualTo []};
sleep 5;
_unit addMagazineTurret ["magazine_Missile_s750_x4",[0],4]
}
}
}];
This last code doesn't work. Not a script question. The magazines are added but the launcher remains empty and don't fire. I added a loadMagazine with no more success.
The strange thing: If I remove the simple line: sleep 5; the code works again (but missiles are loaded with no delay.)
Any clue?