OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Ducatisto on 24 Mar 2004, 08:46:22
-
I am interested in a script but in its instructions even though it says it is MP compatible it should only be run from the server? Please could someone educate on old fool, I am new to the editing side of things and I want to make as good an example as I can regarding an MP mission I am currently creating. :-\
-
to make sure a line or a command is run only by the server
1) Create a game logic, and in it's "name Box", type
Server
then use the following line at the very top of the script
? !(local server):exit
which translates as
"If this machine is not the server, then exit"
or if starting the script from the Init.sqs
? (local server):[] exec "myscript.sqs"
(If this machine is the server, then run "myscript.sqs")
reason being, that gamelogics are only seen as local to the server machine, therefore, a gamelogic named server can only be local to the server machine
any name would do, however, normal protocol is to name the gamelogic "server"
other options are to use the query in a script line
eg
;;myscript.sqs
line 1 do this
line 2 do this
?(local server): myvariable = myvariable + 1; Publicvariable "Myvariable"
line 3 will be run by the server only
the statement "local", basically means is the object i am referring too, local on this machine.
Things that arent local on a server are normally only Players
-
1. Put a game logic on the map named server
2. In your script you only want run on the server side, put the line:
?!(local server): exit
Honestly I don't completely understand what this does, but I know it solves a multitude of problems, especially with vehicle respawning.
-
Many thanks. :)
Slowly, very slowly my understanding of scripting is increasing.
(http://www.volny.cz/oldgrandad/smilies/tup.gif)
-
Vehicle respawns and controling the scoring system need to be run by the server only
If they arent, you get multiple instances of the same vehicle being created or multiple verions of the scoring system and other oddities