Friendly Fire

OverviewEdit

NPCs will normally respond to being attacked by the player by going into combat against the player.

However, there are cases where we want to avoid that behavior -- we don't want the player's allies turning on him every time they are struck by a stray arrow during a battle.

ImplementationEdit

Actor relationship towards player:

Neutral
  • Aggro immediately on player when attacked, in or out of combat.
Friend
  • During combat, the actor will not aggro on the player until a set number of hits has been done by the player within a set amount of time. Number of hits are tracked using the GetFriendHit function.
  • Outside of combat, immediately go into combat with the player when attacked by the player.
Ally
  • During combat, the actor will completely ignore hits from the player. They will never aggro on the player no matter how many times they are hit. For purposes of GetFriendHit, the count never goes above 1 (so they always react as if it was the first time you hit them).
  • Outside of combat, the actor will use the "friendly fire" combat procedure described above -- not aggro until a set number of hits has been reached.

Game SettingsEdit

Name Description Default value
fFriendHitTimer A friendly hit expires after this amount of time 10.0
fFriendMinimumLastHitTime A friendly hit is added only when this amount of time has passed since the last friendly hit 0.5
iFriendHitCombatAllowed The number of hits that are allowed by a friend when they are in combat before they will attack you 3
iFriendHitNonCombatAllowed The number of hits that are allowed by a friend when they are not in combat before they will attack you 0
iAllyHitCombatAllowed The number of hits that are allowed by an ally when they are in combat before they will attack you 1000
iAllyHitNonCombatAllowed The number of hits that are allowed by an ally when they are not in combat before they will attack you 3


NOTE: For the allowable hit game settings, any value 1000 or over is treated as infinite. In that case, the number of hits returned by GetFriendHit will always be 1.


Language: English  • 日本語