Posted: Sat Oct 18, 2003 12:31 pm
Yes!!!!!!!! this worked bdbodger. Thanks for all your help (and your dogs). You should teach a class on scripting.

Code: Select all
$dog thread dog_follow $para //This starts the thread
level.script = patrol_path.scr
$para exec global/patrol_path.scr::patrol $path4 //This moves the para
$para waittill movedone
$para exec global/patrol_path.scr::patrol $path5 //This moves the para
$para waittill movedone
level.stopdog = 0 //This stops the thread
$dog walkto $dp2 //New command for dog to go to different waypoint
$dog waittill movedone
$dog anim dog_rest // Makes dog lay down
wait 2
$dog animscript "anim/continue_last_anim.scr" // Keeps dog downCode: Select all
dog_follow local.para:
println "dog thread active "
self.destination = local.para // My ai's targetname
self.distance = 20
self.waittime=1
self.friendrange = 20
level.stopdog =1 //Keeps thread running. = 0 stops it.
while ((isalive self)&&( isalive local.para )&&(level.stopdog == 1 ))
{
if !(self.thinkstate==attack)
self waitthread follow_player local.para
waitframe
}
println "Dog thread ending"
end
follow_player local.followed:
self.destination = local.followed
local.movethread = -1
self.movedoneradius = self.distance
if (vector_length (self.destination.origin - self.origin) > self.distance + self.friendrange)
{
self walkto self.destination.origin //walkto was runto
local.stand = 0
self waittill movedone
if !(self.destination)
self.destination = null
if (vector_length (self.destination.origin - self.origin) < self.distance + self.friendrange)
{
self exec global/stand.scr
}
}
else
{
if (local.stand == 0)
{
self exec global/stand.scr
local.stand = 1
}
wait 1
}
if (vector_length (self.destination.origin - self.origin) > self.distance + self.friendrange)
{
self walkto self.destination.origin // Was runto
local.stand = 0
thread movedone
local.movethread = parm.previousthread
}
if ((local.movethread != -1) && (local.movethread != NIL))
local.movethread delete
local.dest = self.destination.origin
local.runnertime = level.time + 2
while (((self.movedone == 0) && (vector_length (local.dest - self.origin) > (self.distance + self.friendrange))) && (local.runnertime > level.time))
{
if (self.waittime == -1)
waitframe
else
wait self.waittime
}
end
////////////////////////////////////////////////////////////
movedone:
self.movedone = 0
self waittill movedone
self.movedone = parm.movedone
end
//////////////////////////////////////////////////////go at the top of the script where you havelevel.stopdog =1 //Makes thread stop
while ((isalive self)&&( isalive local.dogguy )&&(level.stopdog == 1 ))
change the while statement at the top towhile ((isalive self)&&( isalive local.para ))
{
level.stopdog =1 //Makes thread stop
while ((isalive self)&&( isalive local.para )&&(level.stopdog == 1 ))