Home   Help Search Login Register  

Author Topic: Elimination  (Read 731 times)

0 Members and 1 Guest are viewing this topic.

fragger

  • Guest
Elimination
« on: 29 Aug 2003, 20:32:43 »
i wanna hav an ai soldier keep trying to kill the player and know where he is in the world, and not search everywhere for him. IS there a way of letting the soldier know where the player is all the time and head in that direction?

GrimMonkey

  • Guest
Re:Elimination
« Reply #1 on: 29 Aug 2003, 20:39:03 »

SheepOnMintSauce

  • Guest
Re:Elimination
« Reply #2 on: 29 Aug 2003, 20:48:21 »
Yep.  ;D

Try naming the enemy, and the player then in the player's 'init' field put
Code: [Select]
enemy dofollow player Enemy being the name you called the enemy, and player being the name you called the player. He should follow your player about now. :)

fragger

  • Guest
Re:Elimination
« Reply #3 on: 30 Aug 2003, 19:22:16 »
Brill!  :D its working! thx for the help!
there is one mor question... iv done it so the killer is on a motorbike and id like it so that he gets off when hes near u and gets back on when ur not  close. is this possible?

SheepOnMintSauce

  • Guest
Re:Elimination
« Reply #4 on: 30 Aug 2003, 21:53:44 »
Try this script

Code: [Select]
;Following script.

_player = _this select 0
_enemy = _this select 1
_bike = _this select 2

#loop
_enemy assignasdriver _bike
?(_enemy distance _player > 50) && !(_enemy in _bike) : [_enemy] ordergetin true
?(_enemy distance _player <= 50) && (_enemy in _bike) && ((speed _bike) > 2) : _bike setVelocity [0,0,0]
?(_enemy distance _player <= 50) && (_enemy in _bike) && ((speed _bike) < 0) : _enemy action ["getout",vehicle _enemy]
~0.1
_enemy domove (getpos _player)
goto "loop"

Save it as 'follow.sqs' and put it in your mission folder. To execute it you'll need to put
Code: [Select]
[NameOfPlayer,NameOfEnemy,NameOfBike] exec "follow.sqs"
in the 'init' field of your player. It kind of worked for me, but with a few glitches the enemy will move to you, get off when 50 meters away, if you move away he'll remount the bike a little while after, but after that I can't get him to move to you again. He just stays there. If you can figure out how to make him move to you after that, then tell me, I could use the info.  :)

fragger

  • Guest
Re:Elimination
« Reply #5 on: 31 Aug 2003, 13:09:03 »
 ;D its working!!!
this is the finished script
Code: [Select]

_player = _this select 0
_enemy = _this select 1
_bike = _this select 2

#loop
_enemy assignasdriver _bike
?(_enemy distance _player > 80) && !(_enemy in _bike) : [_enemy] ordergetin true
?(_enemy distance _player <= 30) && (_enemy in _bike) && ((speed _bike) > 2) : _bike setVelocity [0,0,0]
?(_enemy distance _player <= 30) && (_enemy in _bike) : goto "command"
~5
_enemy domove (getpos _player)
goto "loop"
#hunter
_enemy domove (getpos _player)
_enemy doTarget _player
~2
?(_enemy distance _player > 80) : goto "loop"
goto "hunter"
#command
_enemy action ["EJECT", bike]
Unassignvehicle (_enemy)
~1
goto "hunter"
When the enemy is near he gets off and runs towards u gun blazing!
When u run away too far he gets back on his bike and roars after u.   8)
thx for all the help!  :)

SheepOnMintSauce

  • Guest
Re:Elimination
« Reply #6 on: 31 Aug 2003, 17:39:48 »
Ah great stuff. Well done!  ;D