Is there a way to obtain a combatant's list of active abilities and the information for each ability (specifically the level)?
  • Hi @ChimpLogik,
    Something like this might help

    private void Start()
    {
    Combatant combatant = GamingIsLove.ORKFramework.ORKComponentHelper.GetCombatant(gameObject);
    if (combatant != null && combatant.Abilities.HasAbilities)
    {
    CombatantSetting combatantSetting = combatant.Setting;
    LearnAbility[] abilitiesLearnt = combatantSetting.abilityDevelopment.atLevel;
    foreach(LearnAbility learnAbility in abilitiesLearnt)
    {
    AbilityShortcut ability = learnAbility.ability.GetAbility(combatant);
    Debug.Log($"Ability: {ability.GetName()} level {ability.GetLevel()}");
    }
    }
    }

  • Worked like a charm! Thank you Nicholas :)
  • @ChimpLogik
    That wasn't me :D
    Also, that code will get the abilities from the combatant's settings, not the current list of abilities the combatant has.

    To get the combatant's current abilities:
    List<AbilityShortcut> abilities = combatant.Abilities.GetAbilities(UseableIn.Field, IncludeCheckType.Yes, false)
    This'll get all active abilities that are useable in the field, or use UseableIn.Battle for battle abilities, or UseableIn.Both for abilities that are available in both battle and field.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Whoops, my bad :)
    Thank you @RustedGames and thank you Nicholas!
Sign In or Register to comment.