Topic: `onCombatStarted` is not called for AI characters

  • Author
  • #29525
    Avatar photolordmidas

    This leads to bugs even in vanilla BB e.g. the perk_inspiring_presence never working for AI even though characters such as standard_bearer have them.

    In the end of the function spawn( _properties ) of tactical_entity_manager, you only iterate over the instances of the player faction to call the player.nut onCombatStart function. This has the consequence that the onCombatStarted() function of skills and items is never called for AI characters on the battlefield.

    Add a base function to actor.nut called onCombatStart which does the following to mirror the basic functionality from the respective player.nut function:

    function onCombatStart()

    Then, in the spawn function of tactical_entity_manager, instead of iterating only over the instances of the player faction, you iterate over all instances:

    foreach (faction in this.getAllInstances())
      foreach (actor in faction)

    The vanilla perk_inspiring_presence contains the following line in its onCombatStarted() function, which makes me believe that at some point even the Overhype dev ran into the issue of why this perk isn’t running for the AI, showing that this is a real problem:

    this.logInfo("inspiring presence: on combat started!");
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.