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.
- Number 1 is the trigger_once entity. Its target is sci_open_door, which is the name of the first aiscripted_sequence.
- 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.
- 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.
- 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.
- So the scientist pushes the targeted sci_button. This button has the target sci_door, which is #6.
- When the scientist pushes the button, the door swooshes open. Take the level and examine it in Worldcraft to really understand it.