How exactly does an NPC decide whether to attack another act

Post » Sun Dec 05, 2010 12:38 pm

Hi,

Has anyone found a precise formula for whether a given NPC will attack another (or the player), based on the disposition, personalities, distance, faction relations, aggression etc. of the two actors? Nehrim is getting lots of bug reports related to this (for a long time it was "enemies don't attack the player anymore when he has too high personality", but now that we set the personality disposition modifier to 0, it's "quest-relevant NPCs attack the player"). I would like to have reliable and complete information. Is aggression 10 always enough to make an NPC peaceful to the player, independent of his personality? Does a common faction always guarantee no fighting? Does decreasing the personality modifier mean that NPC's will be more often leaving their towns and going on rampage in the wilderness?

Thanks for any hints.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Sun Dec 05, 2010 8:25 pm

I don't know if there is an 'exact' formula since there are a large number of factors at work.

The http://www.uesp.net/wiki/Oblivion:Aggression is...
...if the NPC's disposition towards you or any other NPC drops more than five points below the NPC's aggression, the NPC will attack.

If you check the AI for most of the friendly NPCs (like merchants, etc.) you'll notice that they're all set to Aggression 5, which effectively prevents them from initiating an attack against the player. (An Aggression of 0 prevents them from defending themselves as well.)

So, to know whether or not an NPC will attack a player, you have to know what their disposition is, which http://www.uesp.net/wiki/Oblivion:Disposition.

Faction modifiers can raise or lower disposition, but only the lowest faction modifier applies. So, if the player is a member of a faction that gives him a +10 disposition modifier toward an NPC, and is also a member of a faction that gives him a -20, only the -20 applies. If the player has his weapon drawn and talks to an NPC that doesn't like his faction, it's not hard to push his disposition below 10. Committing crimes, having a high infamy, etc., can also be factors.

Personality determines the starting disposition toward the player and works in conjunction with the personality of the NPC (I've never worked out the base value, though). A player with a high Personality is http://www.uesp.net/wiki/Oblivion:Personality. Apparently, this was a problem even with vanilla OB, which is why enemy NPCs usually have an Aggression of 100.

If you want to ensure that NPCs attack players even with high Personality, you're best to assign them to factions with a high negative disposition modifier toward the PlayerFaction and ensure that their Aggression is > 5. For NPCs you don't want attacking the player, ensure that their Aggression is < 5. The tricky NPCs are the ones you want to be aggressive enough to attack the player, but not so aggressive that they attack other NPCs. If you put all of these NPCs into a faction with a high disposition modifier toward each other, you should be able to keep them in-line. In any case, you're going to have to play around with the numbers a bit to get a system that works for you.

hth
User avatar
Scott
 
Posts: 3385
Joined: Fri Nov 30, 2007 2:59 am

Post » Sun Dec 05, 2010 2:26 pm

Thanks, though I knew most of it. I have now... kind of solved the Nehrim problem by setting the fDispTargetPerBase setting to 35, so the world behaves as if every NPC would have 35 personality. It remains to be seen how this affects fighting. Do you happen to know whether creatures are affected by fDispTargetPerBase?
User avatar
*Chloe*
 
Posts: 3538
Joined: Fri Jul 07, 2006 4:34 am

Post » Sun Dec 05, 2010 2:55 pm

I have now... kind of solved the Nehrim problem by setting the fDispTargetPerBase setting to 35, so the world behaves as if every NPC would have 35 personality. It remains to be seen how this affects fighting.

Are you sure this is how the setting works? I thought the fDispTargetPerBase and fDispActorPerBase were weights. Wouldn't setting fDispTargetPerBase to 35 just make the target's Personality worth 35x as much as the actor's for calculating the final disposition? (Ie. always weight it in favor of the target?) I've never played around with these values, so I have no idea. Just something I think you should check if you haven't done so already.

Do you happen to know whether creatures are affected by fDispTargetPerBase?

Again: you'd have to check it. Creatures have Personality (most of them have a setting of 10) and Aggression (which varies a bit) so I assume they use the same formula to determine whether or not to attack as NPCs. I'd probably set up a testing area with different NPCs and creatures and run checks on their disposition in-game to see how your changes are affecting gameplay.

Also, I'm not sure that changing a game setting is an ideal solution to the problem as that will affect other areas of gameplay that aren't immediately apparent. Since disposition affects several areas (combat, haggling, persuasion, etc.) and is influenced by several factors (race bias, faction bias, fame/infamy, etc.) your changes could have unintended side-effects and introduce new problems. My recommendation is to duplicate the errors and study why players are having this problem with actors in Nehrim. I haven't played it, so I can't really comment on it, but unless it makes gameplay changes to how disposition and/or how the combat decision works, it seems reasonable to assume that vanilla methods for controlling NPC disposition/hostility will work for Nehrim as well (ie. faction membership, personality and aggression settings).

If you have NPCs you don't want attacking the player, set their Aggression to 5. If you have NPCs you always want attacking the player, set their Aggression to 100. (Of course, these NPCs will then always attack other NPCs unless they are part of a faction that cancels out the aggression.) If you want NPCs to play nicely with other NPCs but always attack the player, add the NPC to a faction that has a high negative reaction to the PlayerFaction (or alternately add the player to a hidden faction with a high negative disposition modifier if you don't want to affect the PlayerFaction directly). I'm sure if you play around with the numbers a bit, you'll find a system that works without affecting gameplay across the board.

If you have a player with a Personality of 100, lots of NPCs/creatures probably won't be motivated to attack him. That's the way Personality is supposed to work, though, in vanilla. That's supposed to be a feature, not a glitch.
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am


Return to IV - Oblivion