OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Willm on 22 Dec 2004, 15:19:46

Title: How to make a marker that traces player-controlled units in MP with respawning
Post by: Willm on 22 Dec 2004, 15:19:46
Hi,

I'd like make markers that trace all units that are controlled by players in multiplayer with respawning.
I'm not good at scripting and that why I need help.
I've have tried the following script:

;// parameter: [unit,markername,updatetime] exec "Unittracer.sqs"
_unit =         _this select 0
_marker =       _this select 1
_updatetime =   _this select 2

#loopbegin
_unitposition = getpos _unit
_marker setmarkerpos _unitposition
~_updatetime
goto "loopbegin"

exit

When I type *this* as the unit-parameter, it works but if the unit gets killed, the marker will disappear. This is logical to me, I understand.
When I type *player* as the unit-parameter, it doesn't work because it's a multiplayer game, there are more players. This is also logical to me.

Now I don't know what to do or how to solve this problem.
Can anyone help me or link me to some topics that might help?

Thaking you in advance,

Willm
Title: Re:How to make a marker that traces player-controlled units in MP with respawnin
Post by: Zombie on 22 Dec 2004, 16:07:46
I won't begin to tell you I completely understand this script...but I do know it works, and it does what you are asking.  Call the script in the init.sqs

script by {USI}_RFox7
Code: [Select]
_wMarkers = ["wMark1","wMark2","wMark3","wMark4","wMark5","wMark6","wMark7","wMark8","wMark9","wMark10"]
_eMarkers = ["eMark1","eMark2","eMark3","eMark4","eMark5","eMark6","eMark7","eMark8","eMark9","eMark10"]


#MarkerTracker
_markerType = "MARKER"

?(SIDE Player == WEST) : _markerList = _wMarkers; Goto "TrackW"
?(SIDE Player == EAST) : _markerList = _eMarkers; Goto "TrackE"

Exit


#TrackW

_x = 0

#TrackLoopW
~.01
_list = [aP1,aP2,aP3,aP4,aP5,aP6,aP7,aP8,aP9,aP10]

_unit = _list Select _x
_marker = _markerList Select _x

?(Alive _unit) : Goto "MPosW"

_marker SetMarkerType "EMPTY"
Goto "SkipW"

#MPosW
(_marker) SetMarkerType _markerType
(_marker) SetMarkerPos GetPos _unit

#SkipW
_x = _x + 1

?(_x > Count _markerList) : _x = 0

Goto "TrackLoopW"

#TrackE

_x = 0

#TrackLoopE
~.01
_list = [bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,bp9,bp10]

_unit = _list Select _x
_marker = _markerList Select _x

?(Alive _unit) : Goto "MPosE"

_marker SetMarkerType "EMPTY"
Goto "SkipE"

#MPosE
(_marker) SetMarkerType _markerType
(_marker) SetMarkerPos GetPos _unit

#SkipE
_x = _x + 1

?(_x > Count _markerList) : _x = 0

Goto "TrackLoopE"

Title: Re:How to make a marker that traces player-controlled units in MP with respawnin
Post by: Willm on 22 Dec 2004, 23:51:45
Thanks! It works great!
Title: Re:How to make a marker that traces player-controlled units in MP with respawnin
Post by: Zombie on 23 Dec 2004, 15:04:01
 ;D