Graz 1 Posted February 1, 2013 I've been trying to initiate an an storm by using a public variable as a boolean. It's for multiplayer, with JIP on a dedicated server. The server handles the probability of a storm occurring and the client executes the effects. It all worked perfectly without the variable, but now it's not returning anything. This is the first time I've use a public or global variable so I'm sure I've just made a rookie mistake! Here's the code: mission init.sqf: //Storm pulseif (isDedicated) then { [] execVM "weather/storm_pulse.sqf";};//Stormif (!isDedicated) then { [] execVM "weather/storm.sqf";};[/Code]This is the storm_pulse.sqf[Code]//Storm testingwhile {true} do {sleep 120; Grazstorm = True; publicVariable "Grazstorm";};[/Code]And the loop and call in storm.sqf[u]This isn't the whole code, just the relevant parts[/u][Code] [] spawn { _delay = 3; sleep 0.01; while {true} do { if (Grazstorm = true) then { _delay setovercast 0.9; _delay setrain 1; _delay setfog bis_fog; sleep _delay ; }; }; };//It's called again herewhile {true} do { if (Grazstorm = true) then { //A metric ton of code I've removed }; sleep 0.2;};[/Code]I have no idea how this isn't working!!! Squint didn't have any errors and the effects worked perfectly until I put in these checks. Does anyone know where I've ballsed up? Share this post Link to post Share on other sites
iceman77 18 Posted February 1, 2013 (edited) while {true} do { if ([color=#ff0000]Grazstorm[/color]) then { //A metric ton of code I've removed }; sleep 0.2; }; Edited February 1, 2013 by Iceman77 Share this post Link to post Share on other sites
Graz 1 Posted February 1, 2013 Edit: forgot to say thanks for posting back :) Is that different from = true? Or is it just a lot cleaner? Share this post Link to post Share on other sites
lifted86 10 Posted February 1, 2013 it should be (Grazstorm == true) // not sure if this works Share this post Link to post Share on other sites
iceman77 18 Posted February 1, 2013 (edited) No it shouldn't. What I posted is to check bool on a variable. ---------- Post added at 22:49 ---------- Previous post was at 22:46 ---------- If you wanted to check for a false variable then use If (!Grazstorm) Then { ... do some shit ...}; If you wanted to see if the variable (exists) then you can use If (IsNil "Grazstorm") Then {hint "the variable doesn't exist"} Else {Hint "The variable has been set and it exists"}; ---------- Post added at 22:54 ---------- Previous post was at 22:49 ---------- = sets/assigns (w/e) a variables value. If you wanted to compare then use == Edited February 1, 2013 by Iceman77 Share this post Link to post Share on other sites
cuel 25 Posted February 1, 2013 = is assign value == is equal to If you'd had == the if condition would be if (true == true) then { // }; Since your variable is a Boolean. Hence you only need to write the variable since you're checking its value. Share this post Link to post Share on other sites