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.
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!
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 seems that the second time this event is triggered has no starting object.
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?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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.
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!
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.
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.
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!
The auto base attack when using ability problem is still not solved. I will do more test for it.
What else may cause this?
The base attack is from enemy. It is hard to distinguish since I use the same combatant as enemy.
Thank for the help.