Building the better monster - Leaders Back

Building the better monster -Leaders


Leaders in this AI package add a few things onto the general AI, and should be explained. Leaders also should be figureheads of any NPC organisation/cave/hut/castle, as in fantasy realms, there is always someone bigger and better that is at the top! Leaders don't have to be diplomats, nor any kind of intelligent being. An ogre leader will just be the one who can hit the most heads, while an Elven leader may be the utter tactican, or "squad" leader, insipiring others with battlecries and going first.

For the actual AI, however, it does add a few extra little things. A few extra "Orders" and some inspired morale adds a little more depth, rather then them being just another tougher monster.

NOTE: Leader behaviours, I expect, don't work too well if there are more than a few giving orders, as they try and give out same orders again and again. It is scripted to not give same orders (or react to them again) in short timespans, but not large ones. One leader per group is more then enough.

Also, using the other behaviours can make them use thier abilities and things a bit better - I always put my lich's to use long range spells first, because otherwise they'll get into HTH with casting "Wail of the banshee" for example. They do recieve prioritory healing, obviously, and so might stay alive longer then normal. The appropriate spawn options are below:


SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_GROUP_LEADER, AI_OTHER_COMBAT_MASTER);

Leaders are special NPC's, or not, but they are more "intelligent" as a rule - they issue some commands (detailed below) and also inspire morale in those who see them. It is best they is never more then 1 in a group or dungeon, but there of course can be.

Information about what exactly the group leader flag does:

  • Adds morale - thier HD's worth, onto allies who can see them.
  • If they think it is wise, against great odds, they will make all thier command flee at once (a mass retreat)
  • They will call many creatures into combat with thier Boss shout - if set - be it alarms being raised, a message spell from a caster, or generally shouting and ordering! It is only done once (for performance issuses mainly)
  • A leader may choose to make allies target "Creature X". This means, especially in lower intelligence beings, that they try and kill one target who is dangerous, or just a pest. Doesn't bring perfect results, but who knows?
  • A leader may force an ally to run for help - IE be sent as a runner. This runner specailly shouts to allies to come and help the battle - or any remains of it, and will run off to groups of allies trying to bring (prepared) help.
  • Leaders are always raised first if a high-level cleric knows they are dead
  • Leaders are always healed first, dispite range or near-death status, as long as they are under the % each cleric needs to heal allies.



  • SetSpawnInCondition(AI_FLAG_OTHER_COMBAT_BOSS_MONSTER_SHOUT, AI_OTHER_COMBAT_MASTER);

    Boss shout. 1 time use - and only used if they are a "group leader", which calls all creatures in X meters (below) for battle! It is a sure-fire way to make sure, in a large dungeon, PC's take more care then to rush a boss creature. In some situations it doesn't work to well, be sure to test.



    SetAIInteger(AI_BOSS_MONSTER_SHOUT_RANGE, 60);

    Limit, in Meters, that the range of a boss shout is. It brings any non-fighting creatures to the "Leader" when he sees an enemy, and therefore will do combat. Basically, 10M = 1 NwN tile, so, putting to about 180 will get all monsters in any sized area, but will cause a lot of lag. 60 is still quite enough, although less means less creatures will come (obviously). Creatures must be spawned for this to work, of course.