Page 1 of 2

Commands?

Posted: Thu Sep 25, 2003 6:48 am
by Vic Marrow
What does the command line look like to make a enity walk bored or injured or walk alert like on patrol, you know where the guys head is moving like hes looking around etc.? I tried $para anim walk_bored_forward it didn't work. and whats the difference between "walkto" and "moveto"? Also what are the command lines for facial expressions? Thanks for your help guys I'm learning a lot! :)

Posted: Thu Sep 25, 2003 9:22 am
by bdbodger
I think most of the walking and running animations are handled by the anim/motionblend.scr . what you do is $myguy walkto $myspot the game chooses the right animation like rifle_walk_forward etc . The moveto command is usually for script objects such as doors or anything that moves without animations not usually for ai's . although the global/moveto.scr uses the syntax that is in the SDK

moveto( String anim, String dest )


Specify the location to move to, with animation anim.

Maybe study some of the level scripts from the game for examples .

Posted: Thu Sep 25, 2003 3:49 pm
by jv_map
Strictly the moveto command does nothing more than calculate a path from the AI to the destination, and stores the direction to go to as a normalized vector in the self.movedir variable. It also loops the script supplied as the anim parameter.

Basically walkto and runto are short for moveto anim/walk.scr and moveto anim/run.scr respectively.

I tried $para anim walk_bored_forward it didn't work

Instead, type:
$para setmotionanim walk_bored_forward

This command however may be overridden by any motion command from the current animscript (which is very annoying). Best is to use this line first:
$para animscript anim/continue_last_anim.scr

Or even loop the line like this:
while(isAlive $para)
{
$para animscript anim/continue_last_anim.scr
waitframe
}

To set a facial expression I think the setsay command is used.

Posted: Fri Sep 26, 2003 5:41 pm
by Vic Marrow
Ok I tried this:

Code: Select all

$para walkto $path4
$para setmotionanim walk_bored_forward 
while(isAlive $para) 
{ 
$para animscript anim/continue_last_anim.scr 
waitframe 
} 
$para waittill movedone
Now the para walks bored (Very cool head down, walks real slow like he all bumed out) But he just walks foward from the direction he is facing, until the wall stops him, when he hits the wall the bored walk anim keeps going How do I get him to go to his waypoint ($path4)?

waypoint

Posted: Fri Sep 26, 2003 6:29 pm
by tltrude
Is the waypoint behind the wall? Are there AI pathnodes he can use to go around the wall?

$para lookat $path4

That will make him face the waypoint. Or, is it:

$para turnto $path4

?

Posted: Fri Sep 26, 2003 7:59 pm
by Vic Marrow
No the waypoint is not behind the wall. It is to his direct left, So I guess it would be $para turnto $path4. It's like the command "$para walkto $path4" is completely ignored. $path4 is a info_waypoint. When I have just the walkto command he goes right to it.

Posted: Fri Sep 26, 2003 8:32 pm
by Vic Marrow
Making a little progress tried this:

Code: Select all

$para turnto $path4
$para walkto $path4
$para setmotionanim walk_bored_forward 
while(isAlive $para) 
{ 
$para animscript anim/continue_last_anim.scr 
waitframe 
} 
$para waittill movedone
$para turnto $path5
$para walkto $path5
$para waittill movedone

Now the para turns, does the bored walk to the waypoint ($path4) stops at the waypoint but he spins around and around while doing the bored walk animation. I have him directed to another way point but he won't go.

Posted: Sat Sep 27, 2003 5:50 am
by bdbodger
What I think you should do is this . First set the sight and hearing of the ai to 1 so that he does not react to you . Then set his mood

mood( String new_mood )


sets the AI mood... must be 'bored', 'nervous', 'curious', or 'alert'.

$para.sight = 1
$para.hearing = 1
$para mood "bored"
$para turnto $path4
$para walkto $path4
$para waittill movedone
$para turnto $path5
$para walkto $path5
$para waittill movedone

and/or have $path4 target $path5 and he will walk to both first 4 then 5

If you just want a ai to patrol a path select the ai in radiant then press i to bring up the ai paramaters window set the type Idle to patrol and on the right hand side in the box labled patrol path put the first node of the patrol path make sure the nodes are at least 360 or less units apart and the ai is standing beside the first node .

if

Posted: Sat Sep 27, 2003 6:35 am
by tltrude
what you need is to stop the while loop when he reaches the waypoint.

while($para.origin != $path4.origin)
{
$para animscript anim/continue_last_anim.scr
waitframe
}

