Home   Help Search Login Register  

Author Topic: Noob Trigger Question  (Read 640 times)

0 Members and 1 Guest are viewing this topic.

Offline Lacota

  • Members
  • *
  • I'm a llama!
Noob Trigger Question
« on: 28 Sep 2004, 04:10:58 »
Hey Guys

I looked through the forum but couldn't find an answer to this.

I want a trigger I can use to tell me how many units of each side are in an area. I created a trigger (Everybody, Present, Repeat) and added a script to OnActivate that gets the array from the trigger and counts the units. Problem is that the trigger fires when a unit enters the trigger but never again until everyone has cleared the area. Since it fires when the first person enters the area my count is always 1 of one side or the other.

What am I missing here?

Any help would be appreciated.

Lacota

P.S.
Could anyone explain how the countdown or timeout settings work?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Noob Trigger Question
« Reply #1 on: 28 Sep 2004, 13:11:38 »
Welcome to the forum!

Although a noob question is probably more at home in the General board, rather than the Advanced board .....

Anyway, read the tutorials in the Tutorials - Getting Started section of the Editors Depot (link at the top of this page) for a better understanding of triggers.

Countdown is the time in seconds between the Condition field becoming true and the On Activation field being executed.

Timeout is the time for which the Condition field must be true continuously before the On Activation field is executed.

Note that the order of the boxes is min max mid.    Note also that in waypoints, the field is Timeout but it actually means Countdown.  (I think)

When a trigger has, for example, West not present in the Activation Box, the trigger will return an array of all West units in its area.     You can use this array in the trigger with the command

thislist

and you can use it elsewhere with the command

list triggerName

The array updates automatically, whether the trigger has been fired or not. (I think.)

For your particular question you will need one trigger for each side that you are trying to detect.    


Trigger:-
Activation Box:  East present
Name:   eastTrig
Condition:   true

Script:-
_count = count list eastTrig


Syntax, etc. not guaranteed but hopefully you get the idea.
Plenty of reviewed ArmA missions for you to play

Offline Lacota

  • Members
  • *
  • I'm a llama!
Re:Noob Trigger Question
« Reply #2 on: 29 Sep 2004, 02:40:04 »
Thanks for the Welcome and reponse it was very helpful.

I have gone through a number of tutorials already but wasn't able to find anything that addressed my issue. Some came close, that's why I got as far as I did but none did exactly what I want.

I originally put in a single trigger to minimize the impact on performance but it seems I need 2, one for each side. The problem is; if a west unit enters the area his trigger is fired and will not fire again until all the west units clear the area. If an east unit then enters the area I check both trigger arrays and I show that I have one unit from each side (btw the arrays do update regardless of whether or not the trigger fires). That's what I want.  But if a unit from either side then enters the area, neither trigger will fire and I'll still think there is only one of each in the area.

I guess I could put a timer somewhere that fires every minute or so and checks these areas. It would be nice if there was an efficient way to fire a trigger any time a player entered or exited an area.

Thanks again for your help

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Noob Trigger Question
« Reply #3 on: 29 Sep 2004, 08:58:49 »
Again, welcome to the forum Lacota :)

You can do something like this using a trigger and a variable... like so:

In Your init.sqs or the init line of a unit

variablename = count units (list Triggername)


Your Trigger

Radius: as required
Condition: East/West Present (Repeatedly)
Name: Triggername
Condition Field: count units (list Triggername) != variablename
OnActivation field: Do the action you want to do; variablename = count units (list Triggername)


So that trigger will fire when ever a unit enters or exits the trigger. You may need one trigger and one variable per side, depending on what you're looking to do ;)

Offline Lacota

  • Members
  • *
  • I'm a llama!
Re:Noob Trigger Question
« Reply #4 on: 30 Sep 2004, 23:47:04 »
Thanks Sui

You're suggestion gave me an idea of how to do what I want. I have 2 triggers; one activated on detecting east and one on west. The condition that triggers them is when their count is greater than the other trigger's count. This will tell me who has the most units in the sector.

Thanks for your help.