Get ai to follow a tank

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Get ai to follow a tank

Post by small_sumo »

Can I script spawners or ai to follow a tank and keep inside a certain random range? My tank will follow a path and I want the ai to follow, maybe even crouch now and again so they look better.


Thanks
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

There is a command tether that is suppose to tether an ai's leash to an entity . I think I tried it once don't know if I got it to work or not . You might try glueing or binding or attaching a script origin to the tank and have the ai run to it like this .

$myorigin glue $tank
// or
$myorigin bind $tank
// or
$tank attachturretslot 0 $myorigin // I think you can have two things attached at once

while ( isalive $myai )
{

while( vector_length ( $myai.origin - $myorigin.origin ) < 128)
{

if ( vector_length ( $myai.origin - $myorigin.origin ) < 512 )
$myai exec global/crouchrunto.scr $myorigin
else
$myai exec global/runto.scr $myorigin

$myai waittill movedone

}

$myai exec global/stand.scr
waitframe

}
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Wow that looks great I will try it staright away. Thanks
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

maybe change the waittill movedone to just wait 6 or whatever since the ai will probaly only choose crouchrunto the other way .
Post Reply