Page 1 of 1

Get ai to follow a tank

Posted: Sun Nov 23, 2003 4:38 pm
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

Posted: Mon Nov 24, 2003 3:03 am
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

}

Posted: Mon Nov 24, 2003 4:44 am
by small_sumo
Wow that looks great I will try it staright away. Thanks

Posted: Mon Nov 24, 2003 5:53 am
by bdbodger
maybe change the waittill movedone to just wait 6 or whatever since the ai will probaly only choose crouchrunto the other way .