Author Topic: NPC AI  (Read 1041 times)

Legacy_Malifaun

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
NPC AI
« on: September 26, 2011, 03:43:29 pm »


               What influences the ais choice of target ?

After a long break I dug out old nwn again and play the plague campaign with a dwarven fighter and Tomi as henchman. I also remember why I never liked Tomi much: he seems to be an aggro magnet. In any fight that isnt a pushover he is just a liablility, as everything attacks him till hes dead, mostly ignoring me.
I thought that the ai might pick low AC over high and made sure  Tomis AC is > my fighters, but it doesnt help.
I am using TonyKs hench ai, if that makes a difference.

There must be a reason why the npcs switch to my hench even if I go in first and initiate the melee. What is it ?
               
               

               
            

Legacy_Mystery X

  • Full Member
  • ***
  • Posts: 248
  • Karma: +0/-0
NPC AI
« Reply #1 on: September 26, 2011, 11:48:58 pm »


               There is some discussion of this in the party members - out of control thread.
               
               

               
            

Legacy_Malifaun

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
NPC AI
« Reply #2 on: September 27, 2011, 09:29:02 am »


               Thanks for the link, though the thread deals with hench behaviour rather than monster behaviour. Except for a comment by WebShaman in the end where he suggests that both low AC and low hit points might influence monster target choice. Well, that might explain what happens. It seems when the duo is fighter + Tomi, Tomi will be tanking unless you deliberately cripple your character.

For the Swords of Never fight, I told him to leave party before I enetered :/. When I could afford it, I bought the greater swordsmans belt and had him equip it, so now he is officially the tank.
               
               

               
            

Legacy_jmlzemaggo

  • Hero Member
  • *****
  • Posts: 1869
  • Karma: +0/-0
NPC AI
« Reply #3 on: September 27, 2011, 01:32:12 pm »


               No tech here, just a player, and I also have that feeling that AI NPCs go for the weakest one first among a group of opponents, only if it's not too far. But most of the time the closest one.
I never saw a monster running for the wizard at the end of the map. I'm always front row anyway, even with casters, but I run fast. They will go for me first, being the one theu followed, the one who "triggered" them, if I rejoign with my companions, but switch to one of them, 2 seconds after, if I keep fleeing.
And die.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
NPC AI
« Reply #4 on: September 27, 2011, 04:02:58 pm »


               The standard AI doesn't take distance into consideration.  It's why you can get a creature to ping-pong back and forth between two archers, without ever getting near enough to either to threaten them.
               
               

               
            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
NPC AI
« Reply #5 on: September 27, 2011, 06:40:15 pm »


               Compare the hitpoints between your PC & the hench (i.e. Tomi). 

I have no way of reading AI code mind you, but, in general, if two hostiles (in this case, your party would be hostile vs. the monsters) are perceived at the same time, the attack is usually made against the one with the lowest hitpoints.  This would seem to account for the enemy's proclivity to attack a wiz or sorc first in a mixed party since they typically have very low CON.  As I indicated, this is only based on personal observation rather than by deciphering the AI code itself.  To test this hypothesis, see if you can raise Tomi's HPs with a few Endurance potions, hopefully higher than your PC's level, then engage a new group of combatants to see if the attack preference changes.

Another method you might try with Tomi is keeping him in stealth.  At least he should get a few more sneak in that way and may remain unattacked longer.
               
               

               
            

Legacy_Malifaun

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
NPC AI
« Reply #6 on: September 28, 2011, 08:21:09 pm »


               Testing for hit points I did consider, but the dwarf has 18 con and I saw no easy way of getting Tomis hp above that. Act 2 was much better, mostly because more and more fights were of the "pushover" type. Also the belt helps, and while it is an ugly solution to have Tomi tank, it works.
The stealth idea is excellent! I am going to try that.