Snarkpit Articles


EDIT: I will update this soon when I've figured out the ai_battleline etc

In this tut I'll show you how to make a citizen with an RPG run to spot then aim said RPG using scripted sequences.

Start off with a room, playerstart and an npc_citizen. In the npc_citizen's object properties dialog give it a name of bob, and give him an RPG via the weapon property.

Next, put a scripted_sequence entity where you want your npc to run to.

Then open up the Object Properties dialog and enter this:

Name: a1
Target NPC: bob
Pre Action Idle Animation: Idle_RPG_Relaxed
Action Animation: Idle_RPG_Aim
Post Action Animation: Idle_RPG_Aim
Move to Position: Run

These (and the other boxes/options) will do the following:
NAME: The sequence's name
PARENT: If you want it to move about about set the parent to a tracktrain or something
PITCH YAW ROLL (YZX): It's orientation. The targeted NPCs will face in this direction after the sequence
TARGET NPC: Name of targeted npc (ie "bob") or npc type (ie npc_citizen)
PRE ACTION IDLE ANIMATION: the animation played before the sequence takes affect
ACTION ANIMATION: The animation played when the npc reaches the sequence
POST ACTION ANIMATION: the animation played afterwards
CUSTOM MOVE ANIMATION: Only used if the Custom Move option is used for the Move to Position box
SEARCH RADIUS: I think this if you put in something like npc_zombie instead of a specific entity name in the Target NPC box. Any npc of that type will move to here if its in this radius
REPEAT RATE MS: How long it will be repeated if the Repeatable Flag is checked I think. In miliseconds.
MOVE TO POSITION: How the npc will get to this position (run, walk etc). If set to Custom Animation it will use the anim in the Custom Move Animation box.
NEXT SCRIPT: The name of the next sequence that your npc will go to after this one

Then go to the Flags section and tick the following:
Start on Spawn
Override AI (AI scripted sequence!)
Loop in Post Idle

Start on Spawn will make the npc run the sequence as soon as it spawns
Override AI effectively makes it an ai_scripted_sequence from HL1
Loop in Post Idle makes the npc loop the post idle animation

The other flags do the following:
Repeatable: makes it possible for this to happen again. And again. And so on
Leave Corpse: Obvious. If the NPC dies it leaves a corpse if this is checked
No Script Movement: The NPC will not run to the sequence if this is checked
Priority Script: I think this makes the npc use this sequence's Post Idle Animation if there are multiple sequences.

And there you go!


Post ReplyView Topic
Discussion
[author]
Posted by Guessmyname on Sun Feb 27th 2005 at 9:29am

Look under the "Models" tab of the npc. There you can see all the commands and watch the npc perform them. You can also copy, paste the animation from the Models tab to the animation boxes of the scripted sequences.
0 starsPosted by jman on Sat Feb 26th 2005 at 12:00am

I was wondering, where do you find those script commands?I want a guy to walk and switch his weapons and stuff...Really I don't know what I'd do so...Anyway, I really want those commands.
0 starsPosted by Xsjado on Mon Feb 14th 2005 at 7:35pm

Awsome. This is going to be insanely useful for me.
0 starsPosted by Anable on Fri Dec 31st 2004 at 10:19am

A solid foundation to build upon.
[author]
Posted by Guessmyname on Tue Dec 21st 2004 at 6:54pm

When I get home I think I will. It really isn't much though
0 starsPosted by Yak_Fighter on Tue Dec 21st 2004 at 6:48pm

Perhaps you could add a tutorial map to download so people can see a working example and mess with it themselves to learn beyond the scope of the tutorial?
Post ReplyView Topic