Home   Help Search Login Register  

Author Topic: markers following player.  (Read 1641 times)

0 Members and 1 Guest are viewing this topic.

Offline FiLL2d

  • Members
  • *
  • X.x
markers following player.
« on: 26 Jul 2006, 22:29:43 »
marker.sqs
Code: [Select]
_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...
Code: [Select]
[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.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: markers following player.
« Reply #1 on: 27 Jul 2006, 00:20:32 »
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
Code: [Select]
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
Code: [Select]
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
Code: [Select]
["marker1","marker2"] exec "marker1.sqs"
["marker3","marker4"] exec "marker2.sqs"
.
.
.


It is not an elegant solution but it is a quick fix.
« Last Edit: 27 Jul 2006, 00:23:27 by Mr.Peanut »
urp!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: markers following player.
« Reply #2 on: 27 Jul 2006, 00:31:15 »
Is there an easy way for this so when the unit spawns the script starts running again without a trigger/script for each player?

Offline FiLL2d

  • Members
  • *
  • X.x
Re: markers following player.
« Reply #3 on: 27 Jul 2006, 00:51:23 »
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  ???

Offline FiLL2d

  • Members
  • *
  • X.x
Re: markers following player.
« Reply #4 on: 27 Jul 2006, 03:57:56 »
ok, managed to solve this by making _unit equal to a new player for each marker update.. seems to work a treat