by Tutorial on Mon Mar 07, 2005 10:33 pm
category
General Half-Life 2/Scripting
description
The almighty strider explained.
keywords
strider, striders, npc, npc_strider.
Striders are, in terms of HL2 enemies, stupid. Incredibly stupid, in fact. They have no random path-finding AI to speak of. If you create one on its own, it'll just stand there. Even if you give it targets to shoot, it'll shoot at them, whilst standing perfectly still. The only thing it can actually do is crouch, or stamp, if a target happens to be close enough or out of its line of sight.
Things to bear in mind: Striders hunt. They don't walk around randomly, they actively hunt things they've seen. They don't do much when there aren't any targets for them to attack. In fact, they tend to stand still, that I've noticed. Therefore, if you want a Strider running around your level, give it things to attack. The player is acceptable.
This is how to make a moving Strider in your map.
Step 1; Create a map. Preferably, make one taller than your Strider, or at least as tall. Otherwise, the poor bugger won't fit.
Step 2; As already mentioned, your Strider will perform best with a lot of things to shoot at around it. Make sure there are lots of things you want your Strider to shoot. If the Strider is only hunting the player, you may want to make the level either fairly linear, or centered around one point. A building works well.
Step 3; Make a path_corner for your Strider to walk to. Place it in the thick of where the action will be. A working Strider needs only one path_corner to walk to; you can add a huge path if you want, but remember that your Strider won't deviate from it until the end.
To make your Strider walk to the path_corner, select it, and hit alt-enter. Set the 'Target Path Corner' property to whatever your path_corner is called.
If you were to run the map now, the Strider would do absolutely nothing. They're useful, like that. This is because Striders need nodes to move around; without nodes, they're blind.
Step 4; Add nodes for your Strider. Now; normal ground troops use an info_node. Flying npc's, like scanners, use info_node_air. What do you think a Strider uses?
...info_node_air_hint. There's a good reason for this. Mainly, it's because Striders are so damn tall.
Why the _hint type node, and not normal? You can't set the type of a normal node, is why. Striders need specialised Strider nodes; and you can only set specialised nodes with _hint nodes.
Your Strider, therefore, needs info_node_air_hint nodes with their Hint property set to Strider Node. Place these at around the Strider's 'head' height; use the editor to check this. It doesn't matter a huge amount exactly how high the nodes are, as long as the Strider can reach them. 'Head' height just keeps them out of the way of ground nodes, and makes it easier to tell where your Strider's going to end up.
You'll want a few of these info_node_air_hint. In fact, you'll want one everywhere you want your Strider to be able to walk to. As I said, they don't find places to stand on their own; they walk from node to node, and sod all else. Generally, if you're creating a combat situation in a wide open space, you'd make the path_corner for the Strider either smack in the middle of all these nodes, or in a corner. That way, the Strider has plenty of choices of where to head once it's free of the path.
Step 5; Play with your Strider. Give it a few resistance member npc_citizens to kill. In fact, give it an infinite number. As long as they're not spawning with rocket launchers, your Strider's fine. It'll walk to its path_corner, then wander happily around the nodes you've set killing people at will. There's your Strider.
Now; I guess you're next going to want to know how to fire the Strider cannon, aren't you? That goes more into entity I/O than anything else, and isn't really in the scope of this tutorial type thing.
However, I'm drunk. So I'll tell you. You'll need to set up any sort of entity that can send off inputs to another entity. Triggers, for example, can do this. You'll want your Trigger to tell your Strider to execute the input 'SetCannonTarget target', where target is the name of the entity you want it to shoot. This can be any entity at all that's currently in the map; If you want to target the Player, use !player.
It stings a little.
Some other useful commands for your Striders are:
Stand
Crouch
SetMinigunTarget
EnableCrouchWalk
DisableCrouchWalk
Noctu
- Don't send PM's to this user -