I'm wanting to call a function in a Battle Event called in an Ability Animation that ideally would take the Ability that is currently being used as an argument - or at least the ID, or just contains code that gets that information by itself. I can't find any event nodes or methods/variables in the API that find/check/store the Ability that is currently being used (not in the currently running battle or the combatants involved), am I missing something or does it work in such a way that the information is harder to access?
  • The ability/item is available in its battle events via selected data, using the action selected key.

    You can't really use that in the function nodes, though - you'd have to write a custom node for that.

    You can check the ID of the last used ability via:
    combatant.Abilities.LastAbilityID
    But that's only available after the ability's action/events have ended.
    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!
  • I've only just been able to try working on this again.
    Knowing it can be accessed in selected data is fantastic, gives a starting point to work from. I've tried to put together a custom node but can't find any info/tutorial for doing so. I've looked at the source code and put together some node code I think would work but haven't been able to compile anything, likely due to my minimal coding knowledge (and of Visual Studio).
    I'm gonna keep trying to figure things out for myself, in the meantime is there a tutorial for writing/building custom nodes?

    (I'll post my code once I've confirmed it works for anyone looking for the same solution, nothing worse than finding a thread ending in "nevermind i fixed it")
  • This code should give you the ability stored in the action key:
    AbilityShortcut ability = SelectedDataHelper.GetFirst<AbilityShortcut>(baseEvent.SelectedData.Get("action"));
    Use it in the Execute function of your custom node :)
    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!
  • On-and-off attempts eventually got me close but that helped a tonne. Thank you so much!
    Changing a game variable proved to be a little trickier so I ended up getting around it by using that code to set a variable in a static control object I'm using and it's all sorted!
Sign In or Register to comment.