OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: JasonO on 29 Mar 2007, 20:59:48

Title: Checking if anyone is in a trigger - condition
Post by: JasonO on 29 Mar 2007, 20:59:48
Hi

2nd Question..

I have an enemy attack mission where you must hold a base.

I need to make it so the enemy enter the base and enter a trigger. They get there ok and activate the trigger. However this makes the ending instant.

How would I have a script to check if any member of a group is still in the trigger, with a 1 second loop for 10 seconds?

I have a feeling it's something like this:

Code: [Select]
_group = group1
_i = 0

#loop
?!(_group in trigger) : exit
?(_i >= 10) : goto "end"
~1
_i = _i + 1
goto "loop"

#end
;script if 10 seconds is up and someone is still in that trigger from a certain side - meaning the team loose

exit

It doesnt work :S

Thanks for your help.
Title: Re: Checking if anyone is in a trigger - condition
Post by: Cheetah on 30 Mar 2007, 00:12:43
Attached is a working example (tested various things so should always work and should keep working).

I use two triggers, one for detecting if the player is inside the trigger radius, the other for ending the mission. Check it out, mission file in the zip - mission takes place at the small Rahrani map.

If you want to use the script, let me know.

EDIT: did the two trigger thing, because I dislike using scripts for things that can be easily accomplished with triggers.
EDIT1: oops, atttached
Title: Re: Checking if anyone is in a trigger - condition
Post by: JasonO on 31 Mar 2007, 04:36:18
Did you attach it?  ???

Exactly what I wanted, Thanks cheetah  8)