Default Ability Cast Time is set to cancelable and has a start casting event. The event just prints debug info and cancel cast. The event actor is set to starting object.

The event is triggered but the ability is still casted normally. That is, the Use Ability notification is printed and battle animation event is also triggered.

Another problem is the debug info is printed twice.
  • Where's the event used and how is it started?
    Make sure that the Starting Object actor is the combatant who's ability cast should cancel.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • The event is used in battle setting -> default ability cast time -> start casting event. Cast time is set to 0.001.

    When a combatant use an ability, the debug info in Start Casting event and Battle Animation event are printed but twice, which looks like the combatant uses the ability twice.

    Btw, the Starting Object is the User not the Target right?
  • It's wield. I also add a Call Function node which just print some texts to the Start Casting event. If the Actor is Starting Object, the Call Funtion just run once while the Debug node run twice. But if the Actor is Member with index 0, the Call Function will run twice too.

    It seems that the second time this event is triggered has no starting object.
  • edited December 4
    If your cast time is 0.001 seconds, the cast is probably finished before the event had a chance to cancel it.

    Will check out the double run.

    Edit: The casting event is only started once (per cast) - maybe this is simply due to multiple combatants using/casting the ability?
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I set the cast time to 2 but still the Cancel Cast Node not works.

    1 combatant for player and 1 combatant for enemy, both are the same kind combatant.

    Start Casting Event:
    1)Event Setting with Starting Object as Actor 0
    2)Debug "Cancel Cast"
    3)Cancel Ability Cast for Actor 0
    4)Call Function Node calls non static method Test() in a script component of the ability user. Target Object is set to the Actor 0

    The Test method:
    Combatant c = GetComponent().combatant;
    Debug.Log(c.GetName());

    Battle Animation:
    1)Debug "Use Ability"
    2)Consume Costs (setting for auto consume is No)

    The console log is like below:
    Cancel Cast
    The combatant name
    (wait 2 seconds)
    Use Ability
    Cancel Cast
    (wait 2 seconds)
    Use Ability

    The combatant name is only printed once.

    --------------------------------------------

    After some tests, I found the double run problem.

    The combatant also perform base attack when using ability, where the base attack was set to the same ability.

    But even I set the base attack to another ability, the combatant still do base attack when using ability.

    And Cancel cast node still not works.
  • Are you using auto attacks? Would need to be enabled in the combatant's Attacks / Abilities > Auto Attack Settings and in the Auto Attack Settings of the battle system type you're using.
    Auto attacks are used in the defined interval unless the combatant is using/casting another action.

    Did a quick test with a similar setup - and you're correct, the Cancel Cast node isn't working here, mainly due to bad timing (canceling the cast before it is even fully registered).
    Adding a Wait node before the Cancel Ability Cast node will solve this - even a 0 second wait (which continues the event in the next frame) should do the trick.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for solving one problem. Adding a wait 0s node works.

    For the double run problem. I don't set any auto attack. Not in Combatant setting neither in Battle system. I disabled auto attack in all battle system types by the way.

    If the ability is canceled, then the base attack will not perform.
  • How can I get data of triggered event in script during runtime? Eg. print the actor name in script

    Or how to print variables in debug node?

    Testing for me is too hard now unless I can use one of methods above. Didn't find any info in tutorial and didn't get much help in api document.
  • You can use text codes in the Debug node for that.
    But don't worry, you don't have to know them all, as you can use the buttons above the text field to add them :)

    Click on More to show additional options - e.g. actor information (like the name) can be added under the Actor button, information about things like items, abilities or game variables can be added via the Data button.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Okay

    The auto base attack when using ability problem is still not solved. I will do more test for it.

    What else may cause this?
  • Well, after printing the actor name, I finally got it.

    The base attack is from enemy. It is hard to distinguish since I use the same combatant as enemy.

    Thank for the help.
Sign In or Register to comment.