-NotGeorge- 0 Posted June 5, 2017 How do i make this work if hvtarray is equal to 1 CODE: hvtarray = selectRandom [1,2]; if (hvtarray isEqualTo 1) then { hint "task1"; hvt1 = "O_officer_F" createVehicle getMarkerPos "hvt1"; "O_Soldier_AR_F" createVehicle getMarkerPos "hvt1"; "O_Soldier_AR_F" createVehicle getMarkerPos "hvt1"; //TASK thvt1 = player createSimpleTask ["Kill HVT"]; thvt1 setSimpleTaskDestination (getMarkerPos "hvt1"); thvt1 settaskstate "Created"; } else {//nothing}; if (hvtarray isEqualTo 2) then { hint "task2"; hvt2 = "O_officer_F" createVehicle getMarkerPos "hvt2"; "O_Soldier_AR_F" createVehicle getMarkerPos "hvt2"; "O_Soldier_AR_F" createVehicle getMarkerPos "hvt2"; //TASK thvt2 = player createSimpleTask ["Kill HVT"]; thvt2 setSimpleTaskDestination (getMarkerPos "hvt2"); thvt2 settaskstate "Created"; } else {//nothing}; hvtarray = 0; ----------------- The hint doesnt show up. i tried using == instead of isEqualTo but no luck. Share this post Link to post Share on other sites
Greenfist 1863 Posted June 5, 2017 else {//nothing}; This breaks things. You're commenting out the end of the ELSE segment. So remove the '//nothing', or the whole else part if you don't intend to put anything in there. Share this post Link to post Share on other sites
-NotGeorge- 0 Posted June 5, 2017 1 minute ago, Greenfist said: else {//nothing}; This breaks things. You're commenting out the end of the ELSE segment. So remove the '//nothing', or the whole else part if you don't intend to put anything in there. is it that simple?... different language of coding. Share this post Link to post Share on other sites
-NotGeorge- 0 Posted June 5, 2017 9 minutes ago, Greenfist said: else {//nothing}; This breaks things. You're commenting out the end of the ELSE segment. So remove the '//nothing', or the whole else part if you don't intend to put anything in there. just got it working, how do i make the units become simulated? Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted June 5, 2017 32 minutes ago, -NotGeorge- said: just got it working, how do i make the units become simulated? You try to create a unit with the createVehicle command. Anything ring a bell? Cheers Share this post Link to post Share on other sites
bullkanox 5 Posted June 5, 2017 _asd = selectRandom [1,2]; if (_asd == 1) then { hint "Result 1"; } else {}; if (_asd == 2) then { hint "Result 2"; } else {}; Share this post Link to post Share on other sites
killzone_kid 1333 Posted June 5, 2017 4 hours ago, -NotGeorge- said: different language of coding Huh? Even generic highlighter shows you that // comments out everything until the end of line, including closing curly bracket. Out of curiousity, what language would allow you to do this and get away with it? Share this post Link to post Share on other sites
pierremgi 4906 Posted June 5, 2017 What about this code optimization: Call { if (hvtarray isEqualTo 1) exitWith {< code1 >}; < code 2 >; }; I never understood the usage of "empty" else { } anyway! Share this post Link to post Share on other sites
Squirtman 5 Posted June 10, 2017 Empty else statements are actually a good coding practice. I have run into a couple of obscure coding languages(please don't ask what they were, it's been so long since I have worked with them i don't remember) that freak out if you don't have an actual else statement included. Share this post Link to post Share on other sites
killzone_kid 1333 Posted June 10, 2017 7 minutes ago, Squirtman said: Empty else statements are actually a good coding practice. I have run into a couple of obscure coding languages(please don't ask what they were, it's been so long since I have worked with them i don't remember) that freak out if you don't have an actual else statement included. Using empty else statements is also a very good indication to others that you have no clue what you are doing. 5 Share this post Link to post Share on other sites
phatpuke 16 Posted June 10, 2017 also a switch case would be a lot cleaner. https://community.bistudio.com/wiki/switch_do Share this post Link to post Share on other sites