Likely so that a level designer can fine-tune the apache’s behavior to the level at hand. AI is a finicky thing.
And yeah, documentation would be nice.
Likely so that a level designer can fine-tune the apache’s behavior to the level at hand. AI is a finicky thing.
And yeah, documentation would be nice.
The Apache really is no worse than the Hunter-Chopper in Half-Life 2 when it comes to setup. The difficulty is really in deciphering how it’s set up, particularly since at the time of this writing, the boss battle in Surface Tension bm_c2a5c doesn’t decompile correctly.
My level, Bravado, makes heavy use of the Apache. I put my original .vmf inside the .vpk file so others can understand how it works. But here are some observations. Some of this is based on the Hunter-Chopper, others based on using developer 2 in Surface Tension (specifically the map bm_c2a5c) or looking at the decompiled .vmf in Notepad++.
[list][]The reason you want to set it as a Template NPC is because something about this method allows the rotor sound to work. If you use a point_template, the Apache will spawn, but under some circumstances, the rotor sound may not play (and EnableRotorSound doesn’t fix it). It seems like many Apaches in Black Mesa are already present at the start of the level.
[/:m][]As with other Flying NPCs, the Apache follows path_tracks. So, you’ll want at least one path_track, if not a connected chain of them. Path_tracks should also have a non-zero Path Radius (allows for some wiggle room in what counts as “passing” the path_track). 64 is a good start. Orientation Type should be set to No Change. I am not certain if info_node_airs are necessary. They aren’t for a Hunter-Chopper, but I wound up using them with the Apache because they seemed to help (could be placebo effect). You’ll want to position these at each path_track and along the connections at roughly 512 units between each one.[/:m]
[*]So, on your npc_template_maker, there are a number of things you should consider doing OnSpawnNPC:
[list][]Okay, so “reachable location.” You can’t just put the info_target_helicoptercrash just anywhere. It has to be near some collision for the Apache to slam into (func_clip_vphysics can be used for invisible collision). Preferably, this should be on the ground. As I’ve learned, walls are problematic. The Apache’s fuselage gib is so enormous, it will likely get caught in the wall. You’ll see in my map that I did a hacky workaround for this, where I use a trigger_once around the info_target_helicoptercrash to Kill the Apache and then spawn my own gibs in a predictable manner. Why did I do this instead of putting it on the ground? Because I didn’t build the arena with this in mind, so there’s a whole lot of potential obstructions to reaching the ground.
[/:m][/list:u][/*:m][/list:u]
Is there a good reason why npc_template_maker is preferred over point_template?
I had issues with the rotor sound not playing when I used a point_template.
For most other things, I use point_templates. I used to use npc_template_makers a lot, but point_template really streamlines things much better. My only reason to use npc_template_makers now is if if I need to replenish enemies from varied spawn locations (using the info_npc_spawn_destination feature).
Also, they come in handy when using the env_xen_portal_template, which is the Black Mesa entity which spawns enemies with all the green teleporting effects automatically!
I almost never use plain npc_makers (or, likewise, the env_xen_portal). Mostly because I like to imbue my NPCs with a little personality and scripting, and having each one be a distinct setup is helpful for that.
I’m not really a part of this conversation, but I thought all that information was very interesting – thank you Maki for taking the time to post all those technical details, and while we’re at it , let me say I really liked your Bravado map! One of the few peccadilloes I have with Black Mesa is that Apache death animation. In the original Half Life, and with the aerial enemies in Half Life 2, I think some of the most satisfying moments were watching them go down differently and randomly depending on all the variables. It gives those fights great replay value and seems a lot more realistic than the current death animation in which the Apache sort of…“belly-dances” while it makes a suicidal beeline for the rockface. Based on what you mentioned about the huge gib of the Apache “corpse” and the problems of it getting stuck or potentially obstructing the player if it goes down randomly, I’m assuming that’s why the devs had to hard code the death scenes as such, correct? You said though that the Hunter-Chopper from HL2 had a failsafe SelfDestruct which caused it to explode eliminating this problem…I wonder why that is not present in the Apache? It seems like that would be the perfect solution (then again, I know nothing of the inner workings of the game and what other technical challenges might be present). Anyway, not trying to be unduly critical. The Apache showdown in Surface Tension is still badass on the whole…and it will be even more fun to fight when that glitch of the rockets ricocheting off it is fixed
The apache’s rockets still target the player, even if the SetRocketTarget command is used on a different enemy.
Yes, the Hunter-Chopper and Combine Gunships both have a failsafe for if they can’t get to the crash point. When their hitpoints are depleted, they automatically go into their death spiral and begin heading toward an info_target_helicopter_crash if one exists. Now, sometimes, they’ll explode on their own when they reach the crash point, but this isn’t a guaranteed event (it might, like the Apache, be based on hitting collision or something). So, as a failsafe, you can surround the crash point in a trigger_once for NPCs which calls SelfDestruct when triggered. As a second failsafe to that, you can also have SelfDestruct ready to go on a logic_timer or logic_relay that occurs OnShotDown, just in case you need to blow it up based on time because it got stuck on the way there.
There seem to be multiple differences with the Apache. It seems to default to either infinite or extremely high health. It will never go into the death spiral on its own. It requires a crash point. And it doesn’t obey SelfDestruct. Also, like I said, that fuselage gib is enormous. In the context of the cliffs in Surface Tension, there’s really not a problem with that, but anywhere else, that thing has a risk of blocking critical paths and generally getting in the way. And since there’s obviously no Gravity Gun, that’s kind of a problem when it happens!
It also has misleading flags and outputs in the FGD which aren’t used in the boss battle at all, like Enable Boss Stage Outputs and the mBossStage stuff. Suggesting that, for whatever reason, the Apache’s been through quite a lot of programming and reprogramming.
Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.