OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Vorster on 13 Jan 2008, 09:36:58
-
Gentleman,
I need your help. I am not realy a noob to programming doing alot in C++ and VBA but the boolean structure used in the sqs baffles me. At present I am trying to do a script to call up a firebelt from a troop (platoon for the for the rest of the world) of tanks on a map position. For the tactic to work all tanks need to assume a line position. This were I have my problem the script has to wait until all unit are in line formation. My text is as follows
unit setformation "line";
unit setformdir _tar;
WaitUntil {(unit Formation "line")};
But "line" isn't a boolean function. How does the the function know if the line must be true or false and how do you code a function to accept only a true condition without using ==. Any suggestions.
-
try waiting until all the tanks are ready.
unit setformation "line";
unit setformdir _tar;
Sleep 2;
WaitUntil { ({unitReady _x} count _list_of_tanks) == (count _list_of_tanks)};
-
Thanks will try it
I have a second question. I want to do a test to see that each vehicle in the group does have ammo to enable it to fire. The code I have come up with
?((({_x ammo "20Rnd_120mmHE_M1A2"} foreach units unit)!=0)&&(({_x ammo "20Rnd_120mmSABOT_M1A2"} foreach units unit)!=0)&&(({_x ammo "1200Rnd_762x51_M240"} foreach units unit)!=0))): _b = 0;
doesn't work to well. Any ideas? All I want it to do is just stop the script if the one or more of the tanks are out of ammo in the group. Tanks are assigned to the group by
Groupname = _this group
in the editor and then to unit in the script.
-
ammo command uses weaponname, not magazine name.
ammo weaponmame returns the number of rounds left in the current magazine loaded in weaponname.
If you want to check how many magazines are left, then use magazines command.
-
In addition to mandoble's suggestion, also try changing your grouping syntax to:
Groupname = group this;
I also think you only need to do this for the leader, not all the units.
-
Sweet thanks. The whole group thing is causing more hassles than any thing else. The functions are either for arrays or an object which makes programming for a group difficult. I might have to redo the script for a bunch of objects.