setTriggerStatements: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Some wiki formatting)
 
(97 intermediate revisions by 17 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|SETTRIGGERSTATEMENTS]]
{{RV|type=command
[[Category:Scripting Commands OFP Elite |SETTRIGGERSTATEMENTS]]
[[Category:Scripting Commands ArmA|SETTRIGGERSTATEMENTS]]


|game1= arma1
|version1= 1.00


<h2 style="color:#000066">'''''trigger'' setTriggerStatements ''[cond, activ, desactiv]'''''</h2>
|game2= arma2
|version2= 1.00


|game3= arma2oa
|version3= 1.50


'''Operand types:'''
|game4= tkoh
|version4= 1.00


'''trigger:''' [[Object]]
|game5= arma3
|version5= 0.50


'''[cond, activ, desactiv]:''' [[Array]]
|arg= global
|eff= local


'''Type of returned value:'''
|gr1= Triggers


[[Nothing]]
|descr= Defines trigger condition, activation and deactivation statements. Trigger condition has to return [[Boolean]]. [[true]] will activate the trigger, [[false]] will deactivate it (only if activation is set to repeat). [[thisList]] returns the same result as [[list]] command, which includes all entities in the trigger area that are capable of activating the trigger. Dead entities are excluded as well as crew in vehicles, vehicles themselves are included.


'''Compatibility:'''
|s1= trigger [[setTriggerStatements]] [condition, activation, deactivation]


Version 1.86 required.
|p1= trigger: [[Object]] - trigger object


'''Description:'''
|p2= condition: [[String]] - code containing trigger condition. Special variables available here:
* [[Magic Variables#this_2|this]] ([[Boolean]]) - detection event
* [[thisTrigger]] ([[Object]]) - trigger instance
* [[thisList]] ([[Array]]) - array of all detected entities


The first argument can modify the condition of when the trigger is activated.
|p3= activation: [[String]] - code that is executed when the trigger is activated. Special variables available here:
* [[thisTrigger]] ([[Object]]) - trigger instance
* [[thisList]] ([[Array]]) - array of all detected entities


The result of the activation defined by trigger activation is in variable this.
|p4= deactivation: [[String]] - code that is executed when the trigger is deactivated. Special variable available here:
* [[thisTrigger]] ([[Object]]) - trigger instance


Variable thisList contains all vehicles which caused the activation.
|r1= [[Nothing]]


'''Activ''' and '''desactiv''' expressions are launched upon trigger activation / deactivation.
|x1= <sqf>_trg setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"];</sqf>


|seealso= [[triggerStatements]] [[createTrigger]] [[setTriggerActivation]] [[setTriggerArea]] [[setTriggerText]] [[setTriggerTimeout]] [[setTriggerType]] [[Magic Variables#this_2|this]] [[thisList]] [[thisTrigger]] [[triggerInterval]] [[setTriggerInterval]] [[enableSimulation]] [[simulationEnabled]]
}}


'''Example:'''
{{Note
|user= Scifer
|timestamp= 20110314205200
|text= An array with three arguments is mandatory for this function.
}}


trigger '''setTriggerStatements''' ["this", "ok = [[true]]", "ok = [[false]]"]
{{Note
|user= Heeeere's Johnny!
|timestamp= 20140916174100
|text= Magic variable ''thisList'' does not contain dead units.
}}

Latest revision as of 18:14, 15 August 2022

Hover & click on the images for description

Description

Description:
Defines trigger condition, activation and deactivation statements. Trigger condition has to return Boolean. true will activate the trigger, false will deactivate it (only if activation is set to repeat). thisList returns the same result as list command, which includes all entities in the trigger area that are capable of activating the trigger. Dead entities are excluded as well as crew in vehicles, vehicles themselves are included.
Groups:
Triggers

Syntax

Syntax:
trigger setTriggerStatements [condition, activation, deactivation]
Parameters:
trigger: Object - trigger object
condition: String - code containing trigger condition. Special variables available here:
activation: String - code that is executed when the trigger is activated. Special variables available here:
deactivation: String - code that is executed when the trigger is deactivated. Special variable available here:
Return Value:
Nothing

Examples

Example 1:
_trg setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"];

Additional Information

See also:
triggerStatements createTrigger setTriggerActivation setTriggerArea setTriggerText setTriggerTimeout setTriggerType this thisList thisTrigger triggerInterval setTriggerInterval enableSimulation simulationEnabled

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
Scifer - c
Posted on Mar 14, 2011 - 20:52 (UTC)
An array with three arguments is mandatory for this function.
Heeeere's Johnny! - c
Posted on Sep 16, 2014 - 17:41 (UTC)
Magic variable thisList does not contain dead units.