Vlatitude: Scripting Tutorial Part 2 - A Specific Example Last edited 6 months ago2019-04-25 11:34:12 UTC by Penguinboy Penguinboy

Download example

Okay, now that you've read the overview of how scripts are constructed in Half-Life, it's time to put all that mumbo-jumbo into action. By the way, mumbo jumbo is an African folklore personage, and mambo (a derivative) is a Voodoo priestess.

For this tutorial, I will be using a part of my uncompleted single-player map. It has the player come up to a locked see-through door. On the other side, a scientist runs up to the door, waves at the player, then hits a button on the wall to open the door. This demonstrates the basics of Half-Life monster scripting.

After downloading the example map, compile and play the map once. Now open it up in Worldcraft, and let's take a look. This is in top-down view.
User posted image
  1. Number 1 is the trigger_once entity. Its target is sci_open_door, which is the name of the first aiscripted_sequence.
  2. This is an aiscripted_sequence entity. It's one of the most important in the scene. Notice in Worldcraft that almost all of the attribute fields have something in them. Important attributes are name, target, target monster, action animation, and move to position. Here's how it works: The aiscripted_sequence (#2) is linked to a monster named sci2. It also has a target, so sci2 walks to the aiscripted_sequence, does the wave animation, and the target is activated.
  3. This is our scientist, whose name is sci2. In the previous step, he was activated, and he walked to point 2. Like I said previously, his only decisive attribute is his name.
  4. Okay, after completing the action defined in #2, its target (sci_open_door2) is activated. Sci_open_door2 is our #4 aiscripted_sequence, so when it's finally activated, the scientists walks there, and performs the designated animation which is push_button on the target ed entity, which is sci_button.
  5. So the scientist pushes the targeted sci_button. This button has the target sci_door, which is #6.
  6. When the scientist pushes the button, the door swooshes open. Take the level and examine it in Worldcraft to really understand it.
This article was originally published on 69th Vlatitude.
TWHL only archives articles from defunct websites. 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.