Download attachment
Animation
A lot of questions on the forums have been about specific scripting techniques. But I think the main thing everyone wanted to know, was how to get monsters to do what the mapper wanted them to do. I would like you to take the time to read the following before you go any further...
Q. Half-Life is full of scripts for most of the model class monsters, so why can't I get them to do what I want?
A. That is because the animation tools in Half-Life were designed to enhance the game they were never designed to give you total flexibility as a post game mapper!. Having said that, there are ways to get your monsters to do things and the idea of this tutorial is to get aquatinted with the basics, so you can get an understanding of how the
scripted_sequence and
aiscripted_sequence work. This guide is not written to enable you to make a brilliant, awe inspiring scripted event...
I am going to add to this tutorial as we go along, I will try to include things that people want, but I don't want to cover ground that has been done by other sites, and to that end I will list those web sites that are worth a look for more information on scripting.
The first part of this tutorial will be
Getting Barney [bob] to open a door. I have built a simple room with a glass divider and two doors. I have placed a Barney on one side of the glass and an
info_player_start on the other side of the glass. I have also added an
aiscripted_sequence close to the door. There is also another Barney [bill], but more about him later.
Object Properties NOTE: I have used an aiscripted_sequence because I like them. The main difference between a scripted_sequence and an aiscripted_sequence is that no matter what happens, the "aiscript" will continue to run. You cannot distract Barney from doing what the script has called him to do, even if you kill him he will complete the script and then die.
Ok, so what's with the settings?
Give your Barney a
Name (targetname). I called mine
bob You need a name so you can enter that as the
Target Monster in the scripted_sequence.
Set up a
trigger_once to trigger the
aiscripted_sequence. Set it's target as the name of your aiscripted_sequence [in this case
door_1_open].
The Door needs a
Name for the aiscripted_sequence to target so that when "bob" finishes performing his script, it will open.
The aiscripted_sequence for the opening door:
- Name : door_1_open "The target of the trigger_once to start the sequence".
- Target : door_1 "the name of your door" so that it opens at the end of the animation.
- Target Monster : bob "Barneys name".
- Action Animation : unlatch SEE BELOW:.
- Move to Position : Walk "You can select how you want "bob" to approach the point where the aiscripted_sequence is.
Angles
Armidillo came up with a good sugestion, mentioning the
Pitch Yaw Roll (Y Z X) settings of your aiscripted_sequence or scripted_sequence. These are important, you need the sequence to face in the direction that you want it to be performed. So in the example map, the scripted_sequence for the "security door" (not the one that opens) is set to 270 in the little compass, or 0 270 0 in the Pitch Yaw Roll (y Z X) property. The easiest way I have found to work out which way that really is, is to look at the
Top View (x/y) 2D view and have the compass pointing the way you want the script to be acted. It really is that simple. Some earlier versions of WorldCraft have trouble with the compass and so does Hammer 3.5. It pays to select another property and then check that the new compass bearing has been picked up by the property box in the
Pitch Yaw Roll (Y Z X) property. The Default is
0 0 0 which will leave the script acting to the left of the Hammer screen.
Ok, that is all you need to use for this example. There are other properties and Flags, but they are not needed for what we want to do.
Second Script
The second scripted_sequence is adjacent the security door. The settings are similar, but I have added in a multimanager and a trigger auto, so that "bob" will knock on the security door with the
flashlight animation until the door opening script is triggered. Because the multimanager is looped, bob will return to knocking on the security door after opening the inital door for you.
The multimanager in the example map has been looped [see SlayerA's
Multimanager tutorial for more information]. The only other settings that need to be added is the
Repeatable Flag. Without it, Barney [bob] will only knock on the door once, regardless of what his idle animation is. The scripted sequence needs to know that the animation can be repeated, and that is why we check the flag. Adding the same animation in the
idle animation field does not automatically mean that Barney will perform that animation once he has completed the
Action Animation... It works with some animations for some monsters and not others. That is why there is a second Barney [bill]. He is there to show you what it would look like without the multimanager and trigger_auto and repeatable flag.
Action Animation
An animation is a set function that the model will perform when it is called to do so. These animations are sometimes referred to as scripts. The best way to view the animations is with a model viewer like HLMV v1.25. You can cycle through each model and it's animations and then enter the name of the animation in the
Action Animation field. In the example map I have used
unlatch and
Flashlight but with the Barney model there are a few others you could try, like
buttonpush or intropush. Animations with "intro" before them are specific to a cut scene of the game, and sometimes require furniture or other prefabs to work correctly.
Just a few more things about scripted sequences, they should be triggered. That way you can control the sequence. If you add a
Name (Targetname) to an aiscripted_sequence or a scripted_sequence, the
Target Monster will still act on the animation when the map loads. You must add a trigger to get the sequence to run when you want it to run. Once they are triggered, whatever you put in their
Target field will be activated at the end of the script. You can enhance this with Multimanagers and that will give you timing and flexibility.
Barney So that is the start of this tutorial...
Not much is it? well it is a start. If you have set it up right, Barney will walk towards the security door and perform the
flashlight animation. If you move down the hallway you will trigger the door opening aiscripted sequence and Barney [bob] will stop his original animation and come over and open the door for you. He will then go back to hammering on the security door. Barney [bill] will knock once on the glass, and then stand around looking stupid.
I will add to this in the coming weeks, but while your waiting, head on over to 69th Vlatitude, the spawning tank, Collective or Planethalflife for more specific tutorials. A google search for Half-Life scripted sequences brings up a heap of sites, and a lot of them cover stuff like zombies breaking through doors, retinal scanners and general movement.
There are also some scripted example maps in the Map Vault under 'Example Maps' made by our members, check them out.. they are good.
As I said in the beginning, the animations were designed to enhance the gameplay, not to let you build what you wanted. Cool looking scripts that didn't appear in the game usually come from someone doing a lot of coding, model manipulation and stuff we don't really cover at TWHL,
unless one of the members has time to write the tutorial??.
Scientist Animations
Ok, Just to add a bit of volume to this tutorial and to give you an idea of what we are talking about, here is a list of all the available animations for the scientist model. Some of them are only applicable to dead scientists and others are used in conjunction with furniture/architecture, like the opening scenes. The idea of this list is to give you something to play with, try them out...
If you haven't viewed these sequences with HLMV or something similar, Then get with the program folks and get viewing!
Disclaimer: I have not actually run
all these animations through a scripted_sequence, but I have viewed them all with HLMV. Some of my previous testing indicated animations that looped, and others that didn't when you would expect them to be the other way around. Some of them just don't do what you would expect them to and some don't want to work at all but as I said before, they were not made so you could do cool animations and scripts... They are there for the original game.
Scripted sequences available:
- walk : Walks straight ahead.
- walk_scared : Similar to walk, but holds both arms in front of chest, shivering.
- run : Runs forward normally.
- run1 : Runs forward but holds both hands up in front of him, shaking his head like in 'No no no!!!' almost as though he is shaking something .
- run2 : Similar to run, but looking left/forward/left.
- 180_Left : Starts a left turn.
- 180_Right : Starts a right turn.
- flinch : Flinches, and steps back left, ducks and holds hands on head.
- flinch1 : Flinches and moves head backwards. Stands straight up, looks like he is headbanging.
- laflinch : Left arm is hit and pulled back.
- raflinch : Same as laflinch but right arm.
- llflinch : Hit in left leg, bends legs a little and reaches with left hand for left knee.
- rlflinch : Same as laflinch but right leg.
- idle1 : Just stands there, both arms straight down, breathing.
- idle3 : Stands and looks up then in front of him.
- idle4 : Same as idle3 but looks down.
- idle5 : Same as idle3 but looks right.
- idle6 : Same as idle3 but looks left.
- idle7 : Same as idle1 but bends legs a little one at a time.
- crouchstand : Starts crouched, hands on head and comes to stand.
- crouch_idle : The start of crouchstand.
- crouch_idle2 : Start of crouch_idle but looks up then goes back to crouch_idle.
- crouch_idle3 : Start of crouch_idle but moves elbows quickly. For some reason I have two crouch_idle3 in HLMV and they are slightly different.
- panic : Bends knees and elbows and cowers right.
- fear1 : Holds both fists in front of his face, screams, shakes fists rapidly and steps back.
- fear2 : Steps back, both arms in front of his face to avoid attacker, but looks like he is pulling on something.
- eye_wipe : Rubs his eyes with both hands.
- pull_needle : Uses left hand to pull needle from his coat pocket.
- return_needle : Puts the needle back in his coat pocket.
- giveshot : Uses needle at chest height.
- diesimple : Falls on back/left.
- dieforward : Shot, swings arms from left to right, head down and falls forward. remains dead.
- dieforward1 : Drops to the floor right/forward on right side, remains dead.
- diebackward : Is pushed back by the hit and falls on back. remains dead.
- headshot : Shot. Falls on back. remains dead.
- gutshot : Shot in stomach. collapses and drops to floor forward. remains dead.
- lying_on_back : Lying on back. Use with Dead Scientist.
- lying_on_stomach : Lying on stomach. remains dead.
- dead_sitting : Sitting on floor, back against the wall. remains dead.
- dead_table1 : Sitting down on the floor, left leg resting on something, like a low table. Back against the wall.
- dead_table2 : Lies with back on the floor, and left leg rests on a high table. Dead.
- dead_table3 : Lies with stomach and right leg and right arm and head on table. Left leg and left arm hang down. Dead.
- barnacled1 : Both hands move infront of his throat as if choking..
- barnacled2 : Hands on Barnacle, hangs in the air, legs moving quickly.
- barnacled3 : Arms move initially and legs moving less quickly.
- barnacled4 : End of barnacle sequence.
- console : Bent over console moving right hand.
- checktie : Adjusts tie.
- dryhands : Switches on blower and holds hands below it to dry them. Great for turning a wheel type sequence.
- tieshoe : Places right foot on furniture and ties his right shoe.
- whiteboard : Writes on the wall.
- studycart : Bends over,presses some buttons, stand upright and looks at his work.
- lean : Leans against furniture to look at something on it.
- pondering : Places left hand on chin and right hand under his left elbow.
- pondering2 : Looks up and looks from right to left, hands next to his body.
- pondering3 : Folds arms in front of his chest and looks straight ahead.
- buysoda : Pulls money from his pocket, puts it into furniture, waits and then slams the machine with right fist.
- yes : Nods head yes.
- no : Shakes head no.
- push_button : Reaches forward and pushes button at waist height with left hand.
- converse1 : Stands there and moves hands as though in conversation :-).
- converse2 : Nods yes, then shrugs.
- retina : Grabs the retinal scanner and looks in.
- talkleft : Stands straight up, looks forward, raises right hand and looks left.
- talkright : Same as talkleft, but moves hands more and looks right.
- deskidle : Leans on furniture with his right hand and looks at something and shakes head.
- coffee : Sitting, looks like he's reading a paper .
- francticbutton Standing, reaches up moves right arm.
- startle : Standing, looks right over shoulder quickly.
- sitlookleft : Sitting and looks left.
- sitlookright : Sitting and looks right.
- sitscared : Sitting, both arms work in front... doesn't look scared at all!.
- sitting2 : Sitting, looks at down then forward.
- sitting3 : Sitting and "types" in front.
- cprscientist : Does the full CPR routine, listens to chest, and pumps away.
- cprscientistrevive : Finishes the cprscientist script.
- cowering_in_corner : Sitting on floor shaking head.
- sstrugleidle : Sitting on floor hands above head moving legs.
- sstrugle : Sitting on floor, pushed backwards then struggles and tries to get back up.
- headcrabbed : Mmm, This has to be the weirdest animation amoungst the lot of them.
- c1a0_catwalkidle : Standing, arms slightly spread, and looks from left to right.
- c1a0_catwalk : Falls, grabs something, then falls again.
- ceiling_dangle : Pulled into vent by the hands and dragged along.
- ventpull1 : Right foot on wall, hands forward and then pulled into wall.
- ventpull2 : Dragged backwards by the feet.
- ventpullidle1 : Similar to ventpull1 but not pulled up.
- ventpullidle2 : Lies on the floor and left arm hangs down, the start of the ventpull sequence.
- sitidle : Sits on the floor, doing nothing.
- sitstand : Similar to sitidle, starts by sitting,looks up and stands up.
- keypad : Stands, and presses some buttons with right hand, at waist height, very similar to push_button2.
- panic1 : Ducks right and cowers.
- lookwindow : Standing, looking forward, hands at eye level as though he's looking trough bars.
- wave : Waves with right arm.
- pulldoor : Pulls on a locked door.
- beatdoor : Bangs right fist on wall/door.
- fallingloop : Hangs in air horizontal, moving arms and legs as though falling.
- crawlwindow : Hops and crawls onto higher level.
- dive_window : Dives forward, and up.
- locker_door : Pulls at a door.
- push_button2 : Seems to be pushing a button at waist height..push_button sequence?
- unlock_door : Places arms above his head, and then unlocks a doorlock.
- quicklook : Standing, looks around /above.
- handrailidle : Leans on a rail/gate, doing nothing, looks forward.
- handrail : Similar to handrailidle but looks at his right and stands up. Follows handrailidle.
- hanging_idle : Hangs with both hands, moving his legs.
- fall : Similar to hanging_idle but slips away and falls into the deep shaft. If you are using Hammer 3.5 you will get a box showing you the depth of the fall.
- scientist_get_pulled : Standing, is grabbed from behind, pulled back into a shaft and dies,
- hanging_idle2 : Similar to hanging_idle.
- fall_elevator : Similar to fall, but falls faster.
- scientist_idlewall : Knees bent looking left.
- ickyjump_sci : Weird.. sort of springboarded backwards into a shaft.
- haulscientist : Dead scientist being carried?.
- c1a4_wounded_idle : Sitting on floor, looks at hand.
- c1a4_dying_speech : Similar to c1a4_wounded_idle but looks up and talks a little then dies.
- tentacle_grab : I really don't know how you would incorperate this into a map....
- helicack : Reaches up, grabs and pulls arms to chest then dies.
- windive : Another leap through a window.
- scicrashidle : Hanging onto a rope or something and moving hips.
- scicrash : Flung aside to the right.
- onguard : Standing with shotgun looking left and right
- seeya : Follows onguard. Makes the arm actions as though he is shooting at something drops the gun and then picks it up again.
- rocketcrawl : On hands and knees looking left and right.
- portal : Would suit two consoles.
- gluonshow : Presses button on the left.
- crouch : Like crouch_idle3.
- kneel : Kneels down to look at something.
As you can see by that little list for the scientist, I am reluctant to spend the next two years checking every animation and writing them down. Lame.. sure is, So If you're really interested, you can find the rest of the scripts at :Planet Halflife, The Half-Life Workshop "Monsterscripts" by Otis. Or by checking the old Wavelength site for a text list by Spider.