Hello,
Having some problems with my channel ability.
Basically, on channel cast the print "Channel ability casted" works, just as intended.
But for some reason, the other print also plays on initial, but its only intended to show on cancel/finished the channel ability. I tried some stuff like UnitRemoveAbility, but it does not work. So my theory is that "caster" is not correct. What is a good way to store a players only hero in a variable? Perhaps then it will work.
Having some problems with my channel ability.
Code:
package main
import ClosureEvents
import OrderIds
import Jump
unit caster
init
// caster = GetTriggerUnit() <-- Tried this both with and without, still same result
EventListener.add(EVENT_PLAYER_UNIT_SPELL_CHANNEL) ->
if EventData.getSpellAbilityId() == 'A000'
print("Channel ability casted. ")
UnitRemoveAbility(caster, 'A001') // <-- This works as intended
EventListener.add(EVENT_PLAYER_UNIT_SPELL_CHANNEL) ->
if EventData.getSpellAbilityId() == 'A000'
if caster.getCurrentOrder() != Orders.channel or not caster.isAlive()
print("Channel ability cancelled. ") // <-- This still plays on initial cast, I do not want that only on cancel channel or when it finishes
Basically, on channel cast the print "Channel ability casted" works, just as intended.
But for some reason, the other print also plays on initial, but its only intended to show on cancel/finished the channel ability. I tried some stuff like UnitRemoveAbility, but it does not work. So my theory is that "caster" is not correct. What is a good way to store a players only hero in a variable? Perhaps then it will work.