Scripted_Sequence

Tutorial collection, comprehensive listings on main site.

Scripted_Sequence

Postby Tutorial on Sun Mar 06, 2005 11:45 pm

category
General Half-Life 2/Scripting

description
The bread and butter of SP level design, takes you through a basic script.

keywords
script, scripted, sequences, sequence, scripts, scripted_sequence.

We will be looking at how to get a barney to walk somewhere and wave and then walk to another place. Once you know the concept you can adapt it to other NPC and their animations.

First thing to do is set-up some entitles in your level. Place an npc_barney and two scripted_sequence entities in the map. Also drop a weapon_shotgun near the player.

Shown below:

Image

What we are going to do is make the barney walk to the first scripted_sequence and then perform an animation and when down walk to the second scripted_sequence. We will be using the shotgun to trigger this, as soon as the player picks it up.

The first thing to do is open up the properties for the npc_barney and give it a name, in this instance barney1 will suffice

Image

Next open up the scripted_sequence that you want the barney to walk to and perform his animation.

There are quite a few entries and they all have descriptions but we will be using the main ones here.

Image

Name: Call it script1; this is so we can trigger it

Target NPC: Barney1

Action Animation: Type Wave in here, you can see a list of animations in the model viewer for each entity.

Move to Position: Choose Walk, this is how he will get there

Right, now you have done that go into the other scripted_sequence and set these fields:

Name: Script2

Target NPC: Barney1

Move to Position: Walk

Ok so we are done with the sequences, the barney will walk to the first one, wave and then walk to the second one. We are now going to set them up to link to each other using the Input/ Output system.

So first we want the shotgun to trigger the first script when it’s picked up, go in to it’s properties and go to the outputs tab, here is where we add things that this entity triggers, the input tab shows triggers coming in from other entities.

Image

First hit Add

Then we choose OnPlayerPickup, this triggers the event when the shotgun is picked up.

Next we enter the entity we want to target, so this is script1, you can use the small pen icon to the right to click the entity you want to target in the 3D view as well.

We tell it to BeginSequence when this happens as well

And we can also put a delay in if we want.

Ok so at the moment it will trigger script1 to carry out it’s tasks when the shotgun is picked up, if you go into script1 and look at the Inputs you will see this effect in there.

The next thing to do is open up script1 and get it to trigger script2 after the barney is done waving, so go in to the output tabs and hit Add again.

Image

Copy the above details, and now it should work. Try compiling the map and having a look. If it fails think logically at what each entity is doing and triggering, the I/O system makes this easy to see.

Image

See him wave!

Related:
Example Map

Blink
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby M@sterT on Sun Mar 13, 2005 5:31 pm

i tried makin an npc walk and sit down on a bench which is next to a table but he will not sit down on the bench. i tried putting the scripted sequence entity above the bench and inbetween the table but then teh npc wont even do the sequence and if i put it behind the bench but then the npc walks over to teh bench and tries to sit down in mid air
M@sterT
Regular
Regular
 
Joined: Wed Nov 10, 2004 10:13 pm

Postby YokaI on Sun Mar 13, 2005 11:10 pm

very cool, Helpful for single player type mods/half life 2 custom maps.
YokaI
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 03, 2004 12:38 am

Postby RabidGoat on Tue Mar 29, 2005 1:36 am

alright, so I have follow the instructions to the T, and something very odd happens........the person follows me and "joins my squad" instead of doing the selected script sequence. granted, Im not using Barney, but rather npc_citizen. But I don't see how that would make a difference. Anyone know why this is? Scripting is where its at!

Your friendly neiborhood Hammer n00b-

Rabid Goat :?
RabidGoat
Regular
Regular
 
