jpw1991 / chebs-mercenaries

Cheb's Mercenaries adds mercenaries to Valheim that you can purchase with gold and upgrade with materials to fight (warriors, archers) or perform work (lumberjacks, miners).
The Unlicense
3 stars 3 forks source link

Aggression Modes: only attack if attacked #47

Open jpw1991 opened 8 months ago

jpw1991 commented 8 months ago

Aggression Modes

Right now guards just run off attacking everything - chasing deer, etc. It would be nice if there was a way to control minion behaviour so they respond differently to threats.

Example modes:

  1. Aggressive - Current behaviour - minions engage everything they see.
  2. Guard - Minions only engage after being attacked.
  3. Pacifist - Minions ignore all attacks.

Technical Implementation

Aggressive

No change - default behaviour.

Pacifist

Maybe in the creature's Update method, keep setting the target to null.

Guard

Similar to pacifist mode. Upon receiving damage, find the first nearest enemy and target it. Return it to pacifist mode after enemy is dealt with or out of range.