Jump to content
Sign in to follow this  
Waffle_SS

How to pass a variable from a script to a trigger and vice versa?

Recommended Posts

I need help passing a variable from a script to a trigger that has been placed in the editor. Lets say I have a variable "dsarf=true" in a script. When I try to have a trigger activated by the condition "true=dsarf" the variable never gets through. I've even tried "dsarf=true;publicVariable "dsarf"; in the script, but it still never gets through. Does anyone know how to pass a variable between a script and a trigger? Both ways?

Share this post


Link to post
Share on other sites

First, in your player's init line, your init.sqf, or any other init field you want really, put something like "dsarf = false;" just to initialize it. Make the condition in your trigger be simply "dsarf" (the 'true' is implicit by what is returned from the variable).

Then the line "dsarf = true;" should be all that's necessary to fire it.

EDIT: to be more precise, "true=dsarf" is wrong, that's an assignment to "true" of the value "dsarf", which fails because true is a universal value. To be more accurate you could do "true == dsarf" or "dsarf == true" but this is redundant.

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  

×