OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: 456820 on 01 Jun 2006, 20:23:18
-
Ive been giving a go at MP editing recently but have ran into a problem, ive made a random script which is to chose a random objective, the script works fine in SP but when you get to MP it creates a random objective for each clients computer, meaning nothing really works.
Is there anyway to make it only chose it for one computer so that objective is active for everyone?
Cheers.
-
You need to do the randomizing bit first only in the server (Actually it doesn't matter if it's the server or one of the clients, just that make randomizing only on one computer. But make it in the server so it follows the way how it is usually done by people.), then inform the clients of the results with publicVariable and make them all put the result into use.
I'll not give you a script but give you hints: you can make it in a single script where clients are forced to wait until the server has done the randomizing stuff, then make the server publicVariable the result to others, have a delay to ensure all got the result properly and then make them do the stuff.
Also, to check which computer is the server: throw in a game logic (or use an existing one if you already got one in there) and check if it is local. Game logics are local to server only.
-
an example of how to make that every computer has the same objective.
aux = -1;
?!(local server) : goto "wait"
aux = 1
objective = random 2
publicvariable "objective"
publicvariable "aux"
#wait
@(aux != -1)
?objective > 1: [] exec {script1.sqs} ;
?objective <= 1: [] exec {script2.sqs} ;
exit
-
Thanks guys ill let you know how i get on.
-
Thanks alot solved.