Post your scripting questions / solutions here
Moderator: Moderators
Vic Marrow
Colour Sergeant
Posts: 95 Joined: Wed Aug 20, 2003 2:31 pm
Post
by Vic Marrow » Tue Nov 18, 2003 6:58 pm
I made a script which uses most of the dog handler commands, I used your dogs. I added some animations to your dog script and the work good.
Now I run the script and it looks good. The dog and handler walk as if the dog is pulling on the leash and the handler is hanging on. It looks real cool! (I tried making a leash but coulden't. I coulden't get the leash to attach to the dog or handler. But thats another problem) The thing I need help with is when I kill the handler the dog goes into alert (the rest of the commands stop and thats good!) But when I kill the dog, the handler continues with the animations like the dog is still alive.(looks dumb. He releases a dog thats not there and hits a dog thats not there.)How can I make it so when the dog gets killed, the handler stops the commands and goes alert? Here' my script:
Code: Select all
$para item weapons/FG42.tik
$para unholster weapon
wait 20
$para thread para_follow $dog
$dog turnto $wp1
while(vector_length ($dog.origin - $wp1.origin) > 270)
{
$dog anim "unarmed__walk_leash_forward"
$dog waittill flaggedanimdone
}
if(isAlive $dog)
{
$para thread para_follow $dog
}
else
{
level.stoppara = 0
}
wait 2
level.stoppara = 0
$dog anim dog_leash_stop
$para anim handler_stop
wait .2
$dog turnto wp2
$para turnto wp2
wait 2
$para anim handler_release
wait .5
$dog runto wp2
wait 5
$para runto wp2
$para waittill movedone
$para lookat $dog
$para turnto $dog
wait .5
$para anim handler_discipline
$dog anim dog_discipline
wait 2
$para turnto $wp3
$para lookat NULL
wait 2
$dog runto $wp3
$para runto $wp3
end
para_follow local.dog:
println "para thread active "
self.destination = local.dog
self.distance = 5
self.waittime=1
self.friendrange = 0
self.runanimrate=1.35
level.stoppara =1
while ((isalive self)&&( isalive local.dog )&&(level.stoppara == 1 ))
{
if !(self.thinkstate==attack)
self waitthread follow_player local.dog
waitframe
}
println "Para 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 anim handler_walk self.destination.origin
local.handler_stop = 0
self waittill movedone
if !(self.destination)
self.destination = null
if (vector_length (self.destination.origin - self.origin) < self.distance + self.friendrange)
{
self anim handler_stop
}
}
end
////////////////////////////////////////////////////////////
movedone:
self.movedone = 0
self waittill movedone
self.movedone = parm.movedone
end
////////////////////////////////////////////////////////
Thanks for your help!
bdbodger
Moderator
Posts: 2596 Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:
Post
by bdbodger » Wed Nov 19, 2003 4:17 am
In the part of the script where the para_follow thread ends because the dog dies change $para's animation there instead so when level.stoppara = 0 the animations change and add some if statements for when things change .
Code: Select all
$para item weapons/FG42.tik
$para unholster weapon
wait 20
$para thread para_follow $dog
$dog turnto $wp1
while(vector_length ($dog.origin - $wp1.origin) > 270)
{
$dog anim "unarmed__walk_leash_forward"
$dog waittill flaggedanimdone
}
if(isAlive $dog)
{
$para thread para_follow $dog
}
else
{
level.stoppara = 0
}
wait 2
level.stoppara = 0
wait .2
$dog turnto wp2
$para turnto wp2
wait .5
$dog runto wp2
wait 5
$para runto wp2
$para waittill movedone
if(isalive $para)&&(isalive $dog)
{
$para lookat $dog
$para turnto $dog
wait .5
$para anim handler_discipline
$dog anim dog_discipline
}
wait 2
$para turnto $wp3
$para lookat NULL
wait 2
$dog runto $wp3
$para runto $wp3
end
para_follow local.dog:
println "para thread active "
self.destination = local.dog
self.distance = 5
self.waittime=1
self.friendrange = 0
self.runanimrate=1.35
level.stoppara =1
while ((isalive self)&&( isalive local.dog )&&(level.stoppara == 1 ))
{
if !(self.thinkstate==attack)
self waitthread follow_player local.dog
waitframe
}
println "Para thread ending"
$dog anim dog_leash_stop
$para anim handler_stop
wait 2
if (isalive $dog)
{
$para anim handler_release
$para waittill flaggedanimdone
}
$para anim idle
$dog anim idle
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 anim handler_walk self.destination.origin
local.handler_stop = 0
self waittill movedone
if !(self.destination)
self.destination = null
if (vector_length (self.destination.origin - self.origin) < self.distance + self.friendrange)
{
self anim handler_stop
}
}
end
////////////////////////////////////////////////////////////
movedone:
self.movedone = 0
self waittill movedone
self.movedone = parm.movedone
end
Vic Marrow
Colour Sergeant
Posts: 95 Joined: Wed Aug 20, 2003 2:31 pm
Post
by Vic Marrow » Wed Nov 19, 2003 4:21 pm
I tried your script changes and it kind of put some things out of sequence. So I played with the script some more, adding some if statements like you said and I got it to work perfect!
Like this:
Code: Select all
$para item weapons/FG42.tik
$para unholster weapon
wait 20
$para thread para_follow $dog
$dog turnto $wp1
while(vector_length ($dog.origin - $wp1.origin) > 270)
{
$dog anim "unarmed__walk_leash_forward"
$dog waittill flaggedanimdone
}
wait 2
level.stoppara = 0
$dog anim dog_leash_stop
$para anim handler_stop
wait .2
$dog turnto wp2
$para turnto wp2
wait 2
if(isAlive $dog)
{
$para anim handler_release
wait .5
$dog runto wp2
wait 5
$para runto wp2
$para waittill movedone
$para lookat $dog
$para turnto $dog
wait .5
}
if(isAlive $dog)
{
$para anim handler_discipline
$dog anim dog_discipline
wait 2
$para turnto $wp3
$para lookat NULL
wait 2
$dog runto $wp3
$para runto $wp3
}
else
{
$para attackplayer
}
end
para_follow local.dog:
println "para thread active "
self.destination = local.dog
self.distance = 5
self.waittime=1
self.friendrange = 0
self.runanimrate=1.35
level.stoppara =1
while ((isalive self)&&( isalive local.dog )&&(level.stoppara == 1 ))
{
if !(self.thinkstate==attack)
self waitthread follow_player local.dog
waitframe
}
println "Para 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 anim handler_walk self.destination.origin
local.handler_stop = 0
self waittill movedone
if !(self.destination)
self.destination = null
if (vector_length (self.destination.origin - self.origin) < self.distance + self.friendrange)
{
self anim handler_stop
}
}
end
////////////////////////////////////////////////////////////
movedone:
self.movedone = 0
self waittill movedone
self.movedone = parm.movedone
end
////////////////////////////////////////////////////////
Now I will try to make a leash work. But I don't think it's possible. I think you might have to make a model in milkshape or something. Because the leash needs tags called out in order to attach it. Even without the leash the animations look cool!!!! I wonder why they didn't use these dog handler animations in moh. It's kind of cool how the dog looks like he's on the trail of something and then the handler releases him, like he's saying "Go get him boy"
Thanks for responding so fast bdbodger, and thanks for your dog.tik oh and don't forget your follow thread. It makes the dog so easy to work with.