Jump to content
Sign in to follow this  
okarr

how to check if a certain unit is within triggerarea ?

Recommended Posts

i ve been trying to get this to work for a while now but nothing works.

i have a trigger that is activated by blufor present.

i only want the trigger to execute stuff though when a certain AI unit is present within that area.

or rather, i want that unit to trigger it but without grouping unit and trigger.

can this be done via a condition check rather than grouping?

Share this post


Link to post
Share on other sites

in the trigger condition type

unitname distance triggername < distance

Share this post


Link to post
Share on other sites

awesome, didnt know the distance command. still new to this. its working a treat :)

Share this post


Link to post
Share on other sites
in the trigger condition type
unitname distance triggername < distance

Hi, was wondering this also. If I have a unit named Frank and want him to activate a trigger named "Factory" when within 10 meters would it be:

frank distance factory1 < distance

...doesn't work. Should I be putting a numerical value in their somewhere?

Share this post


Link to post
Share on other sites

if ((frank distance factory1) < myDistance) then {blah blah};

if ((frank distance factory1) < 10) then {blah blah};

Share this post


Link to post
Share on other sites
if ((frank distance factory1) < myDistance) then {blah blah};

if ((frank distance factory1) < 10) then {blah blah};

Sorry but what exactly is the "blah blah" -I'm trying to get the End trigger to kick in when the player steps into it's radius.

I've always just used Blufor and Opfor for triggers but I'd like to learn to make them more specific. I'm reading as many scripting guides as I can find but it's a lot to cover.

Edited by froggyluv

Share this post


Link to post
Share on other sites

Write this in the trigger's condition field:

frank in thislist;

Share this post


Link to post
Share on other sites
Write this in the trigger's condition field:

frank in thislist;

Thanks but that didn't work. I have a 25x25m End#1 trigger with 'nothing' in the activation field.

Trigger name:factory1

Unit Name: frank

Nevermind: Got it thanks Tigga. I had additional Blufor units waiting in the trigger radius so I thought they would activate it if I left Activation:Blufor;Present; but I see with your addition it waits for frank. Nice.

Edited by froggyluv

Share this post


Link to post
Share on other sites

Another Fun with Triggers question:

How to set up a trigger which has detected the player, start a countdown and if the player leaves in say 10 seconds, the trigger deactivates?

Edit -I already have the 'trigger has detected player' part. Basically I'm trying to create an 'out of bounds' area which alerts the player but gives him a certain amount of time to get out before shutting down the mission.

Edited by froggyluv

Share this post


Link to post
Share on other sites

you could just do a second check in the on activation field ..

like:

if ((frank distance triggername > 20)) then exit else <stuff you want it to trigger>

20 here is the distance from the trigger so you need to adjust the further away from the trigger you want the player to be. mind you this goes in all directions of the trigger.

sorry syntax may be off.. i m new to scritpting aswell :)

Share this post


Link to post
Share on other sites
Another Fun with Triggers question:

How to set up a trigger which has detected the player, start a countdown and if the player leaves in say 10 seconds, the trigger deactivates?

Edit -I already have the 'trigger has detected player' part. Basically I'm trying to create an 'out of bounds' area which alerts the player but gives him a certain amount of time to get out before shutting down the mission.

Have a look at the TimeOut section of the trigger (presume its still in arma2, was in OFP and Arma1). I wont be able to check until friday.

But if the time out is set to say 10 secs, you would have to be in the trigger area for 10 seconds to fire the trigger, but if you moved out before 10 secs it wouldnt fire.

The countdown works the other way, once you enter the area, it will countdown say 10 secs then fire regardless of whether you are still there or not.

Cheers

GC

Share this post


Link to post
Share on other sites

Yep, proper syntax is a killer as I know exactly what I want the program to do I just don't know exactly how to tell it :D

Actually it was more flawed thinking on my part, as I wanted the trigger to display its "warning" (text message) but give more time before the bad results (Lose). I now see that both of those effects are tied in once the trigger is fired so what I did was place two identical very long triggers, one that gives the text warning immediately, and the other that has a 20-40 second timeout. Works pretty well so far but it feels like a major hack:)

Share this post


Link to post
Share on other sites

if you need a script for the countdown its quiet easy to do.

_unit = _this select 0
_trig = _this select 1
_i = 10

#loop
~1
_i = _i - 1
? _i == 0 : Exit
? _unit disance _trig > 10 : Hint format ["%1 is out of range", name _unit] ; Exit
goto "loop"

[unitname, triggername] exec "scriptname.sqs"

Share this post


Link to post
Share on other sites

Thanks again Junker I'm putting your script in my 'library' and staring at it till I completely absorb it.:p

But even with a countdown I would still need 2 triggers right? Meaning, one to display the warning and the other to carry out it's consequences (lose mission).

Share this post


Link to post
Share on other sites

all u need is

trigger1 with [unitname, triggername] exec "scriptname.sqs" activated by the named unit

trigger2 with a condition : end2 and maybe a timeout of 5 secs

change:-

? _unit disance _trig > 10 : Hint format ["%1 is out of range", name _unit] ; Exit too ? _unit disance _trig 

too

? _unit disance _trig > 10 : Hint format ["%1 is out of range", name _unit] ; end2 = true; Exit

Edited by Junker

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×