[aps]gnat 28 Posted November 4, 2003 Problem; I want to at a Trigger change the status of various AI around an area. For any target AI (manned vehicles and squads alike) in the Init field "AA1 = group this" ..... AA2 .... AA3 and so on. The at the Trigger I execute a script, the script only has lines like; "_x SetCombatMode RED" foreach units AA1 "_x SetBehaviour COMBAT" foreach units AA1 "_x SetCombatMode RED" foreach units AA2 "_x SetBehaviour COMBAT" foreach units AA2 ............. etc When it triggers I get no errors but but then I see (through Binoculars!) that the squads dont even take the guns off their shoulders! They dont change status ! By inserting "hint" 's I can see the script does actually run but ..... Why not work? What am I doing wrong? Cheers, Gnat Share this post Link to post Share on other sites
Cephalid 0 Posted November 5, 2003 Do you use Waypoints for your units, which should change the behavior? I may would try to do it not via a script. Add a few Waypoints and cycle them back to the first. After the cycle Waypoint add another Waypoint (wpalarm) where you change the behaviour of your units to aware or what ever you would like. Now add a few more Waypoints and cycle them back via wpalarm. You already have a trigger where you were executing your script. Lets name it TriggerA. In the type field of this trigger set it to switch and synchronize it with your Waypoint wpalarm. Now as soon the trigger is activated, your units will follow your second Waypoint route immediately which starts after the first cycle, where behavior is like you want to have it. If you want the units to change back to save when your TriggerA is not active anymore you have to do the following steps. Make sure TriggerA can be activated more then once. Type in the field On Activation of TriggerA: alarm_triggerA = true Type in the field On Deactivation of TriggerA: alarm_triggerA = false Now you add a second trigger of the type switch and type in the field condition, !alarm_triggerA. This second trigger you synchronize with your first Waypoint. Share this post Link to post Share on other sites
[aps]gnat 28 Posted November 5, 2003 possible Cep, but there are over 35 groups that have to have a status change! Thats a lot of extra waypoints and trigger links. I would have thought the script commands would work as they are described ! Share this post Link to post Share on other sites
Chris Death 0 Posted November 5, 2003 [b said: Quote[/b] ]"AA1 = group this" Just to make sure, you don't use quotation marks for the groupname defining in the init fields, do you? If so, remove the q-marks and then it's fine. ~S~ CD Share this post Link to post Share on other sites
suma 8 Posted November 5, 2003 ([APS said: Gnat @ Nov. 05 2003,00:14)]The at the Trigger I execute a script, the script only has lines like;"_x SetCombatMode RED" foreach units AA1 "_x SetBehaviour COMBAT" foreach units AA1 "_x SetCombatMode RED" foreach units AA2 "_x SetBehaviour COMBAT" foreach units AA2 ............. It seems you are missing quotes around red and combat. Correct should be <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> "_x SetCombatMode ""RED""" foreach units AA1 "_x SetBehaviour ""COMBAT""" foreach units AA1 "_x SetCombatMode ""RED""" foreach units AA2 "_x SetBehaviour ""COMBAT""" foreach units AA2 or <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> {_x SetCombatMode "RED"} foreach units AA1 {_x SetBehaviour "COMBAT"} foreach units AA1 {_x SetCombatMode "RED"} foreach units AA2 {_x SetBehaviour "COMBAT"} foreach units AA2 Share this post Link to post Share on other sites
[aps]gnat 28 Posted November 5, 2003 Whoah ! That woke the AI up !! Thanks very much Suma ! Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 5, 2003 I never used that code before. I always use like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> me setbehaviour "combat" me setcombatmode "red" Share this post Link to post Share on other sites
toadeater 0 Posted November 6, 2003 (bmgarcangel @ Nov. 05 2003,14:22) said: I never used that code before. Â I always use like<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> me setbehaviour "combat" me setcombatmode "red" The command is the same, the only difference is foreach lets you use a command on every unit in the list, instead having to write the command for each unit. _x is a reserved variable in OFP which in this case means substitute all the objects in the list (array) for _x and use the command on them. In other words, you can use: " _x somecommand" foreach units somelist for any command. Share this post Link to post Share on other sites