Home   Help Search Login Register  

Author Topic: Possibly another simple answer...  (Read 832 times)

0 Members and 1 Guest are viewing this topic.

TC63

  • Guest
Possibly another simple answer...
« on: 01 Jun 2006, 13:06:47 »
God i been waiting for this site to come back up, god job!

i have a script that runs in a loop to simulate a car chase

"?player distance pc1 < 200: PC1 domove getpos player"

this means that pc1 will try to catch up with the player, its in a 5 second loop but unfortunately it doesnt strictly work as pc1 will frequently just slow down or be left behind really easily

Is there a way that i could use x y z values to position where pc1 has to move about 50 meters infront of the player, this way making pc1 try to overtake and block the road?

Also would it be posible to detect when the player has stopped, so that i could tell everyone in pc1 to disembark, but if player starts to move again then they will jump back on and resume the chase?

Any help would be greatly appreciated!

Thanks

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Possibly another simple answer...
« Reply #1 on: 01 Jun 2006, 13:37:46 »
try

Code: [Select]
_x = getpos (vehicle player) select 0
_y = getpos (vehicle player) select 1
_dir = getdir (vehicle player)

? (((vehicle player) distance pc1) >= 200): pc1 domove [_x + (50*sin(_dir)), _y + (50*cos(_dir))]


the way the code was, pc1 would only try to catch up if he was less than 200 metres from the player... :P

the code above will place the domove point 50 metres in front of the player. as for the getting in and getting out, that's a bit more complicated.

TC63

  • Guest
Re: Possibly another simple answer...
« Reply #2 on: 01 Jun 2006, 13:40:15 »
excellent, thanks you very much!

yes, it was supposed to be coded as such so that the player could 'lose' pc1, as there is also 6 more pcs, as they are police cars