HazJ 1289 Posted October 9, 2014 How do I broadcast and update variables frequently without using publicVariable? If I use publicVariable then I get bad desync issues, etc... "The message is sent consequently and reliably to all clients. Using publicVariable too frequently in a given period of time can cause other parts of the game to experience bandwidth problems." I have a while loop at the moment which runs every 45 seconds and a trigger (in script) which runs every time someone takes control of the sector. Any help is much appreciated. Dirty Haz Share this post Link to post Share on other sites
jshock 513 Posted October 9, 2014 Globalize the variable maybe or use BIS_fnc_MP? Share this post Link to post Share on other sites
HazJ 1289 Posted October 9, 2014 Thanks for your reply. My variable is already global? Not sure if that's what you mean... When you say use BIS_fnc_MP, how do you mean? An example would be great. I've BIS_fnc_MP before for other functions but just don't understand how to use it for this broadcasting variables. Dirty Haz Share this post Link to post Share on other sites
jshock 513 Posted October 10, 2014 Thanks for your reply. My variable is already global? Not sure if that's what you mean... When you say use BIS_fnc_MP, how do you mean? An example would be great. I've BIS_fnc_MP before for other functions but just don't understand how to use it for this broadcasting variables.Dirty Haz Actually, I just thought and put down, now that I think about it, I'm not too sure how fnc_MP would brodcast :p. But did some digging and found this thread, in which Cuel recommended replacing some of the publicVariable commands to get/sets. Share this post Link to post Share on other sites
iceman77 19 Posted October 10, 2014 (edited) My variable is already global? You're thinking of it in terms of the scope of the variable. As far as MP locality, global variables are local to the machine where they're defined / changed. Hence the needed broadcasting. If you don't want to use PV, setVariable has optional parameter to broadcast the variable. Edited October 10, 2014 by Iceman77 Share this post Link to post Share on other sites
das attorney 858 Posted October 10, 2014 TBH, the names are confusing. It should be localVariable, machineVariable, networkVariable. Something like that. Share this post Link to post Share on other sites
HazJ 1289 Posted October 10, 2014 @Iceman77 Stronghold_1 = true; publicVariable "Stronghold_1"; ??? setVariable ["Stronghold_1", true, true]; I'm really confused right now... :confused: Dirty Haz Share this post Link to post Share on other sites
iceman77 19 Posted October 10, 2014 _strongHold setVariable ["Stronghold_1", true, true]; missionNamespace setVariable ["Stronghold_1", true, true]; Share this post Link to post Share on other sites
dreadedentity 278 Posted October 10, 2014 I think the problem here is your mission/script is causing too much network traffic. You need to take another look at the script, or upgrade your server. Maybe even consider hosting. setVariable definitely has it's uses, I'm beginning to really see the beauty in it. But going with a public variable and public variable event handler is definitely the way to go. Share this post Link to post Share on other sites
Tajin 349 Posted October 10, 2014 PublicVariable does just that. It propagates the variable over the network. If that causes desync for you, then every other command which does the same, will too. You problem isn't the publicVariable command, it's how you use it. Speaking of which: It helps to check and make sure the variable actually has changed, before broadcasting it again. Oh and make sure you're not running whatever script you're running on multiple clients. If several clients try to constantly publicVariable the same Var, it will become a real mess! Share this post Link to post Share on other sites
HazJ 1289 Posted October 10, 2014 (edited) It's not the server... Script removed - Might have sorted the issue... Need to test though, will post if fixed. Dirty Haz Edited October 11, 2014 by Dirty Haz Share this post Link to post Share on other sites
cuel 25 Posted October 10, 2014 (edited) Triggers exist locally, even if you place them in the editor. I skimmed through your script and you're better off just having most of the code on the server and then broadcasting the messages and removing the PV's in the statements The code that checks who's in control is a bit weird, it will check every 45 seconds if X team is controlling a trigger, not making sure a team controls the triggers for 45 seconds. while {true} do { waitUntil {sleep 1; Stronghold_1}; for "_i" from 1 to 45 do { if (!Stronghold_1) exitWith {}; sleep 1; }; if (Stronghold_1) then { //controlled for 45 sec }; }; To update the player scores you could just PV an array with the player(s) and XP/money, or a PVEH for "Score_Blufor" and running the checks on the clients Edited October 10, 2014 by cuel Share this post Link to post Share on other sites