Jump to content
Sign in to follow this  
mechastalin

Using timeout on detected by triggers, and deleting triggers.

Recommended Posts

Hi, I'm working on a mission thats more stealth oriented at the moment and I want to set it up so that when the Detected By trigger is fired you still have 60 seconds or so to take out the enemy units detecting you so the mission isn't instantly blown. Will a timeout work for this or is there a better way of checking it with a script?

Also this one is simple as well but I'm not entirely sure how to do it, I want to delete the detected by trigger once the target is down, how can I do this?

Share this post


Link to post
Share on other sites

I don't have ArmA II, but one the basis that nothing has changed from ArmA it should work fine.

On your detected by trigger, in the condition have this and alive target or some other manner of checking for the targets' completion.

Only problem I can see with having it as a timeout script is that you might have trouble if the new AI passes information between groups.

Share this post


Link to post
Share on other sites

You can use the timeout type of timer instead of countdown : timeout makes sure the condition (detection of) returns true during all the time between the moment where condition returns true and the moment where on activation trigger statements are executed. So if the unit that detected you dies the condition returns false and the timer stops counting, waiting for condition to return true again.

If you want the trigger to activate only once and then stop, just select Once instead of Repeating in the trigger creation dialog. I didn't find a command to delete a trigger in the command list.

For more info on mission editor (Arma 1) : http://community.bistudio.com/wiki/ArmA:_Mission_Editor

If you want to create the trigger with a script place a text file named init.sqf in the mission folder and write these lines :

_trig = createTrigger ["emptydetector", [0,0,0]];

_trig setTriggerArea [0, 0, 0, false];

_trig setTriggerActivation ["none", "present", true];

_trig setTriggerTimeout [60, 60, 60, true]

_trig setTriggerStatements ["this", "", ""];

You can see what each command does in the command list http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

The init.sqf file is executed on mission start.

So instead of deleting a trigger (created with the editor or by script) you can use the settriggerXXX commands to reuse a trigger. You can assign a variable name to a trigger in the editor with the name field.

To deactivate a trigger just use _trig setTriggerStatements ["false", "", ""];

and when you need it use _trig setTriggerStatements ["this", "", ""];

Share this post


Link to post
Share on other sites

Or if you just want to delete the trigger, use deleteVehicle triggername.

Share this post


Link to post
Share on other sites
Or if you just want to delete the trigger, use deleteVehicle triggername.

yeah, but how to set up a triggername in sqf code, can that be done?

Share this post


Link to post
Share on other sites

d3nn16 answered this I think?

if you create a trigger in a script and want to use it globally:

myGlobalTrigger = createTrigger ["emptydetector", [0,0,0]];
...rest of trigger init stuff

or put:

myGlobalTrigger

in the "name field" of the trigger created in the editor

then somewhere else, a script or another trigger do

deleteVehicle myGlobalTrigger;

Edited by Taurus

Share this post


Link to post
Share on other sites

I wanted to set up a mission that included delayed reporting. If an enemy patrol detected me they would call in support. However, I wanted the chance to kill the enemy unit before they had a chance to use their radio.

Unfortunately, using a 'timeout' on the detectedBy trigger did not work. Apparently, killing the detecting enemy does not cause the detectedBy trigger to return false.

Here Is My Work-around For Delayed Reporting...

Name your units something like bUnit1 and oUnit1. Set bUnit1 to be the player.

Make a detectedBy trigger that uses a countdown. The countdown time will be the amount of time that passes before the opFor unit calls for support. In the onAct field make a condition, for example:

OpForSeeBluFor1 = 1

Then make a second trigger that is always true once, and says that oUnit1 is alive. In the condition field just put 'true'. In the onAct field make a condition:

opForDead = 0

Make a third trigger to check if oUnit1 dies. In the condition field put '!alive o_unit1'. Then in the onAct field update the condition:

opForDead = 1

Make a forth trigger that waits for both conditions to be right, then calls in the enemy support. So in the condition field put:

( OpForSeeBluFor1 == 1 ) AND ( opForDead == 0 )

and in the same trigger's onAct field put some code that brings in the enemy support.

Good Luck,

OneMan

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  

×