Home   Help Search Login Register  

Author Topic: police chase  (Read 532 times)

0 Members and 1 Guest are viewing this topic.

j-man

  • Guest
police chase
« on: 26 Feb 2005, 04:50:57 »
I'm trying to create a mission where your chased by the cops. I can get the cops to chase the player, but when they get about 5m from the player, they slow down and are never able to catch up. Also, when the player stops, the cops just stop 2m behind the player. Is there a way to make the AI police chase the player until they either hit him or get up right behind him?  ???

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:police chase
« Reply #1 on: 26 Feb 2005, 08:04:27 »
You don't say what you are doing to tell the cops to chase the player.  

If the cops don't have any waypoints then have a script that loops every couple of seconds giving the cops a doMove command to the position of the player:

cops doMove getPos player

If the cops do have waypoints then instead of a doMve the script could move the appropriate waypoint to the position of the player:

[cops, (waypoint number+1)] setWPPos getPos player
« Last Edit: 26 Feb 2005, 08:14:53 by THobson »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:police chase
« Reply #2 on: 26 Feb 2005, 11:10:32 »
2m is about as close as two units are going to get, voluntarily.   The collision prevention routines will kick in to stop them getting any closer.    

Not much you can do about that except use setVelocity commands which, even combined with switchmoves, are not going to look very good in this circumstance.   (And I've just had a sudden thought that setVelocity doesn't work with soldiers in contact with the ground ... not sure)

Remember that the player unit can run faster than AI units.
« Last Edit: 26 Feb 2005, 11:11:12 by macguba »
Plenty of reviewed ArmA missions for you to play

j-man

  • Guest
Re:police chase
« Reply #3 on: 26 Feb 2005, 20:15:58 »
I was originally using:
Code: [Select]
cop1 domove (getpos player) in a script that was constantly looping.

I'll try playing around with the setVelocity command to see if I can get something that works.

Thanks for the info people :)
« Last Edit: 26 Feb 2005, 20:16:21 by j-man »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:police chase
« Reply #4 on: 27 Feb 2005, 09:10:24 »
I have used some code in which the waypoints of a group are moved to the location of the player and I did find soldiers bumping into me.