Home   Help Search Login Register  

Author Topic: Triggers and group counts  (Read 472 times)

0 Members and 1 Guest are viewing this topic.

KatukovStrikesBack

  • Guest
Triggers and group counts
« on: 16 Apr 2003, 12:55:02 »
I've been racking my brain for an hour now, but I just can't figure out how to make groups and triggers work together. Here is what I want to do:

I have three groups (named A through C) A and B are infantry and C is a tank platoon. I want to have two seperate attack waves come in on the player's location. The problem is I don't want the tanks to attack until both infantry group are dead. The logic behind it is something like this

If GroupA count = 0 then deadgoup=deadgroup+1
If GroupB count = 0 then deadgoup=deadgroup+1
If deadgroup=2 then 2ndwavego(trigger for tanks waypoint) = true

For the life of me I can't get the game to keep track of how many groups are destroyed and how to recognize and change a varible (ei dead=dead+1)

Any help is very welcome.

Edit: I found a very long winded work around. You have to name every single member of the enemy squads and have trigger that looks like this:

RA1: R=Russian A=Group Designation 1=position in group

Cond: Not alive RA1 and not alive RA2 and not alive RA3, ect ect
On Activ: 2ndwave

It works, but there must be a better way. Oh and a cautionary note on tanks. If you give the tank a name (lets says UNIT1), the game considers it destroyed when it blows up. However, the crew do not take this name as well and can survive and the game doesn't notice. This led to a small problem in the origial CWC mission where you shoot up the tanks. I killed all the tanks and my partner gave the all clear and said something about all the smoke. Next thing I know 2 Soviet crew members venilate me with the AK-74s.

"All clear" indeed   ::)


« Last Edit: 16 Apr 2003, 13:16:30 by KatukovStrikesBack »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Triggers and group counts
« Reply #1 on: 16 Apr 2003, 13:42:34 »
Working backwards, lets start with the dead tank problem.    Depending on exactly what conditions you want, the best thing to put in a trigger to test if a tank is dead is

(not canMove tank1) and (notcanFire tank1)

If you want, you can add to that

not alive tank1D etc

or alternatively you can use the not move and fire thing and use setdammage 1 on the tank crew.

As you say, using not alive tank1 just gets you into trouble.    Don't use not alive for vehicles, its not good game design.


Now, the dead infantry problem.   Your logic is basically right of course.     If you haven't initialised the variable deadgroup I suspect it won't work.   You also need to understand the difference between = and ==

Here's what I'd do.  (syntax not guaranteed, check it in the command ref)

? (count units groupA == 0):Adead=true
? (count units groupB == 0):Bdead=true

? Adead and Bdead:2ndWaveGo=true

There is usually a delay of a few seconds before the count command works.    It might be better for gameplay purposes to use <= 1 rather than == 0, but you can check that with playtesting.      

By using seperate variables for each group, rather than a cumulative system, it will make it easier to check what's going on.   For instance you could have a debugging trigger

condition:   Adead
on activation:    hint "Group A is dead"

Right last point, initialising variables.    If OFP comes across a variable it doesn't understand, it makes the whole expression false.     In your logic, its just going to ignore the whole of

If GroupA count = 0 then deadgoup=deadgroup+1

because it doesn't know about deadgroup, unless you have put this in your init.sqs (or somewhere)

deadgroup=0

In my version, there is no need to initialise the varible because I'm not asking the game to do anything until it has been defined as true.    In other circumstances (for example if I want the game to do something when the variable is false) I would have to write in init.sqs

Adead=false

Does that make sense?   Or did you know it already? :P   I assume you are using a switch trigger for the tanks' waypoint.



Plenty of reviewed ArmA missions for you to play

KatukovStrikesBack

  • Guest
Re:Triggers and group counts
« Reply #2 on: 16 Apr 2003, 20:50:42 »
I got it! I got it! You're right, using numbers and counters takes a bit too long. Anyway here is how I figured it out after De-PBOing the mission "Absolute Zero"

Trigger 1
Cond: west countside units GroupA == 0
On active: DeadgroupA=true

Trigger 2
Cond: west countside units GroupB == 0
On active: DeadgroupB=true

Trigger 3
Cond: DeadgroupA and DeadgroupB
On active: 2ndwavego=true

Victory!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Triggers and group counts
« Reply #3 on: 17 Apr 2003, 09:04:57 »
You could do that all by using only one single trigger:

trigger:

Condition: "alive _x" count (units groupA) == 0 AND "alive _x" count (units groupB) == 0

onActivation: 2ndwave = true


btw - using alive _x seems to be quicker than just a simple
count units groupx.

~S~  CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted