Home   Help Search Login Register  

Author Topic: Triggering AI Units  (Read 1982 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Triggering AI Units
« on: 29 Jan 2009, 05:18:55 »
Hi, I'm currently making a mission.  I'm using a trigger that ends if 4 AA Soldiers are alive.  So if west enters the trigger and the 4 AA soldiers are still alive the mission will end. 

WHat's the code for this? Thank you.. :)
Who's hyped for Arma4, long live Arma!

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Triggering AI Units
« Reply #1 on: 29 Jan 2009, 09:47:26 »
Hint #1: thisList contains the answer.
Hint #2: You have to check the typeOf the units.
Hint #3: Count the ones you are interested in.

It took me about a minute to get it working. How long have you tried?


<--
try { return true; } finally { return false; }

Offline Ext3rmin4tor

  • Members
  • *
Re: Triggering AI Units
« Reply #2 on: 29 Jan 2009, 10:07:05 »
Make two triggers with the following parameters

ACTIVATION: West - Present
TYPE: NONE
CONDITION: this
ON ACTIVATION: call {if ("soldierWAA" countType thisList >= 4) then {end = true};}

The second trigger is for the end

ACTIVATION: Noone
TYPE: end #1
Condition: end
ACTIVATION: //call an end cinematic script here if you have one




How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Triggering AI Units
« Reply #3 on: 30 Jan 2009, 04:36:53 »
Thanks a lot Ext3rmin4tor, you've been helpful in the forums, kudos to you.   :D
Who's hyped for Arma4, long live Arma!

Offline Rommel92

  • Members
  • *
Re: Triggering AI Units
« Reply #4 on: 31 Jan 2009, 23:17:36 »
Could also be simplified (except without the 1s delay of the second trigger) too:

ACTIVATION: WEST - Present
TYPE: END #x
CONDITION: ("soldierWAA" countType thisList >= 4)
ON ACTIVATION: <any end scripts here>

Offline Ext3rmin4tor

  • Members
  • *
Re: Triggering AI Units
« Reply #5 on: 01 Feb 2009, 12:19:25 »
It doesn't work because you have as condition

Code: [Select]
"soldierWaa" countType array >= 4

as trigger condition, this means that if there are 4 AA soldiers or more EVERYWHERE on the map the trigger will fire. Besides the west activation is not considered because you have to put "this" in the condition field. Another error is that "thisList" contains the units that satisfy the trigger condition, so it doesn't even exist before the trigger is fired and thus can't be put in the condition field.

I made an error too because everything executed by an "end #" type trigger can't be seen because the mission ends immediately, so if you have a cinematic sequence, launch it from the first trigger.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Rommel92

  • Members
  • *
Re: Triggering AI Units
« Reply #6 on: 01 Feb 2009, 20:50:27 »
...Another error is that "thisList" contains the units that satisfy the trigger condition, so it doesn't even exist before the trigger is fired and thus can't be put in the condition field....

Sorry, I forgot the west activation.

Code: (WEST AA Soldiers) [Select]
ACTIVATION: Anybody
TYPE: END #x
CONDITION: ("soldierWAA" countType thisList > 3) AND (WEST countSide thisList > 4)
ON ACTIVATION: <any scripts here>

Code: (EAST AA Soldiers) [Select]
ACTIVATION: Anybody
TYPE: END #x
CONDITION: ("soldierEAA" countType thisList > 3) AND (WEST countSide thisList > 0)
ON ACTIVATION: <any scripts here>

Tested and comfirmed working.
« Last Edit: 01 Feb 2009, 20:59:54 by Rommel92 »

Offline Ext3rmin4tor

  • Members
  • *
Re: Triggering AI Units
« Reply #7 on: 02 Feb 2009, 19:34:20 »
Yes but the problem of the end cinematic still remains, if he has an end cinematic it won't be displayed if launched by an end type trigger, you must launch it from a generic trigger and at the end of the cinematic fire the end trigger.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Rommel92

  • Members
  • *
Re: Triggering AI Units
« Reply #8 on: 02 Feb 2009, 20:35:26 »
This is true, however he never specified that he wanted an end cinematic, so he could just make two of these triggers, one with an end and a timeout, and the other with no timeout (and no end type) and have it execute his cinematic script (providing he had and wanted one)

 ;)