Jump to content
Sign in to follow this  
strango

Changing positions of objects/markers

Recommended Posts

I've got a mission that works perfectly in the editor, but when running it on a dedicated server only certain parts are working. The first script moves both teams respawns, spawn control, flag pole, flag pole marker and ammo crates to a new location whenever the script is called. The server will move the spawn control and flag pole, but will not move the spawn areas or the marker for the flag pole. Here is the code for the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local Server): exit

;;Detect present location of the flag_pole

?(Pos == 1): goto "Area1"

?(Pos == 2): goto "Area2"

?(Pos == 3): goto "Area3"

?(Pos == 4): goto "Area4"

?(Pos == 5): goto "Area5"

;**********************************************

#Area1

;;Flag held at 1, Move to 2

;;Move Flag stuff to New Positions

Flag_Pole SetPos (GetPos Flag_2)

"Flag_Marker" SetMarkerPos (GetPos Flag_2)

;;Move Spawn's to New Positions

"Respawn_West" SetMarkerPos (GetPos Spawn_1)

wsfz SetPos (GetPos Spawn_1)

"Respawn_East" SetMarkerPos (GetPos Spawn_3)

esfz SetPos (GetPos Spawn_3)

;;Move Ammo Crates to their New Positions

Ammo_West SetPos (GetPos Ammo_1)

Ammo_East SetPos (GetPos Ammo_3)

Ammo_Mid SetPos (GetPos Ammo_2)

;;Reset Flag for new location

Flag_Pole setFlagTexture "white.jpg"

Flag_Pole SetFlagSide resistance

"Flag_Marker" setMarkerColor "ColorBLUE"

Holder = 0

Pos = 2

goto "End"

;**********************************************

#Area2

;;Flag held at 2, Move to 3

;;Move Flag stuff to New Positions

Flag_Pole SetPos (GetPos Flag_3)

"Flag_Marker" SetMarkerPos (GetPos Flag_3)

;;Move Spawn's to New Positions

"Respawn_West" SetMarkerPos (GetPos Spawn_2)

wsfz SetPos (GetPos Spawn_2)

"Respawn_East" SetMarkerPos (GetPos Spawn_4)

esfz SetPos (GetPos Spawn_4)

;;Move Ammo Crates to their New Positions

Ammo_West SetPos (GetPos Ammo_2)

Ammo_East SetPos (GetPos Ammo_4)

Ammo_Mid SetPos (GetPos Ammo_3)

;;Reset Flag for new location

Flag_Pole setFlagTexture "white.jpg"

Flag_Pole SetFlagSide resistance

"Flag_Marker" setMarkerColor "ColorBLUE"

Holder = 0

Pos = 3

goto "End"

;**********************************************

#Area3

;;Flag held at 3, Move to 4

;;Move Flag stuff to New Positions

Flag_Pole SetPos (GetPos Flag_4)

"Flag_Marker" SetMarkerPos (GetPos Flag_4)

;;Move Spawn's to New Positions

"Respawn_West" SetMarkerPos (GetPos Spawn_3)

wsfz SetPos (GetPos Spawn_3)

"Respawn_East" SetMarkerPos (GetPos Spawn_5)

esfz SetPos (GetPos Spawn_5)

;;Move Ammo Crates to their New Positions

Ammo_West SetPos (GetPos Ammo_3)

Ammo_East SetPos (GetPos Ammo_5)

Ammo_Mid SetPos (GetPos Ammo_4)

;;Reset Flag for new location

Flag_Pole setFlagTexture "white.jpg"

Flag_Pole SetFlagSide resistance

"Flag_Marker" setMarkerColor "ColorBLUE"

Holder = 0

Pos = 4

goto "End"

;**********************************************

#Area4

;;Flag held at 4, Move to 5

;;Move Flag stuff to New Positions

Flag_Pole SetPos (GetPos Flag_5)

"Flag_Marker" SetMarkerPos (GetPos Flag_5)

;;Move Spawn's to New Positions

"Respawn_West" SetMarkerPos (GetPos Spawn_4)

wsfz SetPos (GetPos Spawn_4)

"Respawn_East" SetMarkerPos (GetPos Spawn_5)

esfz SetPos (GetPos Spawn_5)

;;Move Ammo Crates to their New Positions

Ammo_West SetPos (GetPos Ammo_4)

Ammo_East SetPos (GetPos Ammo_5)

Ammo_Mid SetPos (GetPos Ammo_Temp)

;;Reset Flag for new location

Flag_Pole setFlagTexture "white.jpg"

Flag_Pole SetFlagSide resistance

"Flag_Marker" setMarkerColor "ColorBLUE"

Holder = 0

Pos = 5

goto "End"

;**********************************************

#Area5

;;Flag has been taken by West, End Game

TrueEnd1=true; publicVariable "TrueEnd1"

#End

Exit

Can anyone see anything wrong in here that would not let this work on a dedicated server. I'm pretty new to OFP scripting and not very knowledgeable on what commands need to be run only on the server and which need to be run on the server and the client.

Share this post


Link to post
Share on other sites

For markers you must update markers on each of the clients.

For the ammo boxes (or objects in general) you need to move them on the server. Er atleast thats the why I do it.

Hoz

Share this post


Link to post
Share on other sites

I changed the script to the way you mentioned where clients & server move the markers and just the server on objects.

Now it works inconsistently, sometimes it works and sometimes it doesn't. It is also inconsistent between the players on the server. For some of the guys the markers move and others they don't. The objects seem to always move for everyone though.

Is this just lag/dsync in the netcode causing it or something else?

Share this post


Link to post
Share on other sites

Every once and a while i find my marker scripts get out of wack I just blame it on lag. biggrin_o.gif

Doesn't happen when I'm playing on the lan only.

Hoz

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×