WiseEnding: Creating HL2 endings - The End

From Valve Developer Community
Jump to: navigation, search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

Introduction

In this project:

  1. Player walks down a hall to a large monitor.
  2. When the player gets closer and looks at the monitor the girl (npc_citizen) in the monitor will get shot.
  3. The player is frozen.
  4. Music begins to play.
  5. View changes to scene where girl died.
  6. Credits begin to appear on the screen.
  7. Screen fades and "The End" is displayed on the screen.
  8. The Half-Life 2 Half-Life 2 logo is displayed on the screen.
  9. The game ends 38 seconds after the player was frozen.

Deciding where and how your map will end is something you should put a lot of consideration into. Imagine how your opinion of HL2 would change if, at the very end, it simply ended with nothing for the player to see or do. The methods I’ll illustrate here are not your only options; the intention here is to offer options you can use to spice up your endings.

This project starts with one of my previous projects, WiseLook. I choose to use a previous project that could use an ending and this allowed me to illustrate how your map can be complete when you design your ending. It’s simply the icing on the cake at that point.

Something you may want to consider is creating a room away from your map where you have a custom image on one of the walls, with the remaining walls all being textured with tools\toolsblack. This would be the same method used here for the npc_citizen except the room would be pitch black, with a light source shining on your custom material.

The first thing you’ll want to do is play some background music as your map ends. In this project, I based the timing of the final events around the song being played. You can add your own or use anything from the Source SDK.

Note.pngNote:Just a warning, it's never a good idea to use any music from a Valve game in your mod because of copyright issues.

Creation

To shop for SDK music from Hammer place an ambient_generic entity in your map and from the Sound Name property click on Browse.

The next thing I’ve done is place a logic_relay in the map for the closing events. This one logic_relay will be triggered at the appropriate time. I’ve given it a name and created all of the outputs needed.

To display our ending credits we’ll use the game_text entity. You’ve no doubt noticed there is an env_credits entity in Hammer. Unless you code your mod, (reference EnvMessage.cpp), env_credits is only good for showing the beginning and ending HL2 credits, additionally, you can display the HL2 logo by placing one of these in your map and targeting it with the input ShowLogo In this project I’ve placed an env_credits and use it to display the HL2 logo.

For each line in the ending credits, I’ve created a game_text entity. There are 5 used in this project with the following properties:

  • Name: gametext1
  • Message Text: So ends our story. . .
  • X and Y: -1
  • Text Effect: Fade In/Out
  • Color 1: 255 255 0
  • Fade In: 1.5
  • Fade Out: 0.5
  • Hold Time: 3.0


  • Name: gametext2
  • Message Text: Created by Mark Wisecarver
  • X and Y: -1
  • Text Effect: Credits
  • Color 1: 255 255 0
  • Fade In: 1.5
  • Fade Out: 0.5
  • Hold Time: 3.0


  • Name: gametext3
  • Message Text: Appalachian Killing Grounds
  • X and Y: -1
  • Text Effect: Credits
  • Color 1: 255 255 0
  • Fade In: 1.5
  • Fade Out: 0.5
  • Hold Time: 12


  • Name: gametext4
  • Message Text: http://sdknuts.net/
    Warning.pngWarning:Be careful when using characters such as slashes and quotation marks, they may break your map!
  • X and Y: -1
  • Text Effect: Credits
  • Color 1: 0 128 255
  • Fade In: 1.5
  • Fade Out: 0.5
  • Hold Time: 12


  • Name: gametext5
  • Message Text: The End
  • X and Y: -1
  • Text Effect: Credits
  • Color 1: 255 255 255
  • Fade In: 1.5
  • Fade Out: 0.5
  • Hold Time: 6

The HL2 entity point_viewcontrol is used to freeze the player and switch to the npc_citizen area. These are really simple to use but make sure you pay attention to the flags. For this point_viewcontrol the following flags are checked: Freeze Player, Infinite Hold Time, Make Player non-solid. We want this one at a fixed location so the flags Start at Player and Follow Player are not checked. Snap to Goal Angles isn’t important in this project; our point_viewcontrol is looking at an info_target on the ground at all times. The flag Interruptable by Player isn’t checked because we don’t want control to be turned back over to the player; we’re going to end the map.

For the Entity to Look at property for our point_viewcontrol I’ve placed an info_target behind the npc_citizen. The only property for the info_target is the name, so that our point_viewcontrol can look at it. Shown below are the outputs from the logic_relay that does all the work, once it’s triggered.

WiseEnding relay io.png

Notice how the timing is controlled from one location. This is very handy when you are testing your ending effects.

One thing that needs to be explained is the point_clientcommand, named command1. When everything is finished, do map_background mapname to go back to the main menu with a background map of your choosing.

The last entity is the env_fade, which is activated at just the right time. In this env_fade I’ve only checked the flag Stay Out. The Duration is 2 seconds. This is the amount of time it take to fade in or out. The Hold Fade is 60 seconds, which is longer than the fade will be needed.

See also