triggerActivated: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]2(\|.*)?\]\]" to "{{GameCategory|arma2|Scripting Commands}}")
m (Text replacement - "killzone_kid" to "Killzone_Kid")
 
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2 |Game name=
|game1= arma2
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
|version2= 1.50


|arg= global|Multiplayer Arguments=
|game3= tkoh
|version3= 1.00


|gr1= Triggers |GROUP1=
|game4= arma3
____________________________________________________________________________________________
|version4= 0.50


| Returns true if the trigger has been activated.
|arg= global


{{Informative | The engine does not provide precise way of detecting which player activated the trigger. The trigger has a default [[triggerInterval]] or 0.5 sec, so every 0.5 second it checks if there is anyone in the zone. There could be 100 people in the zone on the next scan, which one was the first? There is simply no data for this. You can make an imprecise guess by taking 1st person from [[thisList]] or [[list]]. Also you should do it on server only trigger. This will still not guarantee that person first on the list is the one who was first to activate trigger, but on balance will probably be the one.}}
|gr1= Triggers


{{Important | The trigger could be [[local]] or remote but the result returned by this command will be for the trigger activated status on the client that executed the command. See [[createTrigger]] for more info.}} |DESCRIPTION=
|descr= Returns true if the trigger has been activated.
____________________________________________________________________________________________


| [[triggerActivated]] trigger |SYNTAX=
|mp= {{Feature|important|
The trigger could be [[Multiplayer Scripting#Locality|local]] or remote but the result returned by this command will be for the trigger activated status on the client that executed the command.
See [[createTrigger]] for more information.
}}


|p1= trigger: [[Object]] |PARAMETER1=
|s1= [[triggerActivated]] trigger


| [[Boolean]] |RETURNVALUE=
|p1= trigger: [[Object]]


|x1= <code>[[if]] ([[triggerActivated]] trg1) [[then]] {
|r1= [[Boolean]]
{{cc|code}}
};</code>|EXAMPLE1=
____________________________________________________________________________________________


| [[setTriggerActivation]], [[triggerActivation]], [[triggerInterval]], [[setTriggerInterval]], [[enableSimulation]], [[simulationEnabled]] |SEEALSO=
|x1= <sqf>if (triggerActivated trg1) then { hint "trigger trg1 activated!" };</sqf>
 
|seealso= [[setTriggerActivation]] [[triggerActivation]] [[triggerInterval]] [[setTriggerInterval]] [[enableSimulation]] [[simulationEnabled]] [[createTrigger]]
}}
}}


<h3 style='display:none'>Notes</h3>
{{Note
<dl class='command_description'>
|user= MisterGoodson
<!-- Note Section BEGIN -->
|timestamp= 20150609145000
<dd class="notedate">14:50, 9 June 2015 (CEST)</dd>
|text= If the trigger already activated at least once, [[triggerActivated]] will only return false if trigger is set to activate Repeatedly.<br>
<dt class="note">[[User:MisterGoodson|MisterGoodson]]
<dd class="note">If trigger already activated at least once, [[triggerActivated]] will only return false if trigger is set to activate Repeatedly.<br>
In other words, a trigger set to activate Once will always return true once activated at least once (even if trigger is no longer activated).
In other words, a trigger set to activate Once will always return true once activated at least once (even if trigger is no longer activated).
<!-- Note Section END -->
}}
</dl>


<h3 style='display:none'>Bottom Section</h3>
{{Note
 
|user= Killzone_Kid
{{GameCategory|arma2|Scripting Commands}}
|timestamp= 20200813105000
{{GameCategory|arma3|Scripting Commands}}
|text= The engine does not provide a precise way of detecting which player activated the trigger.
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
The trigger has a default [[triggerInterval]] of ~0.5 seconds, so every half a second it checks if there is anyone in the zone.
There could be 100 people in the zone on the next scan, which one was the first? There is simply no data for this.
You can make an imprecise guess by taking 1st person from [[thisList]] or [[list]]. Also you should do it on server only trigger.
This will still not guarantee that person first on the list is the one who was first to activate trigger, but on balance will probably be the one.
}}

Latest revision as of 17:52, 18 February 2024

Hover & click on the images for description

Description

Description:
Returns true if the trigger has been activated.
Multiplayer:
The trigger could be local or remote but the result returned by this command will be for the trigger activated status on the client that executed the command. See createTrigger for more information.
Groups:
Triggers

Syntax

Syntax:
triggerActivated trigger
Parameters:
trigger: Object
Return Value:
Boolean

Examples

Example 1:
if (triggerActivated trg1) then { hint "trigger trg1 activated!" };

Additional Information

See also:
setTriggerActivation triggerActivation triggerInterval setTriggerInterval enableSimulation simulationEnabled createTrigger

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
MisterGoodson - c
Posted on Jun 09, 2015 - 14:50 (UTC)
If the trigger already activated at least once, triggerActivated will only return false if trigger is set to activate Repeatedly.
In other words, a trigger set to activate Once will always return true once activated at least once (even if trigger is no longer activated).
Killzone_Kid - c
Posted on Aug 13, 2020 - 10:50 (UTC)
The engine does not provide a precise way of detecting which player activated the trigger. The trigger has a default triggerInterval of ~0.5 seconds, so every half a second it checks if there is anyone in the zone. There could be 100 people in the zone on the next scan, which one was the first? There is simply no data for this. You can make an imprecise guess by taking 1st person from thisList or list. Also you should do it on server only trigger. This will still not guarantee that person first on the list is the one who was first to activate trigger, but on balance will probably be the one.