Page 1 of 1

Advanced NPC Target Priority

Posted: Sat Sep 19, 2009 10:20 pm
by shiftey
Image

Red are targets.
Yellow are the NPC spawn points.

The red dots (A) represent nearby enemies. Both B's and C represent buildings that may or may not have enemies in them.

Now what I'm trying to accomplish is this:
I want the npcs (yellow) to spawn and fight any nearby targets (A). If no nearby targets exist, I want them to move to the nearest B target if it is occupied. If the nearest B target is not occupied then I want the npc to move to the C target. If no A target, B target, or C target exists, then I want the NPC to disappear (since they are antlions, burrow)

I want to try to get them to attack the nearby targets (A) through some type of AI entity rather than using triggers. The B and C targets I believe will need triggers though.

Posted: Sun Sep 20, 2009 2:00 am
by KON_Air
How about making them patrol with node sets? Or just enemy finders...

Posted: Mon Sep 21, 2009 3:38 am
by shiftey
I don't follow...Care to explain?

Posted: Mon Sep 21, 2009 4:41 am
by Tysn
Not completely sure how well this would work, but you could try placing same squad npc_enemyfinders in all those areas, and then enable/disable them through I/O depending on if there are enemies there or not. Though if you want it to be more AI driven you could use ai_relationships to change the hostile priorities of the different enemies, rather than the usual 99 value. As far as having them burrow afterward, there might be some kind of output in the npc_antlions that is fired whenever no enemies are in sight or when they have lost sight of the enemy to have them burrow.

Either way, it's probably a good idea to try and stick to the AI-driven squad system as much as possible, as using thing like schedules tends to cause problems with npcs freezing up or not reacting dynamically to events.