Jump to content
Sign in to follow this  
Hawkins

Variables in Armed Assault 2

Recommended Posts

Hi fellow mission makers. I have a small problem or rather a questions regarding variables in AA2. A long time modder and mission maker of OFP, I tend to stick to my old habbits regarding mission scripting, and along the way picking up the new stuff as needed. Now I have a small problems regarding variable values. I searched the forums and wiki but did not find a solution.

I have to following in the init.sqf:

truckpresent=false;

Which, AFAIK, should tell the game that the variable is false. Then, I have a trigger which activates when truck1 is in the trigger area. In the activation I have:

truckpresent=true;

Still, when I check the variable via the hint format command, it returns a value of 'ANY'. My sqs has a check of ?(truckpresent): goto "cond1"

Before that, I check the variable and it, as stated above, returns 'ANY'. Why is it so? I see other scripters using the same method and I guess they have no problems.

So why does the check return the value 'ANY' instead of true or false?

Share this post


Link to post
Share on other sites

Only reasons I can come up with:

1. Your code/hint is being evaluated before the init script initializes the variable

2. Another script/trigger is changing the value of the variable. Seems unlikely though that it would still report 'ANY'.

3. You have a typo. Somewhere you misspelled the variable name.

1 or 3 are the most likely.

Share this post


Link to post
Share on other sites

4. You never execute your script where the variable is defined.

To fix : Give the script + the way you execute it :D It's probably in there.

Share this post


Link to post
Share on other sites

Thank you for the answers! The variable is defined before the trigger is hit, as I understand the init.sqf file is executed right at the beginning of the mission?

Share this post


Link to post
Share on other sites

4a. you may be saving the init.sqf file as a text file, make sure you don't have hide known file types enabled, it's in tools folders options.

You could always just put truckpresent=false; in the init of a game logic.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

i belive it has to be like this now with a space

truckpresent = false;

Share this post


Link to post
Share on other sites

You could try using publicVariable on that variable to change the scope. I'm guessing perhaps it only has local scope to your "init" file.

Share this post


Link to post
Share on other sites

I'd just put

truckpresent

into the trigger act area.

It's like

 if (truckpresent) then ...

isnt it?

If everything else fails i'd put truckpresent = true into the init field of a unit.

Edited by ])rStrangelove

Share this post


Link to post
Share on other sites

I guess you just failed @ saving the files right. Or your trigger is completly messed..

You could try using publicVariable on that variable to change the scope. I'm guessing perhaps it only has local scope to your "init" file.

Not needed.

i belive it has to be like this now with a space

truckpresent = false;

Not really needed. Same is that I can write stuff like

[] execVM "test.sqf";

[]execVM "test.sqf";

or

if(5==5) then {hint format ["%1", (5+1)];} else {hint format ["%1", (5-10)];};

if(5 == 5) then {hint format ["%1", (5 + 1)];} else {hint format ["%1", (5 -10)];};

I'd just put

Quote:

truckpresent

into the trigger act area.

The expression in this field must return a boolean value (e.g. "this && alive player"). Trigger conditions are tested every 0.5 seconds. But remember to put it it on the condition line not the act area?

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  

×