Home   Help Search Login Register  

Author Topic: Its random for each computer.  (Read 1530 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
Its random for each computer.
« 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.

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Its random for each computer.
« Reply #1 on: 01 Jun 2006, 20:51:39 »
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.
« Last Edit: 01 Jun 2006, 20:54:15 by Baddo »

Offline Flaber

  • Members
  • *
    • Escuadron 13th TigerSharks
Re: Its random for each computer.
« Reply #2 on: 02 Jun 2006, 01:44:35 »
an example of how to make that every computer has the same objective.

Code: [Select]

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


Offline 456820

  • Contributing Member
  • **
Re: Its random for each computer.
« Reply #3 on: 02 Jun 2006, 10:46:06 »
Thanks guys ill let you know how i get on.

Offline 456820

  • Contributing Member
  • **
Re: Its random for each computer.
« Reply #4 on: 04 Jun 2006, 14:47:48 »
Thanks alot solved.