gopgop 1 Posted August 22, 2012 I want to have a global variable that will be initiated to false in the init.sqf and then using an addAction it will run a script that will make the variable true. and then the condition for a unit to go to its waypoint is the global variable becoming true How would I do this? i tried doing this: init.sqf: startmission = false; flag pole object: _nul = this addAction["Start mission","start.sqf"]; start.sqf: startmission = true; helicopter waypoint condition: startmission = true; Share this post Link to post Share on other sites
kylania 568 Posted August 22, 2012 (edited) See better method in post #6. :) init.sqf: startmission = false; flag pole object: _nul = this addAction["Start mission","start.sqf"]; start.sqf: _me = _this select 0; _act = _this select 2; _me removeAction _act; startmission = true; publicVariable "startmission"; hint "Mission started!"; helicopter waypoint condition: startmission You were on the right track. :) Only real changes were publiczing the variable so the server knows it too and in the condition where we changed it from assignment to a check. Also removed the action since you didn't need it anymore and added some feedback. Edited August 22, 2012 by kylania fixed Share this post Link to post Share on other sites
gopgop 1 Posted August 22, 2012 Doesn't work. I did like you wrote but when I choose start mission using the scroll wheel nothing happens and the start mission action stays there Share this post Link to post Share on other sites
kylania 568 Posted August 22, 2012 That's odd, got lazy and it didn't work! I edited the code above and tested and it works. :) One thing to keep in mind is that a unit will travel TO a waypoint with a condition first but won't consider it "complete" till the condition is true. So to have someone stay where they are at the beginning put the condition waypoint at their vehicle nose or make that a HOLD waypoint and switch it with a trigger instead to kick the mission off. (Trigger with condition of start mission synched to the HOLD waypoint for example) Share this post Link to post Share on other sites
gopgop 1 Posted August 22, 2012 Thank you so much! You really helped me! Share this post Link to post Share on other sites
neokika 62 Posted August 22, 2012 init.sqf: startmission = false; Setting a variable value in the init.sqf will override the change made via the action, for the late joiners (Join In Progress players). The best option is to check if the variable has been assigned instead of its value, in this situation. _me = _this select 0; _act = _this select 2; _me removeAction _act; startmission = true; publicVariable "startmission"; hint "Mission started!"; And within the waypoint condition just check if variable exists: !isNil { startmission } Share this post Link to post Share on other sites