Home   Help Search Login Register  

Author Topic: Setting behaviour  (Read 773 times)

0 Members and 1 Guest are viewing this topic.

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Setting behaviour
« on: 15 Jul 2005, 17:20:34 »
Hi, is there any way to set every East soldier on the map's behaviour to alert when a trigger is tripped?
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Setting behaviour
« Reply #1 on: 15 Jul 2005, 17:24:56 »
Create an array of all the east soldiers on the map.  The the reply #1 on this thread to see how to do that (the example there is for resistance just change the trigger to an east present):
http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=24666

Say the array is called East_loons

then in the activation field of the trigger put:

{_x setBehaviour "ALERT"} forEach East_loons
« Last Edit: 15 Jul 2005, 17:26:40 by THobson »

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Re:Setting behaviour
« Reply #2 on: 15 Jul 2005, 17:35:09 »
Thanks, but I don't understand much of that, and would much appreciate anyone with the patience of explaining in terms a novice can understand
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Setting behaviour
« Reply #3 on: 15 Jul 2005, 18:00:08 »
okay. you have triggers, and they have various ways of being 'fired', for example, 'west present' which means if a west-side loon wanders into the trigger area it will fire. fine.

triggers also have this thing called 'thislist', which is a list of all the loons in the trigger area who could fire it. so if you have a trigger, activated by 'west present', and a west-sided group wandered into its area, 'thislist' would hold a record of that group. all the loons in that group, or rather, all the loons in that group who are inside the trigger area.

i digress ;)

if you make a trigger which is large enough to cover the whole map, say 5000 x 5000, and make it activate on 'east present', and in the 'on activation' field put

Code: [Select]
all_east = thislist
that means the variable 'all_east' now refers to all the east loons on the map.

so to change all their behaviours when another trigger is tripped, just put

Code: [Select]
{_x setbehaviour "whichever"} foreach all_east
in the 'on activation' field of that new trigger.

does that clarify?
« Last Edit: 15 Jul 2005, 18:01:12 by bedges »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Setting behaviour
« Reply #4 on: 15 Jul 2005, 18:08:25 »
{set of instructions for _x} forEach array

will take each element of the array one at a time and will run all the instructions between the curley brackets and everywhere is sees a _x it will put in the element from the array.

So in:

{_x setBehaviour "ALERT"} forEach East_loons

East_loons is an array, think of it as a list of east loons as follows:

[loon1, loon2,loon3,....]


So the above instruction will run:
loon1 setBehaviour "ALERT"
loon2 setBehaviour "ALERT"
loon3 setBehaviour "ALERT"
.
.
.

Now in the other thread I show how to make the list in the first place.

Apart from forEach what you need to know about there are:
The commands: list, crew and alive - look in the comref for an explanation
You also need to know that if you give a trigger a name say trigname
then
list trigname
will return an array (or list) of all the units that have caused the trigger to activate

and the other thing you need to know is that if a vehicle causes a trigger to fire then list triggername will include the vehicle in the list and not all of the units in the vehicle.  To get those you need to use the command crew.


EDIT:
bedges:  I think you are confusing the guy.  He wants all the living loons.  thislist will not give you that if you have loons inside a vehicle.
« Last Edit: 15 Jul 2005, 18:17:59 by THobson »

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Re:Setting behaviour
« Reply #5 on: 15 Jul 2005, 22:55:21 »
Yeah thats great guys, thanks for your patience  :cheers:

Dave
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "