General Half-Life 2/Scripting
description
Have a metrocop kick open a door and start firing at you.
keywords
combine, door, doors, kick, metro, cop, metrocop, npc_metrocop.
In this tutorial we will be making a Combine MetroCop kick open a door. You will need the following entities with names:
- npc_metropolice - booter1
- ambient_generic - door_spank
- scripted_sequence - kick_door1
- prop_door_rotating - door_exit1
- trigger_once
Now we need to position an npc_metropolice in front of the door, to make sure he aligns correctly go to the Model tab in his properties and change it to kickdoorbaton. This will enable you to line up his foot with the door. Don't forget to name him booter1 as listed above.
Now, we need the scripted sequence. There are two ways to place it, either on the npc_metropolice with MoveToPosition set to No, or move the metrocop back a bit and leave the sequence in his place and the set MoveToPosition to Instantaneous. Either way is fine, but I have used the latter, harking back to my HL1 habits. Again name it as listed above.
Finally add an ambient_generic above it all, and name that as above. And pop a trigger_once some distance from the door.
So far everything should be named as listed, and looking like the below:

Now that everything is in place it is time to set it all up.
The npc_metropolice is fine with just a name, feel free to dabble with weapons etc but it's not necessary.
Moving on to the scripted_sequence, there are a few things to add here.
- Name: kick_door1
- Target NPC: booter1
- Action Animation: kickdoorbaton
- MoveToPosition: Instantaneous
- No Interruptions
- Override AI
- No Script Movement

Ok, the door should be fine with just a name, but also crank up the speed to about 250 so it looks like it has taken a good kicking. Let's address the ambient_generic next:
- Name: door_spank1
- Sound Name: ambient/materials/door_hit1.wav
Tick all 3 Flags as well.
Ok we're almost there. What will happen is the combine will play out his animation, and then the door will fly open with a loud banging noise. We've added a slight delay so that his foot has time to connect and it doesn't look out of time.
Now we just need to trigger it.
Take your trigger_once and add the following output:
Now, as soon as you walk into the trigger it will set off the scripted_sequence which then takes care of the rest of the sequence with it's outputs:
There you go!
Blink












