Home   Help Search Login Register  

Author Topic: Randomness, clients and init.sqs  (Read 1320 times)

0 Members and 1 Guest are viewing this topic.

Oakstar

  • Guest
Randomness, clients and init.sqs
« on: 10 Oct 2003, 12:27:36 »
I've made a Init.sqs that creates random:
Startposition, objective, time of day and weather. Then moves
all players, enemys etc to the correct positions.
A random mission generator.

It works perfect when I play alone, but in multiplayer,
all clients gets different random start, objective, markers etc
Even the weather and time of day is different!

I have tried the ?(Local server) command to not randomise values on the clients,
but they don't get any info at all now, and are not moved to their startpos.

I also tried to execute the script using a initfield of a soldier(Not named init.sqs then).


Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Randomness, clients and init.sqs
« Reply #1 on: 10 Oct 2003, 14:41:01 »
You should take care about following aspects here:

- init.sqs is executed by server and clients

- only boolean and numeric variables, group/object-names can be transferred by publicVariable

- if you use publicVariable, to transmit anything from anywhere
to anywhere else, you should add a time-delay, before using
the transmitted data.

- ?(local Server) requires an only serverside available object
on the map (like a gamelogic), called: Server

- setMarkerPos does only happen where it's been executed
(just in case you do setmarkerpos some markers only on
serverside)


Now the logical order how your init.sqs should look like

<<init.sqs>>

global stuff here
wait_server = false

?!(local Server): goto "wait_client"

create your random values here
....
let's say: blabla1 = random 75
blabla2 = random 80
blabla3 = blabla1 / blabla2 * 3.141592763 - 9
....
"publicVariable {_x}" forEach [blabla1,blabla2,blabla3]
~1
wait_server = true
~0.1
publicVariable "wait_server"

#wait_client
@wait_server

use your random values here and
it should be equal to everyone
let's say: sheep1 setpos [blabla1,blabla2]
sheep2 setdammage blabla3
etc.

that should do it

hope this helps a bit

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Oakstar

  • Guest
Re:Randomness, clients and init.sqs
« Reply #2 on: 10 Oct 2003, 22:56:40 »
Thanks, it was very helpful.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:Randomness, clients and init.sqs
« Reply #3 on: 13 Jan 2004, 15:14:36 »
do you have a demo of this i could look at please as it sounds intresting