Detecting that the player has aggro'd enemies

Place to get help with not working mods / modding interface.
Post Reply
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Detecting that the player has aggro'd enemies

Post by PFQNiet »

Is there any way to determine that the player has caused some enemies to attack them? Or that enemies in general have begun an attack?

In my specific case I'm looking for a way of detecting that an enemy has been distracted from its default wandering.

Code: Select all

struct.entity.set_command{
  type = defines.command.compound,
  structure_type = defines.compound_command.return_last,
  commands = {
    {
      type = defines.command.go_to_location,
      destination = struct.spawn,
      radius = 10,
      distraction = defines.distraction.by_damage
    },
    {
      type = defines.command.wander,
      radius = 15,
      distraction = defines.distraction.by_enemy
    }
  }
}
It would be sufficient for me to know when this command has been interrupted by a distraction.

Post Reply

Return to “Modding help”