bigshot 64 Posted September 29, 2014 I am trying to get the host's weather synced with connected clients both at mission strat and also for JIP. ...so what is the difference between these 2 functions? ...and why would I want to use one over the other?? ..and how do you call the paramWeather one? HELP! lol Share this post Link to post Share on other sites
jshock 513 Posted September 30, 2014 As far as I can tell from the wiki pages: https://community.bistudio.com/wiki/BIS_fnc_paramWeather https://community.bistudio.com/wiki/BIS_fnc_setOvercast Both seem to be an instantaneous change of the overcast levels, however, the setOvercast function states that it is executed/shared across the network (not particullarly sure if that includes any JIP coming into the network) and must be executed in a scheduled environment. I would assume the call for paramWeather would be: _overcastLevel = [0.5] call BIS_fnc_paramWeather; Share this post Link to post Share on other sites
bigshot 64 Posted September 30, 2014 ...tried using a variable for the number (which is setup as _overcast_intensity = random 1) but it doesnt work for me: [_overcast_intensity] spawn BIS_fnc_setOvercast does it have to be written as defining another variable to work? 0 = [_overcast_intensity] spawn BIS_fnc_setOvercast Share this post Link to post Share on other sites
jshock 513 Posted September 30, 2014 I don't believe you have to assign the function to a variable, it's just good practice, and make sure that your call/spawn of the function is within a scheduled environment, reference some of the examples at the bottom of this page: https://community.bistudio.com/wiki/call Share this post Link to post Share on other sites
dreadedentity 278 Posted September 30, 2014 (edited) Both seem to be an instantaneous change of the overcast levels, however, the setOvercast function states that it is executed/shared across the network (not particullarly sure if that includes any JIP coming into the network) and must be executed in a scheduled environment. I agree with JShock here, it seems the main/only difference is network broadcast, meaning you'll only have to call it on one client/machine. I don't agree with needing to be executed in a scheduled environment, though, I looked through BIS_fnc_paramWeather in the functions viewer and there were no sleeps. In fact (and this is what I thought was interesting), it doesn't do anything except call BIS_fnc_setOvercast. So actually they do the exact same thing. So it seems JShock and I were both wrong. does it have to be written as defining another variable to work?0 = [_overcast_intensity] spawn BIS_fnc_setOvercast No, this is called script handle. You only need to know this if you intend to terminate the script early. But that only applies if you use spawn or exec or execVM. I would recommend using call instead for setOvercast, because spawn is unnecessary. Now, when you use call, you're going to get an actual result, that's why I'll always assign a new variable when I call something. I don't believe you have to assign the function to a variable, it's just good practice, and make sure that your call/spawn of the function is within a scheduled environment, reference some of the examples at the bottom of this page: https://community.bistudio.com/wiki/call Actually, only call needs to be in a scheduled environment, spawn, exec(not used anymore), execVM, and I guess execFSM all create scheduled environments when they run. But that's a good find, JShock, that's the exact page where I learned about scheduled vs. non-scheduled. :) EDIT: I'll share one small thing with you guys, I've been looking for non-scheduled environments for days and I've only found 2, unit Initialization and the editor Debug Console. I'm unsure about Event Handlers, and I'm pretty sure GUI's are but I haven't tested it. init.sqf is scheduled (I have run many sleeps from it, even before I started looking) for reasons I'm not sure of, and all code-run scripts are scheduled because you have to use execVM to run them. If you're ever unsure if a piece of code is unscheduled or not, throw in a sleep statement. You will get error "Generic error in expression". VERY LAST EDIT: ...tried using a variable for the number (which is setup as _overcast_intensity = random 1) Try not to use random in multiplayer scripts, because every client will get a different result...probably not the effect you want. Edited September 30, 2014 by DreadedEntity Share this post Link to post Share on other sites
tryteyker 28 Posted September 30, 2014 You don't need to call paramWeather. It calls setOvercast as it's main function so it's just a link between the two. setOvercast will distribute the weather evenly and instantly across the network, but will not update for JIPs. Share this post Link to post Share on other sites
bigshot 64 Posted October 1, 2014 (edited) Well...seems that when I use "call" it's working. Can anyone post the function here so I can see what it actually does...I was under the impression that it only sets the clouds...but now im wondering if theres more to it such as fog/wind too because the client was also showing fog. As for JIP...I had someone join the server as JIP and after a minute or 2 their weather updated suddenly and they were getting the host's weather (yet I ran no special weather script such as setovercast or setfog, etc on their client machine), but it was also including the fog....so im a bit lost as to what this is really doing or not doing as far as clients. The rain seems to come automatically based on cloud cover and does not have to be called for host or client. Im using this command only at mission start so the initial weather gets set randomly on the host and then gets synced to any client...and this now seems to work...but im confused how to proceed as far as after I have the weather change on the host after playing for awhile...do I still need to keep using my old client update script for all the weather params as usual (which uses updating public variables and can take an hour for the weather to change drastically), or will this command im using at startup continue to update the clients even if the hosts weather changes as the mission continues? I dont believe its written to do that, but Im not sure. If there were other params I could use with this function (such as having it update weather gradually instead of instantly) then I would just keep using it throughout the entire mission...but from what I saw in it's description it only supports the number for intensity, and not time...is this still correct? Edited October 1, 2014 by BigShot Share this post Link to post Share on other sites
tryteyker 28 Posted October 1, 2014 The function uses setOvercast in conjunction with the number to change overcast (and only overcast), and then uses forceweatherchange to forcefully update it. It's not written to update continously for JIPs and only executes on the server. As far as I'm concerned though, JIPs should be pulling weather data from the host already, but I'm not a 100% on that. Regardless if you want to change the weather, just call the function again. It doesn't need a continous update if JIPs pull weather data from the host. As for gradual change of weather, there seems to be no command to gradually change weather (atleast not properly categorized if it's there) but rather you can check when the next weather change will be with nextweatherchange. Share this post Link to post Share on other sites