VERC: Magic Cargo Container Last edited 1 year ago2022-09-29 07:55:06 UTC

Introduction

As discussed in a previous tutorial, normal Half-Life has serious problems with attaching entities together and moving them around. This tutorial demonstrates how to make the illusion of a moving cargo crate that turns into a hollow crate containing a squad of grunts. When the crate is placed on the ground, doors at one end open revealing the grunts.

Setup

The Crane and Container

User posted image
The first segment of this event is the moving crane and cargo container. Both the container and crane should be created in their lowered position.

The initial cargo container is just a simple block. Create it and texture it as you like, then turn it into a func_train. Set its Name (targetname) to train1 and its First stop target (target) to p1a. Create an upper and lower path_corner for the container, setting the upper path_corner's Name (targetname) to p1a and its Next stop target (target) to p1b. Set the lower path_corner's Name (targetname) to p1b and its Fire on pass (netname) to path_trigger1. (path_trigger1 gets triggered when train1 reaches the p1b path_corner). In both path_corner's Flags properties, enable the Wait for retrigger flag.

Also in this step, create a trigger_relay somewhere. Give it a Name (targetname) of killtrain1, and set its Killtarget (killtarget) to train1. This will be used in the middle of the event to remove the container func_train from the game when it is no longer needed.

Create the crane so it is in its lowered position, attached to the cargo container. Turn it into a func_train. Set its Name (targetname) to crain1 and its First stop target (target) to c1a. Create an upper and lower path_corner for the crane, setting the upper path_corner's Name (targetname) to c1a and its Next stop target (target) to c1b. In the Flags properties, enable the Wait for retrigger flag. Set the lower path_corner's Name (targetname) to c1b, the Next stop target (target) to c1a, and the Wait (wait) time to 2 seconds.

The Hollow Container

User posted image
The hollow container is a func_wall_toggle that occupies the exact same space as the cargo container func_train when its in the lowered position. Create the hollow container and turn it into a func_wall_toggle. Set its Name (targetname) to container1. In the Flags properties, enable the Starts invisible flag.

At one end of the container, create a set of func_door_rotating doors. Set their Name (targetname) to door1. Set their Render Mode (rendermode) to Texture (2) and FX Amount (renderamt) to 0 - this will make the doors start invisible. Set their Speed (speed) to something fast, like 400. Set the Delay before close (delay) to -1 so it stays open. In the Flags properties, enable the Passable flag. (Since, for the first part of the event, the doors will be invisible, they should also be non-solid to avoid having the player accidentally bump into the invisible door).

To make the hollow cargo container's doors solid for the 3 seconds that they'll be visible and closed, you need to create a func_wall_toggle covering the door space. Give it a Name (targetname) of doorblock1 and in its Flags properties, enable the Starts invisible flag.

Since there isn't any way to make the func_door_rotating go from non-solid to solid, there also needs to be solids in place for when the doors are open. Do the same as above, making a set of func_wall_toggles that occupy the same space as the open door will. Give these a Name (targetname) of solids1, and set their Starts invisible flag.

The last thing to do here is setup two env_render entities.

Create the first env_render and give it a Name (targetname) of showdoors1. Set its Target (target) to doors1. Create the second env_render and give it a Name (targetname) of hidesolids1. Set its Target (target) to solids1. Set the Render Mode (rendermode) to Color (1).

Dang, what a mess. Fortunately it all works seamlessly in the game.

What's in the box, Bob?

User posted image
To make things interesting, I've thrown a few monstermaker entities into the hollow container. Two of them spawn monster_human_grunt entities, and one spawns a weapon_9mmAR entity. All have a Name (targetname) of grunts1. What makes this interesting is that you need to lure the grunts out of the container before you can get to the gun. :)

To make it look like the grunts use some type of explosive to open the cargo container doors, place an env_explosion just inside the container doors, and give it a Name (targetname) of explo1. In its Flags properties, enable the No damage and No decal flags.

Coordination

The main thing that ties this whole event together is the multi_manager that gets triggered when the cargo container func_train reaches its lower path_corner.

Create a multi_manager and give it a Name (targetname) of path_trigger1. Turn off SmartEdit mode to add the following keys and values. To start the event in motion, you need to trigger crane (crane1) and container (train1) func_trains to move at the same time. I've done this in the example map by using two trigger_once entities placed over the player starting point. It could just as easily have been one trigger_once entity that activates a multi_manager that in turn activates the two func_trains.

In Layman's Terms

In simple terms, this is what's going on:

Two things immediately are triggered - the cargo container (train1) and the crane that lowers it (crane1). They appear to move as a single unit, but when the cargo container is positioned on the ground, the crane waits 2 seconds then returns to its initial position. When the crane gets to its lowered position, its path_corner (p1b) triggers a multi_manager (path_trigger1) that proceeds to kill (remove from the game) the func_train cargo container (train1) while simulataneously making visible the hollow cargo container (container1). The hollow container also has a set of doors (doors1) that are made visible by triggering an env_render (showdoors1).

After a two and a half second pause, the mutli_manager (path_trigger1) proceeds to trigger a group of three monstermaker entities (grunts1). Two of the monstermakers spawn grunts while the third spawns a weapon_9mmAR.

After a further half second pause, the multi_manager (path_trigger1) triggers an env_explosion (explo1) at the end of the hollow container just inside the container doors (doors1) which are also triggered to explode. Because the doors had to be made non-solid so they would not block anything while they were invisible, a func_wall_toggle (solids1) is also triggered On now, along with an env_render (hidesolids1) that makes the func_wall_toggle (solids1) invisible.

Example

For a more concrete illustration, check out the example map linked below.
This article was originally published on Valve Editing Resource Collective (VERC).
The archived page is available here.
TWHL only publishes archived articles from defunct websites, or with permission. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.