Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Sitting Npc

From HalfLife 2 Knowledge Base

Jump to: navigation, search

by Nutcrackr

Contents

Intro

I created this tutorial after looking for various tutorials on the subject, the best help I got was trawling through the valve sdk

example maps to see how the entities linked up and testing to see what extra stuff wasn't needed. This is my first tutorial for hammer

and hl2 so expect lots of edits.

Entities Involved

Setup

First we need to make a room and a light so we can see things, go ahead and hollow out a simple room but make it large enough to move around in, add a light and an info_player_start at a suitable position.

Take a seat

Make the Seat

Ok because of the way this works you don't have to use a seat model like a parkbench or chair, you can use a simple brush if you like. In fact you don't have to use anything since it will work without any seat - neat. Lets make a brush that's 16 units high, and 32x32 lenght and width, put a back on it to make it look at little bit better.
basic room with chair brush
Enlarge
basic room with chair brush

Place the Node

Now it's time for the main entity for solving this problem info_node_hint, create one and place it just in front of your chair. Place in on the ground and ensure the yellow direction line is pointing the way the character needs to be facing. Adjust the angles if this is not or you want to align it dirrently.
info node placed facing away from seat
Enlarge
info node placed facing away from seat

Name this entity npc_sit1

Go to the entities properties and chnage the value of Hint to "World: Act Busy Hint" Take a gander at Hint Activity, this is what we will be using later to act out.

Busy + Triggersentity

Now another entity is needed, create a ai_goal_actbusy and place it anywhere, name it npc_actbusy1

Create 2 short brushes in front of the chair, on top on each one create a trigger_multiple (create a brush then -> tie to entity -> trigger_multiple )Name them sit_on and sit_off doesn't matter which is which but I recommend having different textures on the brushes underneath so you remember which is which.
setup overview
Enlarge
setup overview

Npc

Now lets place the an npc_citizen, since we need somebody to sit down... By default it should randomise the head in the flags tab, you can change this but there is no need.

Name it sitting_npc1 Go to the npc_citizen properties and go to the model tab, you should see a drop down box with animations listed.

Now I hear you shout "I COULD SET SIT HERE!", wrong, unfortunately it doesn't work this easily. I am getting you to look at this so you know where I am getting the animations from.

There are a lot of sit animations here, but I've choosen "d1_t01_TrainRide_Sit_Idle", some of them won't work or may break HL2 but feel free to experiment

Putting it all together from outputs

Now lets get to the meaty bit, the outputs and all that jazz.

Go back to your info_node_hint (npc_sit1) into properties and set the Hint Activity to "d1_t01_TrainRide_Sit_Idle" with no quotes. Or place the animation you have chosen here.

Go to your ai_goal_actbusy (npc_actbusy1) properties and set Actors to sitting_npc1

Go to your trigger_multiple (sit_on) properties and set the outputs to: OnStartTouch - npc_actbusy1 - ForceNPCToActBusy - sitting_npc1 npc_sit1 0

parameters for sit_on
Enlarge
parameters for sit_on

Go to your trigger_multiple (sit_off) properties and set the outputs

OnStartTouch - npc_actbusy1 - Deactivate

Done!

Run the map and test it by standing on each of the pads, the npc should walk towards the chair and follow you if you deactivate, they

can change direction mid way so you can continually annoy them.

completed map
Enlarge
completed map

Things to watch out for

Use NPC brushes with clip textures so npcs don't climb on chairs and get stuck and ruin your day NPC clip brushes on info_node_hint will cause them to either not be seen or get them stuck or sit strangely (fun!)


Example Map

Coming soon I hope

Personal tools