Impavido 0 Posted May 13, 2007 I have a map that will activate triggers to give the teams scores. I have defined the scores in description.ext as 0 Then when a team meets a scoring criteria, I use the simple "westscore=westscore+1" method and make "westscore" a public variable. It works seemlessly offline, but online it falls apart. Individual players will see different scores. Â A simple score-check script I made with titletext format will even show different scores on the same client. What am I missing? Â Should I make the triggers ans script wait longer...a timeout to compensate for lag? Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 13, 2007 Try executing the publicVariable command only on the server, if you're not doing that already. Share this post Link to post Share on other sites
Impavido 0 Posted May 13, 2007 Try executing the publicVariable command only on the server, if you're not doing that already. And how exactly do I do that? Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 13, 2007 Do you use only triggers? In the onActivation field put: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local server) then {publicVariable "etc";}; This is assuming you have a gamelogic named server. Share this post Link to post Share on other sites
Impavido 0 Posted May 13, 2007 I use scripts and triggers, Does using a mix of them cause problems? And I know of the server game-logic thing from vehciel respawn scripts. What exactly it does or means is still beyond me though. Why would that make the variables the same on each client? Share this post Link to post Share on other sites
Impavido 0 Posted May 13, 2007 In one mission I have a very simple position changing script in the init line of several objects to change their altitude. Â THey are perfect offline but are only seen at ground level. COuld this be steming from the same issue? What would be the syntax for my altitude altering script regarding the server gamelogic? Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 13, 2007 If you publicVariable a variable only from the server, that value should be equal on all clients. If all the clients publicVariable their on values... it can be messy  A gamelogic is local only on the server, so if (local nameOfGameLogic) then {hint "this code will only run on the server";}; SetPos in init lines are messed up in MP, btw (maybe only on dedicated server, not sure). Run the script setting their positions from a trigger executing a second into the mission instead. Share this post Link to post Share on other sites
Impavido 0 Posted May 13, 2007 OK, thx for the input Hulk. I'll toy with your suggestions tonight and keep you posted! Share this post Link to post Share on other sites
Impavido 0 Posted May 14, 2007 Okay... So I put the line you gave me in a script activated by a trigger. The trigger says: Quote[/b] ] [] exec "script.sqs" The trigger has an assortment of other things on the ON ACT line, such as setflagtexture and setflagowner, etc. I tested the map online, and the variables appear to work properly so far. But other elements of the trigger are absent on other clients...and it's really simple stuff like titletext and such. What could the problem be? Share this post Link to post Share on other sites
fasad 1 Posted May 14, 2007 If you are only running the script on the server, other clients will not see effects of local commands. You'll need to run two scripts, one on the server and one on every other client. Share this post Link to post Share on other sites
Impavido 0 Posted May 14, 2007 When the trigger activates it executes a script. This script does the server local check that HUlk recommended and makes the critical variable public. There is another trigger that activates on that variable. To show all players text, etc... Will this work? It seems to thus far. But I haven't tested with more than 2 players. Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 15, 2007 If the trigger which publicVariable your variable is the only one with the local check you should be fine. What exactly do you do with the second trigger (This is the one activated by the first one, am I correct?)? Share this post Link to post Share on other sites
Impavido 0 Posted May 15, 2007 The second trigger is for rather the unimportant stuff, game text, music, etc. Now I have another question: Is there a difference between this: Quote[/b] ]if (local server) then {score1=score1+1, publicVariable "score1";}; and this: Quote[/b] ]score1=score1+1 if (local server) then { publicVariable "score1";}; Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 16, 2007 The first will set the score variable on the server, before broadcasting the variable to the clients. The second will set the score variable on both the server and the clients, before broadcasting the score variable to the clients (thus overwriting the variable that was set on the clients). Share this post Link to post Share on other sites
Impavido 0 Posted May 16, 2007 OK thanks for clearing things up. And about that height changing script, it still doesnt seem to work online. It's a simple script that reals like this: Quote[/b] ]_Object = _this select 0 _height = _this select 1 _ObjPos = getpos _Object _cmx = _ObjPos select 0 _cmy = _ObjPos select 1 _cmz = _ObjPos select 2 _Object setpos [_cmx,_cmy,_cmz+_height] exit And I put a ~10 wait at the beginning of the script and it stil doesn't seem to work. Share this post Link to post Share on other sites
HulkingUnicorn 0 Posted May 16, 2007 Try modelToWorld Share this post Link to post Share on other sites
UNN 0 Posted May 16, 2007 OK thanks for clearing things up.And about that height changing script, it still doesnt seem to work online. It's a simple script that reals like this: Quote[/b] ]_Object = _this select 0 _height = _this select 1 _ObjPos = getpos _Object _cmx = _ObjPos select 0 _cmy = _ObjPos select 1 _cmz = _ObjPos select 2 _Object setpos [_cmx,_cmy,_cmz+_height] exit And I put a ~10 wait at the beginning of the script and it stil doesn't seem to work. Whats the object your trying to position? Share this post Link to post Share on other sites
Impavido 0 Posted May 17, 2007 I'm not familiar with thet modeltoworld command, I'll lok into it, thx. I'm using that script to change the position of static weapons, bunkers, & sandbags to fortify a building in an urban area. Share this post Link to post Share on other sites