AI command for front & center :)

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

AI command for front & center :)

Post by Grassy »

G'day all, I wonder if anyone can help me out here.
I have a routine where a nurse is called over to an injured player and passes an object, I would like her to stop about 100 units directly in front of the player. I have seen something that might be what I need ages ago but cant find it now.. And I have read the AI classes docs so many times and still cant find what I need... Here is what I am doing at the moment, but it's a bit dodgy at best.

Code: Select all

if (vector_length (local.player.origin - self.origin) >= 200)
 {
  // player is too far away so run over there
  wait 1
  self upperanim pass_canteen_start
  self waittill upperanimdone 	
  self runto (local.player.origin + (0 100 0))
  self waittill movedone
  self upperanim pass_canteen_end	
 }
Grassy
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Code: Select all

wait 1
relace with

Code: Select all

self waittill movedone
1 second aint a lot to let summat move very far.

also your telling it to have the guy start passing the canteen and move at the same time?

put your

Code: Select all

 self upperanim pass_canteen_start 
  self waittill upperanimdone 
:D

here

Code: Select all

self runto (local.player.origin + (0 100 0)) 
// RIGHT IN HERE! PUT ME HERE!
  self waittill movedone 
:wink:

also for full instructions on how to use the stock way of doing medics, use my tut here
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

If you click on my signature and go to my site you can download my Medicdance_JV_bot01.pk3 it is made to be used with bots but you can look at the global/medicdance.scr and see how I did it and maybe learn from it . Don't steal my work but have a look at it . Look at the medic_dispatch thread and especially the healplayer thread . The script does not use the bot scripting it just spawns the ai in the jv_bot01.pk3 . If you have jv_bot01.pk3 then you can run the test_heal map in my pak .
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

Thanks guys for the help,

All good info there but this is what I was looking for...
(local.player.origin + (local.player.forwardvector * -100))

Hey Bd, I read your script, man my head is still spinning :shock:
How long did it take you to write and debug that one??
There are some commands in there that I didn't know existed, haha
Oh and rest assured I wont pinch your code or ruotines, I would rather try to work it out for myslf (best way to learn)

Thanks again guys, what a great forum this is.
Grassy
Post Reply