Home   Help Search Login Register  

Author Topic: Why wont you give up god dam u (losing the emeny)  (Read 851 times)

0 Members and 1 Guest are viewing this topic.

CR_Elson

  • Guest
Why wont you give up god dam u (losing the emeny)
« on: 30 May 2005, 22:19:28 »
i have a script for for trackers hunting the player, but i need the trackers to give up if the player gets 2k away or if the player kills one of the trackers, ive tryed all that i know but they just wont give up lol , my script is below

Code: [Select]
_Player = _this select 0;
_Trackers = _this select 1;

#loop
_Trackers doMove getPos _Player
hint format["Distance away from the enemy %1 meters away",_player distance enemy1]
~15


? (alive Enemy1): goto "loop"

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Why wont you give up god dam u (losing the emeny)
« Reply #1 on: 30 May 2005, 22:33:35 »
the script looks fine so far, but needs a couple of additions - it would also help knowing what the variables are. is '_trackers' a group name, or just one unit's name?

create a local variable inside the loop to keep track of the distance.

Code: [Select]
_player = _this select 0
_trackers = _this select 1

#loop
_trackers domove getpos _player

_dist = _player distance leader _trackers

hint format ["Distance away from the enemy %1 meters away",_dist]
~15

? not (alive leader _trackers) or (_dist>2000):goto "exit"

goto "loop"

#exit

hint "You escaped! Well done!"

exit

that should work, depending on what '_trackers' refers to... ;)

CR_Elson

  • Guest
Re:Why wont you give up god dam u (losing the emeny)
« Reply #2 on: 30 May 2005, 22:42:09 »
_trackers is a group name

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Why wont you give up god dam u (losing the emeny)
« Reply #3 on: 30 May 2005, 22:48:33 »
in that case the script would read thus:

Code: [Select]
_player = _this select 0
_trackers = _this select 1

#loop
{_x domove getpos _player} foreach units _trackers

_dist = _player distance leader _trackers

hint format ["Distance away from the enemy %1 meters away",_dist]
~15

? not (alive leader _trackers) or (_dist>2000):goto "exit"

goto "loop"

#exit

hint "You escaped! Well done!"

exit

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Why wont you give up god dam u (losing the emeny)
« Reply #4 on: 30 May 2005, 22:51:31 »
Use the "move" command instead of "domove". It makes the whole group move, not a single unit.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!