You can also change his animation to STAND_BORED when he gets there--if you want him to hang around there awhile.

Posted: Sat Sep 27, 2003 7:02 am
by jv_map
For your specific needs try this:

Code: Select all

$para moveto anim/continue_last_anim.scr $path4
$para thread anim/motionblend.scr::start "walk_bored_"
local.thread = parm.previousthread
$para waittill movedone
local.thread delete
$para walkto NULL

Posted: Sat Sep 27, 2003 3:47 pm
by Vic Marrow
Tried what you said tltrude and got the same result. para did the bored walk (nice) to $path4 but when he gets there he spins around and around.

Tried what you said jv_map, para never moved and I got this error message in my console:

$para thread anim/motionblend.scr::start "walk_bored_" (maps/test_room.scr, 78)
$para^
^~^~^Script Error: ScriptMaster::CreateScriptThread: label 'start' does not exist in 'ainm/motionblend.scr'

I also tried 'exec' and 'setmotionanim' in place of 'start' but this didn't work either.

bdbodger I do have the patrol path method set up in radiant and it works great $para goes from $path1 to $path2 to $path3 Then I have him stop and have a conversation with another para ($para2) This is when I send him to $path4 if I use just the command 'walkto' theres no problem. I just want to see what other type walks he will do. What I'm trying to do is learn how to use different animations. I would like to be able to learn and use all the animations in moh.

Thanks guys for your help. This scripting stuff sure is hard and frustrating. If it was't for this web site I'd probley just uninstall radiant. But radiant sure is fun when things work out right.

Posted: Sun Sep 28, 2003 6:52 am
by bdbodger
try this I did a test map to see that it works

$para turnto $path4
while(vector_length ($para.origin - $path4.origin) > 64)
{
$para anim "walk_bored_forward"
$para waittill flaggedanimdone
}

$para exec global/stand.scr

edit: I changed it to flaggedanimdone

Posted: Sun Sep 28, 2003 7:24 am
by jv_map
$para thread anim/motionblend.scr::start "walk_bored_"

should be

$para thread anim/motionblend.scr::Start "walk_bored_"

:oops:

Posted: Sun Sep 28, 2003 4:32 pm
by Vic Marrow
I changed the line like you said jv_map and something strange happend. The para turned to $path4 he went into the crouched alert postion his legs didn't move but he floated across the the floor to the waypoint :shock: wow what a trip!!

I did what you said bdbodger and it worked!!!! :D Only thing is the para dosn't quite make it to $path4 just a little short but he does the walk, dosn't spin goes into idle stand (very cool) but he just stops short (not by much) of waypoint. The next waypoint is through a door way. So its important to make it all the way to $path4. I tried sending him to the next waypoint like this:

Code: Select all

$para turnto $path4 
while(vector_length ($para.origin - $path4.origin) > 64) 
{ 
$para anim "walk_bored_forward" 
$para waittill flaggedanimdone 
} 
$para exec global/stand.scr

$para turnto $path5 
while(vector_length ($para.origin - $path5.origin) > 64) 
{ 
$para anim "walk_bored_forward" 
$para waittill flaggedanimdone 
} 
$para exec global/stand.scr
He makes the turn to $path5 and starts walking bored again (perfect!) but because he didn't quite make it to $path4 when he gets to the door way he's not lined up right so the wall next to the door way stops him. Man we almost got it! We(I mean you!) Can you break down the code you made and explain it to me. If its to much trouble thats ok you don't have to (I want to learn not just copy and paste) Man you did it!!!!!!!!!!!!! Good job!!!!!! :D :D :D :D

I moved $path4 to compesate the distance that the para misses the door way by. And know he's lined up with the door way (the waypoint is not) He walks right through the door way to $path5 just stopping a little short just like $path4 (I wonder why?) But thats great! he does what I want, just have to play with the waypoints a little bit.

Posted: Mon Sep 29, 2003 5:39 pm
by bdbodger
it's not that hard
while(vector_length ($para.origin - $path4.origin) > 64)

vector_length is the length of the line between $para and $path4 so while that length is greater than 64 keep walking

You might try

while($para.origin != $path4.origin)

! is not so " != " is not equal

but the only thing is $para's origin has to exactly equal $path4's origin for it to work . In theory it should because he is walking toward it but you never know . Maybe change the 64 to something smaller if it doesn't work or move $path4 or put a pathnode in the doorway . One other thing you might want to add $para turnto null at the end of the thread .