OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Miek on 08 Jun 2003, 01:57:27

Title: Why do I get 2 of each object in co-op? (help)
Post by: Miek on 08 Jun 2003, 01:57:27
I'm pretty new to editing, and I've looked all over and can't find a straight answer to this question.

I'm trying to add a few more buildings to a little village to make it into a much bigger city, I've been doing this by putting:

house = "object_name" createVehicle getPos this; house setdir getdir this

in the 'init:' field of game logic units. (I got it from the "Resistance object names" tutorial by Girts).

Anyway, it worked perfect when I previewed the mission in the editor, but when I tried it out in co-op there were two of each building I had added, right next to each other.

I mean, it doubled the size of my city, but kind of annoying...

I'm gonna go out on a limb here ;) and guess it has something to do with the fact both machines are running the mission, either the host machine makes an object for each player, or each machine creates an object. Why is it doing this?

Am I just making some classic noob error? It feels like it. I'd appreciate some help anyway.

k thx.

- Miek
Title: Re:Why do I get 2 of each object in co-op? (help)
Post by: Zombie on 08 Jun 2003, 12:46:46
Never tried to add buildings that way, but do you have a game logic named server?  Putting that in saves many problems, might do the trick for you
Title: Re:Why do I get 2 of each object in co-op? (help)
Post by: Terox on 08 Jun 2003, 14:47:40
On the surface of it, it sounds like both the server and the client are adding buildings, hence 2 of each, So you simply need to

?!(local server):exit

I would create a script to add these buildings and then place the line above at the start of the script
or ?(local server):[]exec "addbuildings.sqs"

Activate the script from the init.sqs

Gamelogics are only present on a server

make sure you have a gamelogic called "server" somewhere on the map, doesnt matter where
Title: Re:Why do I get 2 of each object in co-op? (help)
Post by: Miek on 08 Jun 2003, 17:45:15
On the surface of it, it sounds like both the server and the client are adding buildings, hence 2 of each, So you simply need to

?!(local server):exit

I would create a script to add these buildings and then place the line above at the start of the script
or ?(local server):[]exec "addbuildings.sqs"

Activate the script from the init.sqs

Gamelogics are only present on a server

make sure you have a gamelogic called "server" somewhere on the map, doesnt matter where

Is it possible to do this without making a script, and if so where do I have to put
"?!(local server):exit"?