Half-Life Re-imagined competition results on their way...
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to thatguymalone, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Feeling Blue

What's your favourite shade of blue?

Azure

9

Cobalt

20

Turquoise

5

Cyan

8

Royal

3

Teal

3

Onliners

6 mins

Admer456

8 mins

Dr. Orange

22 mins

Solokiller

24 mins

DocRock

42 mins

Windawz

43 mins

zeeba-G

1 hours

Jessie

Affiliates

A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Torching Open A Door (OpFor)

By Chris 'autolycus' Bokitch

Introduction

Among the many new things the Half-Life: Opposing Force expansion pack introduces, one of the most interesting is the engineer NPC. It is possible to use him to open doors that are not accessibe to the player, for example, by cutting them open with a blowtorch.

Reference

The process of torching open a door is controlled almost entirely by using scripted_sequences. There are also some sentences available that you might want to use (with a scripted_sentence entity). The following information all applies to the monster_human_torch_ally engineer NPC.

Model Animations

  • cut_floor_grate - cuts lock on floor grate
  • open_floor_grate - opens floor grate after cutting lock
  • pull_torch_wgun - pulls out torch, holstering gun first
  • pull_torch_nogun - pulls out torch
  • cut_door_wgun - torches open door, stands, turns off torch, stores it, and unholsters gun
  • cut_door_nogun - torches open door, stands, turns off torch
  • store_torch - engineer stores torch, unholstering gun
  • frontkick - engineer kicks something in front of him

Sentences

  • TG_OPEN0 - "Who needs a locksmith! Huh, Shephard?"
  • TG_OPEN1 - "Stand back corporal, this should only take a minute."
  • TG_OPEN2 - "I'll have you through here in no time."
  • TG_NOTOPEN0 - "Sorry corporal, this door is barricaded from the other side."
  • TG_NOTOPEN1 - "That barricade is way too thick"
  • TG_NOTOPEN2 - "Cutting through this door is not a good idea."
  • TG_NOTOPEN3 - "Sorry sir, I'm not trained for situations like this."

Setup

The Script

The first thing you need to do is script out how sequence is going to be played out. For this tutorial, I'm using the following "script":

  • player leads engineer into the area with the door
  • the engineer runs over to the door
  • the engineer lights his torch and says something to the player to make it clear
  • he'll be opening the door
  • the engineer cuts around the door
  • the engineer kicks the door open
  • the engineer rushes away from the door and draws his gun

Step #1

Player leads engineer to door area, engineer runs to the door, engineer lights torch.

This is a combination of two things. First, the player has to +use the engineer and lead him into the area where a scripted_sequence will find him. Setting up the scripted_sequence is the second part.

Place a scripted_sequence entity near the door (somewhere within a 128 unit radius of the door, but this is just my preference) that will be cut. Select it and set the following properties.

  • Target (target) - set this property to 'script2'. Once this script is finished running, it will automatically activate the 'script2' event.
  • Target Monster (m_iszEntity) - set this to monster_human_torch_ally.
  • Action Animation (m_iszPlay) - set this to pull_torch_wgun - this will make the engineer retrieve his torch and light it with his cigarette.

      Note: If you'd chosen to make your engineer start without a gun, you'd instead use the pull_torch_nogun animation here.

  • Search Radius (m_flRadius) - this setting determines the range the scripted_sequence will search for a suitable monster for its script. This is highly dependant upon the map and situation. In the example map, I have it so the script finds the engineer as soon as he leaves his initial area. This value is in map units.
  • Move to Position (m_fMoveTo) - again, this is dependant upon the map and situation. In the example map, I've set this property to Run (2). I like my engineers to be eager. :)
  • Last, in the Flags properties of the scripted_sequence, put a check next to "No Reset Entity". This stops the model from resetting to its idle animation between scripted_sequences. It makes things look much better. :)

Step #2

Ah, yes, the all important witty remark.

