VERC: Random Event Generator Last edited 5 years ago2019-05-13 13:17:59 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
While looking through the gamedesign.net Half-Life editing discussion forums (which sadly no longer exist), I found a post by mazemaster mentioning his idea for creating a random event generator. It's an excellent idea that's quite easy to implement.

Introduction

At the heart of the idea is the env_beam and it's random properties, both in regards to strike time and target acquisition. When an env_beam has more than one target entity available to it, it will choose one randomly as it's end point. When the random strike flag is checked, the beam will strike randomly with a delay between 0 and the specified Strike Again Time.

The process is visually intuitive and easy to setup. This article covers a simple example that covers eight random events, but you could expand this to cover as many events as you'd like. The entities follow the basic pattern below. The blue objects are info_target entities, the white are func_buttons, and the green are the random events that get activated, in this case game_text entities. The random effects can be placed anywhere -- they were arranged like this to illustrate their connection to the targets and buttons.
User posted image

Mechanics

The Buttons

First, create a circle of func_button entities. This is most easily done by creating an arch.
  1. Go into Block creation mode by pressing Shift+B.
  2. Select arch from the Objects list.
  3. Drag a 128 unit x 128 unit box in a 2D view and press Enter.
  4. In the Arch Properties box, set Wall width to 16, Number of sides to 8 (for this example), click on the Circle button, then press Ok.
  5. Switch to the selection tool by pressing Shift+S.
  6. Click on one of the arch pieces to select it (make sure it actually is selected) and press Ctrl+U to ungroup the pieces.
Now, each of the pieces of the arch needs to be turned into a func_button. Each button will have the exact same properties except as noted below. Note that you must turn each piece into a func_button separately. Do not select all of the pieces and turn them into a single func_button. Use the properties outlined below.

func_button properties

Now we need to setup the info_target entities. The env_beam will use the info_targets to define it's start and end points. We need to place one info_target in the middle of the ring of buttons, and one info_target behind each button. The main thing of importance is that each button be between the center info_target and one other one. Use the following properties for the info_target entities.

center info_target properties

outside info_target properties

Finally, we'll create the env_beam. The placement of the env_beam entity isn't important as it will use the info_target entities for it's starting and ending points. For ease of use, I generally place the env_beam above the main starting target. Setup the env_beam entity with the following properties.

env_beam properties

That's all there there is to it. All that's left to do is create the events that correspond to the target properties of the func_buttons. The basic flow of the targeting is shown in the picture below.
User posted image

Resources

Below is a list of entities related to this tutorial. For a more concrete illustration, check out the example map linked below.
This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

1 Comment

Commented 11 months ago2023-12-05 23:35:17 UTC Comment #105701
An alternative to manually placing all these entities is to use mtl_trigger_random, a template entity that comes with MESS, an automation tool that can generate entities for you. One added benefit is that mtl_trigger_random produces less entities by giving the func_buttons a carefully placed origin brush, which removes the need for info_targets.

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