OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: redmotion on 16 Oct 2010, 12:09:10

Title: Help with triggers
Post by: redmotion on 16 Oct 2010, 12:09:10
I'd like to create a trigger in script that is put down in the location of a marker (placed in the editor). And that can only be activated by the player. Thing is, I can't even work out what type of trigger to create.

The script below runs without errors but doesn't give me a trigger that works. I've tried numerous versions of this - changing the type and activation options - but with no success.

Code: [Select]
_pos = getMarkerPos "BaseMarker5";

basetrigger = createTrigger ["SWITCH", _pos];
basetrigger setTriggerActivation ["WEST", "PRESENT", false];
basetrigger setTriggerArea[100,100,0,false];
basetrigger setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"];

Thanks for you time.
Title: Re: Help with triggers
Post by: JamesF1 on 16 Oct 2010, 13:23:14
Try using:
Code: [Select]
basetrigger = createTrigger ["EmptyDetector", _pos];That's the 'default' trigger type.

Can't see anything else that would be problematic :)
Title: Re: Help with triggers
Post by: Worldeater on 16 Oct 2010, 22:15:01
 :scratch:

The trigger will get activated by all WEST units that enter the area:
Quote
basetrigger setTriggerActivation ["WEST", "PRESENT", false];
...
basetrigger setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"];

If I got you right, this is not what you want. Try something like this:

1. Make the trigger report any unit who enters the area (setTriggerActivation (http://community.bistudio.com/wiki/setTriggerActivation)).
2. Only activate if the player is one of the units that got reported (setTriggerStatements (http://community.bistudio.com/wiki/setTriggerStatements))

Code: [Select]
basetrigger = createTrigger ["EmptyDetector", getMarkerPos "BaseMarker5"];
basetrigger setTriggerActivation ["Any", "Present", false];
basetrigger setTriggerArea [100, 100, 0, false];
basetrigger setTriggerStatements ["player in thisList", "hint 'trigger on'", "hint 'trigger off'"];
Title: Re: Help with triggers
Post by: redmotion on 20 Oct 2010, 21:52:55
@Worldeater: Thank you so much. That worked straight away. That has been killing me for a week! Thanks again.