Once the first script is completed, it activates 'script2'. The 'script2' event is obviously the next scripted_sequence that will be run, but it's also the name of a scripted_sentence. Place a scripted_sentence entity. It's location is unimportant but it should be kept near the door to keep everything in one area. Select it and set the following properties.

  • Name (targetname) - set this to script2 as mentioned above. This will be activated when the first scripted_sequence is complete.
  • Sentence Name (sentence) - set this to one of the sentence names mentioned in the beginning, like TG_OPEN0. Don't forget to put an ! in front of the name (ie: !TG_OPEN0) so that it is streamed in rather than stored in memory.
  • Speaker Entity (entity) - set this to monster_human_torch_ally.
  • Listener (listener) - set this to player.
  • Last, in the Flags properties of the scripted_sentence, put a check next to "Interrupt Speech" to ensure that the sentence gets said.

Step #3

Cutting around the door.

Once the script from step #1 is completed, as I mention above it activates 'script2'. Now we will create the scripted_sequence called script2. First of all, placement of this scripted_sequence is very important. The animation is meant to be applied on a door of the standard size - 64 units wide by 96 units tall. The scripted_sequence must be centered on the door, and placed 30 units away from it for it to work and look right. Once it is in place, select it and set the following properties.

  • Name (targetname) - set this to script2. This script is activated after the script from step #1 is complete.
  • Target (target) - set this property to 'script3'. Once this script is finished running, it will automatically activate the 'script3' event.
  • Target Monster (m_iszEntity) - set this to monster_human_torch_ally.
  • Action Animation (m_iszPlay) - set this to cut_door_nogun - this will make the engineer cut around the door, then stand up and turn off his torch.
  • Again, in the Flags properties, place a check next to "No Reset Entity".

Step #4

Hey devil doll, lets kick it!

So, the engineer has cut around the door, but that's all. The door is still there. The door must be kicked in! You are a lazy corporal, but thankfully your engineer is still eager to help. Along with the kicking effect are a few other effects that will go along with this. The door (a func_door_rotating) will rotate 90 degrees at a speed of 500 as the engineer kicks it in, debris (from an env_shooter) will shower down from the broken door frame, the ground will shake (with an env_shake), and the door will go boom as it hits the ground (an ambient_generic). This is all controlled by a multi_manager. For more information on these effects, please look at the example map included in this tutorial.

    Note: The multi_manager in the example map is named script3. It is triggered at the same time the following scripted_sequence is so it can properly coordinate the events.

Now, create a new scripted_sequence entity in the exact same location as the last one from step #3. Select it and set the following properties.

  • Name (targetname) - set this to script3. This script is activated after the script from step #3 is complete.
  • Target (target) - set this property to 'script4'. Once this script is finished running, it will automatically activate the 'script4' event.
  • Target Monster (m_iszEntity) - set this to monster_human_torch_ally.
  • Action Animation (m_iszPlay) - set this to frontkick - this will make the engineer give the door a big kick. (The multi_manager mentioned above would coincide its actions with the kick taking place - about 1.5 seconds into the animation).
  • Again, in the Flags properties, place a check next to "No Reset Entity".

Step #5

Engineers moves out of the way of the player and draws his gun.

Once the door is opened, you'll want the engineer to fall back and await orders. This is an especially good idea because its frustrating when an NPC is left blocking a door and you need to draw him out. So, create a scripted_sequence somewhere beside and away from the door. Select it and set its properties as follows.

  • Name (targetname) - set this to script3. This script is activated after the script from step #3 is complete.
  • Target Monster (m_iszEntity) - set this to monster_human_torch_ally.
  • Action Animation (m_iszPlay) - set this to store_torch - this will make the engineer store his torch and draw his gun.
  • Move to Position (m_fMoveTo) - In the example map, I've set this property to Run (2).
  • Again, in the Flags properties, place a check next to "No Reset Entity". (Even though this is the last script, it really does look alot better)

That's that. As you can see, the various animations give you a number of options for how you'd like to play the sequence out. When using this kind of thing, keep in mind that if the use of the engineer is the only way a player can progress through a level, you'll need to make use of trigger_autosaves and set the engineer's trigger conditions so he activates a player_loadsaved entity.

Example

For a more concrete illustration, check out the example map linked below.