WiseNPC01: Difference between revisions
Spiritslayr (talk | contribs) m (Changed npc_alyx's name) |
mNo edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:WiseNPC01:Look, run and walk}} | |||
{{SDKNuts Tutorials}} | |||
{{wisemxport|[[User:Plykkegaard|Peter [AGHL]]] 06:47, 24 Feb 2008 (PST)}} | |||
==Introduction== | |||
{{Note|This is part of a series of tutorials on NPC’s.}} | {{Note|This is part of a series of tutorials on NPC’s.}} | ||
To make the NPC look in a direction or to run and walk can be done with a | To make the NPC look in a direction or to run and walk can be done with a {{ent|scripted_sequence}}. | ||
[[ | [[File:wiseNPC01_01.jpg|thumb|150px|right|Look, run and walkl]] | ||
In this example we are going to: | In this example we are going to: | ||
* Wake Alyx. | *Wake Alyx. | ||
* Make her to look in our direction. | *Make her to look in our direction. | ||
* Make her run far away. | *Make her run far away. | ||
* Finally she will walk back then die. | *Finally she will walk back then die. | ||
We are not going to use Face Poser for this. | We are not going to use Face Poser for this. We are not going to use scripts that need to be loaded. | ||
We are not going to use scripts that need to be loaded. | |||
The first thing to do is place your NPC in the map and give it a name. | The first thing to do is place your NPC in the map and give it a name. | ||
I’ve created a displacement for the floor area to illustrate something. | |||
The | The {{ent|info_node_hint}} entities on the ground are necessary and will not work if they are buried in the displacement. Raise them up above displacement floors. | ||
For this example I’m using 3 <code>scripted_sequence</code> entities to control Alyx. | |||
[[File:wiseNPC01_02.jpg|thumb|150px|right|]] | |||
==Creation== | |||
Give each of your <code>scripted_sequence</code> entities a name. Set the Target NPC property to the name of your NPC, in this example it’s ''alyx''. | |||
The | The '''Move to Position''' property is the one that will do the work for us. | ||
For each of the 3 <code>scripted_sequence</code> entities '''Move to Position''' is: | |||
*alyx_seq01 No - Turn to Face | |||
*alyx_seq02 Run | |||
*alyx_seq03 Walk | |||
The <code>scripted_sequence</code> has a ''Next Script'' property you can use. | |||
In this example our second <code>scripted_sequence</code> has ''alyx_seq03'' specified for the ''Next Script''. So when Alyx runs to script #2 she will then walk to #3. | |||
To begin the sequence of events I’m using a {{ent|logic_auto}}. No changes are made to the <code>logic_auto</code> but these outputs are added: | |||
{{entity-kvalue-start|[[logic_auto]]}} | {{entity-kvalue-start|[[logic_auto]]}} | ||
{{entity-kvalue-end}} | {{entity-kvalue-end}} | ||
Line 49: | Line 49: | ||
{{entity-output-end}} | {{entity-output-end}} | ||
On the ground between the | On the ground between the <code>scripted_sequence</code> entities I’ve placed <code>info_node_hint</code> entities to give the NPC a walking path. Even with the <code>scripted_sequence</code> entities setup properly your NPC won’t walk or run without the <code>info_node_hint</code> entities. | ||
At the final | At the final <code>scripted_sequence</code> I’ve created a {{ent|trigger_once}} to kill the NPC. | ||
{{entity-kvalue-start|[[trigger_once]]}} | {{entity-kvalue-start|[[trigger_once]]}} | ||
Line 62: | Line 61: | ||
In each of these | In each of these outputs <code>alyx</code> is the name of our NPC Alyx. | ||
When the map loads the <code>logic_auto</code> will begin the sequences, when Alyx gets to sequence #2 it will activate sequence #3 and when Alyx gets to sequence #3 she will step into the trigger and activate the output above, which will cause her to die. | |||
==See also== | |||
* | *[http://type3studios.com/downloads/tutorials/SdkNutsTutorials/wiseNPC01.zip Example VMF] | ||
* | *[https://cdn.discordapp.com/attachments/434089157875466242/463983096979521536/wiseNPC01.vmf Example VMF backup] | ||
[[Category:Level Design | [[Category:Level Design]] |
Latest revision as of 07:25, 15 April 2024
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
Introduction

To make the NPC look in a direction or to run and walk can be done with a scripted_sequence.
In this example we are going to:
- Wake Alyx.
- Make her to look in our direction.
- Make her run far away.
- Finally she will walk back then die.
We are not going to use Face Poser for this. We are not going to use scripts that need to be loaded.
The first thing to do is place your NPC in the map and give it a name.
I’ve created a displacement for the floor area to illustrate something. The info_node_hint entities on the ground are necessary and will not work if they are buried in the displacement. Raise them up above displacement floors.
For this example I’m using 3 scripted_sequence
entities to control Alyx.
Creation
Give each of your scripted_sequence
entities a name. Set the Target NPC property to the name of your NPC, in this example it’s alyx.
The Move to Position property is the one that will do the work for us.
For each of the 3 scripted_sequence
entities Move to Position is:
- alyx_seq01 No - Turn to Face
- alyx_seq02 Run
- alyx_seq03 Walk
The scripted_sequence
has a Next Script property you can use.
In this example our second scripted_sequence
has alyx_seq03 specified for the Next Script. So when Alyx runs to script #2 she will then walk to #3.
To begin the sequence of events I’m using a logic_auto. No changes are made to the logic_auto
but these outputs are added:
Class: logic_auto | ||
Keyvalues | Comments | |
My output | Target entity | Target input | Parameter | Delay | Only once | Comments | ||
![]() |
OnMapSpawn | alyx | wake | |||||
![]() |
OnMapSpawn | alyx_seq01 | BeginSequence | 3.00 | ||||
![]() |
OnMapSpawn | alyx_seq02 | BeginSequence | 5.00 | ||||
On the ground between the scripted_sequence
entities I’ve placed info_node_hint
entities to give the NPC a walking path. Even with the scripted_sequence
entities setup properly your NPC won’t walk or run without the info_node_hint
entities.
At the final scripted_sequence
I’ve created a trigger_once to kill the NPC.
Class: trigger_once | ||
Keyvalues | Comments | |
My output | Target entity | Target input | Parameter | Delay | Only once | Comments | ||
![]() |
OnTrigger | alyx | SetHealth | 0 | ||||
In each of these outputs alyx
is the name of our NPC Alyx.
When the map loads the logic_auto
will begin the sequences, when Alyx gets to sequence #2 it will activate sequence #3 and when Alyx gets to sequence #3 she will step into the trigger and activate the output above, which will cause her to die.