Hawkins 8 Posted July 2, 2010 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
Big Dawg KS 6 Posted July 2, 2010 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
Joshii 10 Posted July 3, 2010 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
Hawkins 8 Posted July 6, 2010 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
f2k sel 164 Posted July 6, 2010 (edited) 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 July 6, 2010 by F2k Sel Share this post Link to post Share on other sites
mattxr 9 Posted July 6, 2010 i belive it has to be like this now with a space truckpresent = false; Share this post Link to post Share on other sites
firefly2442 6 Posted July 7, 2010 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
-)rStrangelove 0 Posted July 7, 2010 (edited) 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 July 7, 2010 by ])rStrangelove Share this post Link to post Share on other sites
Joshii 10 Posted July 7, 2010 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