Joined: Sun Mar 20, 2005 4:52 am
Location: Florida (It's just as hot as you think it is) =P

Postby ToastMaster on Tue Mar 29, 2005 1:59 am

Rabid, have you tried ticking the 'override ai' flag on the scripted_sequence?
And if you have, did you make sure that the sequence that you typed as the main animation is valid? no typos? Make sure that the 'target npc' is set to that npc. (make sure the npc has a name first. :wink: ) perhaps you should untick the 'commandable' flag on the npc_citizen and see if he/she will do it when he/she's not in your 'squad'. If none of that works, well, I dunno...
ToastMaster
Dumpling
Dumpling
 
Joined: Fri Mar 11, 2005 4:02 pm

Postby RabidGoat on Tue Mar 29, 2005 3:05 am

sweet, thanks. I will check all of those and report back......*runs off to Hammer*
RabidGoat
Regular
Regular
 
Joined: Sun Mar 20, 2005 4:52 am
Location: Florida (It's just as hot as you think it is) =P

Postby RabidGoat on Tue Mar 29, 2005 3:34 am

nothing.......besides the fact that he doesn't join my squad anymore. the scripting sequence still does not fire when I pick up the pistol......

have you thought of anything else? or has anyone else experienced this problem and then fixed it?

Your friendly, yet exhasperated neighboorhood Hammer n00b-

Rabid Goat :?
RabidGoat
Regular
Regular
 
Joined: Sun Mar 20, 2005 4:52 am
Location: Florida (It's just as hot as you think it is) =P

Postby RabidGoat on Tue Mar 29, 2005 3:45 am

aaahhhhh ha!

Here is my theory why it has finaly worked.......(sort of)........I had the NPC in a seperate room, with a wall between him and the "scripted_sequence" entity. when I dragged the NPC out of the room and in a straight line with the "script_sequence" entity, it worked fine. He walked over, and got something from the stove. However, he didn't go to the second scripted sequence....which is.....you guessed it! not in his line of sight.......

could this be the reason why? if it is, how do I fix it?
RabidGoat
Regular
Regular
 
Joined: Sun Mar 20, 2005 4:52 am
Location: Florida (It's just as hot as you think it is) =P

Postby Serever on Tue Mar 29, 2005 3:56 am

have a line of scripted sequences that can see ech other, so the npc follows the line.
"Hey Scott. It's Dougal. Can I have my hair from the 1980's back?"
User avatar
Serever
Senior Member
Senior Member
 
Joined: Tue Nov 23, 2004 9:23 pm
Location: NSW, Australia

Postby RabidGoat on Tue Mar 29, 2005 4:05 am

is that the only way to do it? the AI doesn't kick in and make them walk around the corners and such?

thanks everyone for bearing with me during this.
RabidGoat
Regular
Regular
 
Joined: Sun Mar 20, 2005 4:52 am
Location: Florida (It's just as hot as you think it is) =P

Postby ToastMaster on Tue Mar 29, 2005 4:08 am

RabidGoat wrote:nothing.......besides the fact that he doesn't join my squad anymore. the scripting sequence still does not fire when I pick up the pistol......
Y'know, If you make a brush with the 'tools_toolstrigger' texture, then tie =Ctrl-T= it to a Trigger_once, you can trigger the sequence from that if you don't want to have a pistol or whatever in your hands. (this would also be good too if someone else was playing playing the map, then used cheats to get all the ammo he could hold. that way it would still trigger even if you didn't grab the pistol. :-D ) sorry if you already knew this. oh, yeah. I'm glad you finally got it figgured out. :D
Serever, that's a good idea, I woulda' never thought of that.

regard to the above post that was posted before I was finished: not if you tick the 'override ai' flag. I think even though it's called A.I... It's not really all that I. even though games have come a long way. you still have to help the poor little guys alot if you are being pretty picky about what you want them to do. shame no? :?
ToastMaster
Dumpling
Dumpling
 
Joined: Fri Mar 11, 2005 4:02 pm

Postby Blink on Tue Mar 29, 2005 8:34 am

He should go to his new script regardless, but he will need info_nodes to help him navigate doorways and corridors etc on the way there, otherwise he'll just look at you.
User avatar
Blink
Cool 'n that
Cool 'n that
 
Joined: Fri Oct 08, 2004 4:16 pm
Location: UK

Scripting doesn't work..

Postby Morchaiel on Fri May 27, 2005 6:04 pm

I just can't seem to get any script to work... For instance, how do I get someone to sit on a chair? An npc_citizen, that is.... Those idiots just don't respond to the script.. Help?
Eat me. I taste gooood!
Morchaiel
Dumpling
Dumpling
 
Joined: Tue May 24, 2005 11:19 pm

scripted sequence

Postby Dak on Tue Jun 07, 2005 12:36 pm

Hey thanks for doing the tutorial

I got it to work, however the Barney moves at a super fast pace, like you can't even see him move, he's just there suddenly. I did a script sequence with a zombie, and he walked at a regular pace. Any idea whats wrong with Barney?

-Dak
Dak
Just Joined
Just Joined
 
Joined: Mon Jun 06, 2005 7:26 pm

Postby IZaNaGI on Tue Jun 07, 2005 12:44 pm

I know it may seem a little simple but make sure barney is set to ...

Move to Position: Walk


If its set to 'instant' he will just pop up in those positions like you have descirbed.
User avatar
IZaNaGI
Been Here A While
Been Here A While
 
Joined: Fri May 06, 2005 11:16 am
Location: W. Yorkshire, UK
Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users