OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: FiLL2d on 26 Jul 2006, 22:29:43
-
marker.sqs
_player = _this select 0
_playermarker = _this select 1
_playermarkerself = _this select 2
#Repeat
_playermarker setmarkerpos [getpos _player select 0, getpos _player select 1]
_playermarkerself setmarkerpos [getpos _player select 0, getpos _player select 1]
~1
goto "Repeat"
The script is excuted by...
[this,"marker1","marker2"] exec "marker.sqs"
The problem is _player means nothing after the unit is killed, so I've tried player aswell and that wierdly makes everyone elses markers assigned in their init to follow each player, eg. marker1 is ment to follow w1, and marker2 is ment to follow w2 although w1 will see all the markers follow him at the same time w2 will see all the markers follow him aswell. It seems JasonO has also got a similar problem in another recent thread in this forum. _player is local and player can't be used for all the units. Any one got a solution? apart from making loads of scripts and triggers specially for 1 unit, in this case I cant do that.
-
Well, a cheap fix would be to have a separate copy of the script for each player, and refer to the unit by global name. i.e.
marker1.sqs
if not (alive w1) then {exit}
_playermarker = _this select 0
_playermarkerself = _this select 1
#Repeat
_playermarker setmarkerpos (getpos w1)
_playermarkerself setmarkerpos (getpos w1)
~1
goto "Repeat"
marker2.sqs
if not (alive w2) then {exit}
_playermarker = _this select 0
_playermarkerself = _this select 1
#Repeat
_playermarker setmarkerpos (getpos w2)
_playermarkerself setmarkerpos (getpos w2)
~1
goto "Repeat"
And then in your init.sqs
["marker1","marker2"] exec "marker1.sqs"
["marker3","marker4"] exec "marker2.sqs"
.
.
.
It is not an elegant solution but it is a quick fix.
-
Is there an easy way for this so when the unit spawns the script starts running again without a trigger/script for each player?
-
hmm :( I would have 24 plus seperate scripts for respawn, i need to drop this down too one script :( theirs gotta be away at doing this ???
-
ok, managed to solve this by making _unit equal to a new player for each marker update.. seems to work a treat