IntruderDZ 1 Posted October 24, 2002 ok im having trouble using this public variable. I have 2 scripts one for the host (server) and one for the players(clients). I attempted to add Publicvariable"Blahblah" and @(blahblah) but with no luck. The host's scripts runs but the clients doesnt. I have a trigger where i exec both of them the one for the host and the clients. here are both of them without my publicvariable attempts </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;;;Server Script ?!(local server):exit _origin = _this select 0 _distance = 1 _xpos = getPos _origin Select 0 _ypos = getPos _origin Select 1 _angle = getDir _origin ;;;;;;;;;;;;;;;;;1 Goto "Offset" #offset _xoffset = (sin _angle) * _distance _yoffset = (cos _angle) * _distance _obj = NearestObject [_xpos + _xoffset, _ypos + _yoffset, 0] ? ((_obj == _origin) && (_distance < 2)): _distance = _distance + 1.5; goto "offset" ? (_obj != _origin): goto "Move1" #move1 _obj setpos [(getPos p) Select 0,(getPos p) Select 1,26.8] Exit <span id='postcolor'> and this is the client script </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;;;ClientScript _origin = _this select 0 _distance = 1 _xpos = getPos _origin Select 0 _ypos = getPos _origin Select 1 _angle = getDir _origin ;;;;;;;;;;;;;;;;;1 Goto "offset" #offset _xoffset = (sin _angle) * _distance _yoffset = (cos _angle) * _distance _obj = NearestObject [_xpos + _xoffset, _ypos + _yoffset, 0] ? ((_obj == _origin) && (_distance < 2)): _distance = _distance + 1.5; goto "offset" ? (_obj != _origin): goto "Move1" #move1 _obj setpos [(getPos p) Select 0,(getPos p) Select 1,26.8] <span id='postcolor'> where am i supposed to put the @(BLahblah) and the Publicvariable "blahblah" within both scripts in order for it to activate and work together? and... do i have to do that for each execution say if i wanted to add more than one setpos line?? Share this post Link to post Share on other sites
whisperFFW06 0 Posted October 24, 2002 Do you use random or relative coordinates for destination? ie : do you use any "a setPos [(getPos a) select 0, (getPos a) select 1, ((getPos a) select 2) + 3]" or any random position. As scripts are run on every PC, any relative coordinate (coordinate + offset) are calculated n times, n being the number of players, so the object is mpoved by n x offset . And, random function is evaluated on each PC and return different results, resulting in non coherent placement on every PC. You should run your script only on the server, by placing a LOGIC unit in your map, naming it server , and by putting at the beginning of your script : ?!(local server):exit Whis' Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 24, 2002 Thanks for the reply Whisper. So this Local server thing should make it run on the host machine and relay it to the other players is that right ? making it so that whatever the host sees is what everyone else will ? Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 24, 2002 well som'gun. Well it ran fine, only on my machine (host) now how do i get it to run for each players computer. Is there another command line for that ? what is Local variable ? will that make it local to the individual's computer ? Any takers Share this post Link to post Share on other sites
bn880 5 Posted October 24, 2002 You need to research multiplayer scripting. Try these forums and OFPEC. Also there is some Multi stuff on the bn880 page below. PublicVariable is a big hint. Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 24, 2002 -------------------------- Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 26, 2002 Ok forgive me cause i dont know really what to do but im sure someone does. How to sync all players script executions so that the data is identical on each machine. I have some understanding that a Server has his own script and the clients have thier own scripts, but how ? Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 27, 2002 whisper ?? Bn880 ?? anybody ?? Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 29, 2002 -------------------- Share this post Link to post Share on other sites
whisperFFW06 0 Posted October 30, 2002 oooops... Sry for the late reply I didn't see any random or relative setting in your code, so the problem should not be there. BUT... did you try : </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_obj setpos [(getPos o) Select 0,(getPos o) Select 1,36.2] <span id='postcolor'> (...) is important For your second code, getPos for a marker do not work, if I remember well, you should use getMarkerPos Whis' Share this post Link to post Share on other sites
IntruderDZ 1 Posted October 30, 2002 publicvariable "blahblah"  and   @(blahblah) for multiplayer scripts ?? will this solve my problem for inconsistent results throughout all the players machines. Share this post Link to post Share on other sites
whisperFFW06 0 Posted October 30, 2002 Yes, in case of MP inconsistencies, publicVariable is the good solution. Share this post Link to post Share on other sites
IntruderDZ 1 Posted November 7, 2002 ok im having trouble using this public variable. I have 2 scripts one for the host (server) and one for the players(clients). I attempted to add Publicvariable"Blahblah" and @(blahblah) but with no luck. The host's scripts runs but the clients doesnt. I have a trigger where i exec both of them the one for the host and the clients. here are both of them without my publicvariable attempts </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;;;Server Script ?!(local server):exit _origin = _this select 0 _distance = 1 _xpos = getPos _origin Select 0 _ypos = getPos _origin Select 1 _angle = getDir _origin ;;;;;;;;;;;;;;;;;1 Goto "Offset" #offset _xoffset = (sin _angle) * _distance _yoffset = (cos _angle) * _distance _obj = NearestObject [_xpos + _xoffset, _ypos + _yoffset, 0] ? ((_obj == _origin) && (_distance < 2)): _distance = _distance + 1.5; goto "offset" ? (_obj != _origin): goto "Move1" #move1 _obj setpos [(getPos p) Select 0,(getPos p) Select 1,26.8] Exit <span id='postcolor'> and this is the client script </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;;;ClientScript _origin = _this select 0 _distance = 1 _xpos = getPos _origin Select 0 _ypos = getPos _origin Select 1 _angle = getDir _origin ;;;;;;;;;;;;;;;;;1 Goto "offset" #offset _xoffset = (sin _angle) * _distance _yoffset = (cos _angle) * _distance _obj = NearestObject [_xpos + _xoffset, _ypos + _yoffset, 0] ? ((_obj == _origin) && (_distance < 2)): _distance = _distance + 1.5; goto "offset" ? (_obj != _origin): goto "Move1" #move1 _obj setpos [(getPos p) Select 0,(getPos p) Select 1,26.8] <span id='postcolor'> where am i supposed to put the @(BLahblah) and the Publicvariable "blahblah" within both scripts in order for it to activate and work together? and... do i have to do that for each execution say if i wanted to add more than one setpos line?? Share this post Link to post Share on other sites
whisperFFW06 0 Posted November 8, 2002 I don't see what you are trying to do in this script. From what I understand, it takes an unit/object/whatever as argument, and move it to the first object it encounters in the direction he is facing, 26.8 meters above ground. Why would you need publicVariable? Share this post Link to post Share on other sites
IntruderDZ 1 Posted November 8, 2002 that is just a snippet of the scripts. There is  at least 15 objects per script and in multiplayer it never runs correctly ever. All the object either never make it  get misaligned or other objects in the place of the intended ones are moved. It runs perfectly in single player as i said in the first post of this thread. But lag or something in the multiplayer F***'s! everything up. So someone said i need to use public variable to make it run correct for each player. Share this post Link to post Share on other sites
IntruderDZ 1 Posted November 9, 2002 "i will not fall till my legs go from underneath me i will stand strong" Share this post Link to post Share on other sites
IntruderDZ 1 Posted November 11, 2002 anybody there? ? Share this post Link to post Share on other sites
IntruderDZ 1 Posted November 11, 2002 ---------------- Share this post Link to post Share on other sites