OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: CR_Elson on 30 May 2005, 22:19:28

Title: Why wont you give up god dam u (losing the emeny)
Post by: CR_Elson 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"
Title: Re:Why wont you give up god dam u (losing the emeny)
Post by: bedges 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... ;)
Title: Re:Why wont you give up god dam u (losing the emeny)
Post by: CR_Elson on 30 May 2005, 22:42:09
_trackers is a group name
Title: Re:Why wont you give up god dam u (losing the emeny)
Post by: bedges 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
Title: Re:Why wont you give up god dam u (losing the emeny)
Post by: General Barron on 30 May 2005, 22:51:31
Use the "move" command instead of "domove". It makes the whole group move, not a single unit.