tophe 69 Posted June 26, 2009 Would this line behave equally on a hosted game as on a dedicated server? if (!isServer) exitWith {hint "not server"}; I have tried it successfully while hosting a mission and playing with some friend. But will the isServer command work fine on a dedicated server as well? Share this post Link to post Share on other sites
norrin 9 Posted June 26, 2009 (edited) Yes :) But don't forget that when you are hosting your are local to the server so that anything that happens on the server (eg. hints) also happens on your computer, whereas on a dedicated server you are not local to the server. Edited June 26, 2009 by norrin Share this post Link to post Share on other sites
tophe 69 Posted June 26, 2009 Cool thank you! In this case the script is started on all connected machines, and if they are not server it will exit the script with a hint (for testing purposes). So the hint will be visible on all machines except the server. Share this post Link to post Share on other sites
Jan_F_W 10 Posted July 27, 2009 Is there any reason to not use the isServer command? Where is the advantage of not using isServer (are there any examples where it does not make sense to use it)? Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 27, 2009 Is there any reason to not use the isServer command?Where is the advantage of not using isServer (are there any examples where it does not make sense to use it)? Yea, if you want something to run on both client and server. Share this post Link to post Share on other sites
Jan_F_W 10 Posted July 27, 2009 what scripts would this be? For respawn scripts, waypoint scripts and resupply scripts it doesnt make sense to let them run on client side also, does it? Share this post Link to post Share on other sites
Tajin 349 Posted July 27, 2009 It does make sense to have them running on all clients especially if they only affect local units. Many of the commands also only have local effects so running them only for the server wouldn't do much unless you send them to all clients from there. How you prefer to do it is up to you. I usually have any scripts that contain mission-logics, like checking triggers, objectives and such running only on the server. Scripts that affect units, like adding equipment, giving orders or having any other direct influence on units are executed local for the respective player. Scripts that allow the server to pass information to the players, messages, updated objectives, effects that should be visible to everyone... I run those on all machines, including the server (if its not dedicated). You see, it really depends on the situation, there is no universal solution. Share this post Link to post Share on other sites
Jan_F_W 10 Posted July 27, 2009 Many thanks for the update! :) Would -in a script which runs on every client- a command like "_secondsToWait = random 20 ~_secondsToWait" cause asynchronity? Share this post Link to post Share on other sites
Tajin 349 Posted July 27, 2009 Well those scripts would certainly be out of sync, but it depends on their purpose if that is a bad thing or not. Anyway, even without that random-sleep scripts don't run 100% synced, but thats usually not a problem. If you want something to be synced, run the script on the server only and then pass on any relevant commands to the other clients. Either via publicVariable or by using setVehicleInit. Share this post Link to post Share on other sites
Jan_F_W 10 Posted July 27, 2009 Thanks again! The script was ment to let the unit wait for a random time and then get its waypoints assigned. In a MP match I was pretty sure that this caused the AI units to not follow this command all the time but just at random... Share this post Link to post Share on other sites
Richmuel UK 0 Posted July 28, 2009 How would I use a publicvariable to pass something like a local hint to all players. In my mission players search a bag using add action which then makes a new objective with markers and a hint via a script. However it only works for players who search it. Anyone know how I make it one for all? I think it's related!! Share this post Link to post Share on other sites
icebreakr 3159 Posted July 28, 2009 be sure to use IsServer for spawning bombs / IEDs. Because if you do it on all clients instead of just server it will spawn as many bombs as there are players (clients) present. Share this post Link to post Share on other sites
Tajin 349 Posted July 28, 2009 Richmuel, have a look at this post/thread: http://forums.bistudio.com/showpost.php?p=1366696&postcount=3 Share this post Link to post Share on other sites