OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Doffen74 on 28 Jul 2005, 19:33:27
-
Hi. Long time since I've nagged anyone...
My problem of the day is that I have some markers in the editor that I script to disappear as the mission starts, and then reappear when certain triggers are triggered.
After reading Snypirs multiplayer editing guide I finally understand the local/server issues. Or so I thought! The markers only disappear on the machine I am using to both play and host the game. Never on the others.
If you can't tell me why, just give me a surefire way of making them disappear...
Thanks! ???
-
It might be a good idea to post also exactly where did you put the scripting commands to deal with the markers... like posting the init.sqs file if that's where you deal with the markers.
But.
I think you need to use the setMarkerType command so that it really is being executed on all computers in the session. Is it so?
Maybe something like this to init.sqs:
"myMarkersName" setMarkerType "empty"...and make sure you don't have a check like this:
?!local Server : exit
before the setMarkerType command (or anything similar which makes the setMarkerType command execute only on the server).
Also, when you need to show the marker again then you have to make sure that the setMarkerType command is executed on all computers in the session, not just on the server.
#EDIT:
Information about the locality of scripting commands can be found from:
http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=22956;start=30 (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=22956;start=30)
-
Thanks for the informative link! Sure gets complicated sometimes...
As for where I have tried to put the command: In the Init field of server object, the players units, a stand-alone civilian unit placed way out in the sea, in various scripts both local and server. You name it... Just not in the init.sqs file... I have done that now. But I'll have to wait until tomorrow to test it with more players.
If it works, then thanks alot! If not, well, I'll be back!
Doffen
-
markers and marker commands are local
this means that if you do something to them on 1 computer, only that computer see's the effect
to globalise this on all computers
simply have a trigger execute a script that sets them to empty or whatever else it is you need to do with them
when the trigger is activated, it is activated on all machines and therefore each machine will run the script locally
something like the following
lets say for instance that we want to start the mission with only west players seeing a marker called "Westbase"
but at some point in the mission, when east have received some intel, we then want to show the marker to all east and west but not resistance
Mission editor
create an empty marker called "westbase"
;; nobody can see this marker when the mission starts
create a gamelogic and name it "server"
NB>> gamelogics are only local to the server, and therefore if one is present in the mission, the use of
?(local server):
can be used to query if a computer is the server or not
NB>> when testing on a standalone pc, you are both
local server
and
local player
a dedicated server is only
local server
Init.sqs
?(side player == west):"westbase" setmarkertype "marker"
?(side player == west):"westbase" setmarkercolor "colorblue"
;; all machines run the init.sqs at the start of the mission, therefore in this case, any player who is on west will now be able to see a cross type "marker" colored blue
the mission then runs, until such a point has occured that we want to now show east the "westbasemarker" because for instance they have entered an area to meet up with a spy that has some intel for the
so a simple trigger
Activated by: East present
Set to: "once"
condition: this
On activation: [] exec "mymarkers.sqs"
mymarkers.sqs
hint "hello everybody"
;; every machine runs the script and prints a "hint message"
?(side player == resistance): exit
;;every machine that hasnt a resistance player will read the script this far
hint "hello everybody but resistance"
?(local server): exit
hint "hello everybody but resistance and the dedicated server or player test server"
;; If the machine isnt the server, it will read the script this far
hint "hello only east west and civilian players"
?(side player == east): "westbase" setmarkertype "marker"
?(side player == east):"westbase" setmarkercolor "colorred"
all east and west player computers will have read the script this far, but only east player computers will have switched the westbase marker to a red cross, the west players will still see the blue cross
exit
hope that helps you understand things a little better
BASICS
have a script run everywhere, both on players and the server
then use the following to control what reads the script and what exits etc
? (local server) : hint "if i am the server, i will display this message (even if i am also a player)"
? ! (local server) : hint "if i aint the server, i will display this message"
? (local player) : hint "if i am a player, i will display this message"
? ! (local player) : hint "if i am a dedicated server (eg not a player), i will display this message but nobody will see it"
-
I think I understand now. Will test it after work. If it works, there is only intro and briefing left before I can submit my first mission! (wich is probably something that will eliminate the rest of my selfesteem...)
If I have any new problems I will make a new thread. Thanks for the info guys!
Doffen74 8)