thetrooper 10 Posted March 7, 2014 Hello. I'm having trouble with my if/else statement. Any reason why it's not working? if ( (damage civ4)<0.8; ) then { _null = [west, "tskobj_4", ["Locate and destroy technical vehicles", "Destroy Vehicles", "Vehicles"], [], true] spawn BIS_fnc_taskCreate; } else { null = [west, "tskobj_3", ["Treat the man", "Treat Injured (Optional)", "Treat"], "obj_3", true] spawn BIS_fnc_taskCreate; }; Share this post Link to post Share on other sites
Tankbuster 1733 Posted March 7, 2014 (edited) The brackets have to encompass the entire condition in the if statement ---------- Post added at 16:07 ---------- Previous post was at 16:06 ---------- The brackets have to encompass the entire condition in the if statement if ( (damage civ4)<0.8 ) Edited March 7, 2014 by Tankbuster Share this post Link to post Share on other sites
na_palm 19 Posted March 7, 2014 (edited) if ( (damage civ4)<0.8 ) then { _null = [west, "tskobj_4", ["Locate and destroy technical vehicles", "Destroy Vehicles", "Vehicles"], [], true] spawn BIS_fnc_taskCreate; } else { _null = [west, "tskobj_3", ["Treat the man", "Treat Injured (Optional)", "Treat"], "obj_3", true] spawn BIS_fnc_taskCreate; }; - removed ; in condition - added _null for the second function call I haven't checked the parameters for BIS_fnc_taskCreate. greetings Na_Palm Edited March 7, 2014 by Na_Palm typo Share this post Link to post Share on other sites
dwringer 45 Posted March 7, 2014 The _null thing isn't really necessary anyway. It makes sense inside the editor, because the engine won't allow unbound return values from init calls or whatever else. i.e., we do it as a convention to suppress the error and name the variable _null or _nil because it is immediately discarded by the game anyway. If you're inside of a script, you are actually binding the variable _null which is treated like any other machine-local variable. This breaks another convention because we generally use underscore (_) to denote a variable local to a particular script, and declared with "private" in the scope where it is used. If you don't need the value, don't assign a variable if you don't have to :) Share this post Link to post Share on other sites