Home   Help Search Login Register  

Author Topic: Trigger multiple condition troubles  (Read 1126 times)

0 Members and 1 Guest are viewing this topic.

Offline HedgeHog

  • Members
  • *
Trigger multiple condition troubles
« on: 23 Jun 2008, 12:19:19 »
Hi there folks! :D

First of all I apologize for any spelling mistake as I'm Italian and English isn't my mother tongue. I write from Rome. :)


I need help in order to make a multiple condition trigger work. I've got five SLA officers (Named POW1,2,3,4,5) held captive in a 5t truck. When the player (an SLA spetznaz) reaches a certain distance from them, they join player's squad. I managed to do this with the line command:

Condition: POW1 distance player < 2
On Act: [pow1] join (mysoldier); pow1 setcaptive false

I made 5 triggers like this, for each captive officer (POW1,2,3 and so on). And it works fine.

Now I need that when ALL the five officers have joined player's squad, an objective is done.

I tried this way:

Condition: [pow1] join (mysoldier) AND [pow2] join (mysoldier) AND [pow3] join (mysoldier) AND [pow4] join (mysoldier) AND [pow5] join (mysoldier)
On Act: "1" ObjStatus "DONE"

But it doesn't work.  >:(  There's surely something wrong with the condition field. What should I type in it?

Thank you in advance! :D

Greetings from Italy! :D

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Trigger multiple condition troubles
« Reply #1 on: 23 Jun 2008, 18:15:16 »
You don't need to give the player soldier a var-name (mysoldier), since player always points at the local player. The code "[pow1] join (mysoldier)" makes the soldier join mysoldier's group, but doesn't check whether this has already happened. You can't just count how many of the POWs are lead by the player (you could also check if they were in the same group), because if they were released but then got themselves shot (remember, they aren't captive any more), then you wouldn't complete the objective. You thus need to count how many have been released as they are released:

Code: (put this in init.sqf, init.sqs OR player soldier init line) [Select]
powsReleased = 0

Triggers to release each POW:
Code: (condition) [Select]
POW1 distance player < 2
Code: (activation) [Select]
[pow1] join player; pow1 setcaptive false; powsReleased = powsReleased + 1

Trigger to mark the objective complete (rescued all POWs):
Code: (condition) [Select]
powsReleased == 5
Code: (activation) [Select]
"1" ObjStatus "DONE"
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline HedgeHog

  • Members
  • *
Re: Trigger multiple condition troubles
« Reply #2 on: 23 Jun 2008, 18:52:07 »
 :clap: :clap:


Fine!!! Thank you! I'm gonna check it out as soon as possible!!


 :D