npc_apache help

I’m testing the npc_apache in hammer, but when I try to see them in action, they don’t do anything. I can’t get them to attack me, or anyone else, whether on a path_track or not. Why? Do I have to trip certain flags?

-snip

EDIT:Misread, my bad.

Maybe if I wasn’t clear, I’m using the hammer editor shipped with Black Mesa in its bin, and I made a simple map with an apache helicopter in it. When I start up the map immediately after compilation, the apache would just ignore me and other npcs as it flies around, though I can blow it up with heavy weapons. I sometimes map for hl2/gmod, and I’m familiar with the combine npcs, but is there any extra set-up I have to do to get the apache to a fighting state, compared to the combine heli/gunship? Any extra entities I need to add?

Also, my map really is that simple; it’s just the spawn point, an apache, some path_tracks for it to fly on, lights to see, and a bunch of houndeyes to see if the helicopter would blast them.

I believe that by default the Apache does not hate and want to kill the player/anything else. Use ai_relationship to make it hate whatever you want it to kill, and you can also use aiscripted_schedule to tell it to attack that thing. !player is the player’s name, otherwise use the entities’ target/classname.

Oh yeah, I tried to get two apaches to shoot each other with an ai_relationship set to hate each other, first by using their targetnames I assigned them, then using classnames, but they didn’t shoot each other. I set the priority to 1, and radius to 0. The reason I chose 0 is because I thought that would mean everywhere. Correct me if I’m wrong, but how do I set the radius to everywhere? Just enter a value bigger than the map?

P.S. Asking an osprey to startpatrol on a track crashes the game and maybe the computer screen, and it doesn’t turn.

Setting the Search Radius to 0 is how it’s done in normal Half-Life 2, so I don’t know why BM would be different. Perhaps there is something about the Apache’s targeting that assumes that the target is a player or human-like thing, or that the target has something which another Apache lacks.

I’m just going to play the game to the apache fight to intercept the mapname, then decompile and see how the Crowbars did it…

IIRC bm_c2a5a is the Apache fight on the dam, if that helps you.
Look forward to someone figuring out how to get it to work and letting the rest of us know! :slight_smile:

Unfortunately, the decompile of those maps failed.

Ugh. Hope someone knows how to get the choppers properly working…

I just tried myself but it seems there are some things I am missing.

I’m not sure what issues you guys are having. I got it to work in about 5 minutes.

  1. Place a bunch of info_node_air.
  2. Create an ai_relationship that sets npc_apache to hate !player, and make sure it starts active.
  3. Create an aiscripted_schedule that targets npc_apache with a goal entity of !player, such that the schedule sets the goal entity to ENEMY, sets the AI state to COMBAT, and with an interruptability of death.
  4. Fire the aiscripted_schedule with a “startschedule” input to get the apache to attack.
    Test/example VMF here: https://dl.dropboxusercontent.com/u/14565853/maps/apachetest.vmf

That exactly what I did and it did not work here.

Well you botched it somehow, I followed the exact instructions and it’s working fine.

EDIT:
I’d recommend getting it working yourself first (give a man a fish, etc.), but here, here’s a prefab.

Figured out the problem.

A keyvalue was forgotten.

To be fair, I didn’t try it myself. I thought the question was about it not shooting at another Apache (but nevertheless apparently “hating” the other Apache enough to look at it). What you describe would clearly work if the !player was the intended target.

And maybe it would work if it was another Apache too. :wink:

Also, I need a way to make the apache missiles not hit me, even when they’re attacking someone else.

Interestingly, I haven’t been successful in getting the Apache to target an npc_bullseye. The same relationship/schedule setup, substituting !player for the bullseye name, works fine.

Because for some reason, to get the npc_apache or any other npc entities to target a bullseye, you will need to set the SetRelationship output.

Let’s say you were using a logic_relay:
OnTrigger
<Apache’s name>
SetRelationship
<Bullseye’s name> HT_9999

Check this out: https://developer.valvesoftware.com/wiki/List_of_default_AI_relationships

How odd. They respond to the input, but not a separate ai_relationship?

Well, you can’t make an Apache a Template NPC either so its programming must be… unique. :wink: Turns out, I don’t need the Bullseyes because it does what I want it to do without them, but it is quite interesting.

In all seriousness, why does the apache require such an extensive setup? Shouldn’t it be able to pick its own targets?

There should be some documentation for bms entities.

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.