edited April 2023 in ORK Scripting
I want to deal multiple instances of damage to an enemy during an attack animation through the use of animation events. The animation is pretty long and has multiple strikes where each time a function is called that utilizes AbilityShortcut.Use(). The battle-system is turn-based.

I use the following code to trigger this but the AbilityShortcut.Use() is returning false and thus doing nothing. The variable combatant is the attacker while combatantList is the list of enemies that should be dealt damage. Both are not null. The code is executed while the schematic of the attack is active.
AbilityShortcut ability = combatant.Abilities.Get(ORK.Abilities.Get(currentAbilityId));
if (ability != null)
ability.Use(combatant, combatantList, false)

I'm probably missing something here. I assume the ability can't be used by the combatant in that moment for some reason.
Post edited by Grievous10 on
  • There's the really handy Combatant Animation Events component available that you can stick to your combatant's prefab.
    Check the component's inspectors, it has information (and buttons to copy the function names) on what's available to call from animation events, e.g. CalculateCurrentAction does the same as using the Calculate Action node for the combatant's current ongoing action.

    Keep in mind that this only works while the action is active - e.g. your animations should probably have the schematic wait for them to finish :)
    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!
  • Thanks for the information about the Combatant Animation Events component.
    Everything is working as intended now :)
Sign In or Register to comment.