#[FIXED] Channeling Ability dont work with CastAbility()

1 messages · Page 1 of 1 (latest)

river badge
#

Iam trying do teleport ability like Underlord Ulti or twin gate portal. When i just use ability from ability Panel all works normally, but when i use ability via CastAbility work only OnSpellStart, and OnChannelThink OnChannelFinish dont work.

"engineer_teleport_use"
    {
        "BaseClass"                "ability_lua"
        "ScriptFile"            "abilities/heroes/engineer/engineer_teleport_use"
        "AbilityBehavior"        "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_CHANNELLED | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK | DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_CHANNEL | DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE"
        "IsCastableWhileHidden"         "1"
        "AbilityUnitTargetTeam"         "DOTA_UNIT_TARGET_TEAM_ENEMY"
        "AbilityUnitTargetFlags"        "DOTA_UNIT_TARGET_FLAG_INVULNERABLE"
        "AbilityCastAnimation"          "ACT_DOTA_GENERIC_CHANNEL_1"
        "MaxLevel"                      "1"
        "AbilityChannelTime"    "3"
    }```
```lua
engineer_teleport_use = class({})

function engineer_teleport_use:OnSpellStart()
    self.channel_time_elapsed = 0
    print("Test1")
    self:SetChanneling(true)
end
function engineer_teleport_use:OnChannelThink(interval)
    self.channel_time_elapsed = self.channel_time_elapsed + interval
    print(self.channel_time_elapsed)
end

function engineer_teleport_use:OnChannelFinish(bInterrupted)
    print("Test3")
end
pastel latch
#

You don't need manually SetChanneling your channeling ability for it to be channel, CastAbility() looks like some valve internal thing. Try caster:CastAbilityNoTarget(...) or just execute cast order (order should work correctly)

river badge
#

mhm, what am i doing not correctly ?

local options = { UnitIndex  = unit:entindex(), OrderType = DOTA_UNIT_ORDER_CAST_NO_TARGET, AbilityIndex = teleport_use_ability:GetEntityIndex()}
DeepPrintTable(options)
ExecuteOrderFromTable(options)```
```{
   UnitIndex                           = 193 (number)
   OrderType                           = 8 (number)
   AbilityIndex                        = 246 (number)
}``` 
but ability doesnt cast
iron fractal
#

did you have order errors in console?

river badge
river badge
#

i fixed it, i am doing with order, but add queue = true

#

Channeling Ability dont work with CastAbility() [FIXED]

river badge
#

[FIXED] Channeling Ability dont work with CastAbility()

frosty parcel
#

That's weird. I don't think you should need to do queue = true unless your unit has some thinking logic that causes it to be overridden

#

It being a queue might have issues later on, so it's probably better to check it properly. If you have a thinker, you might want to check whether it should issue orders. Maybe if it is currently casting an ability, it should just return?

quaint frigate
iron fractal
#

twin gates can be created with underlord portal base class and changing ability index in order filter i think it easiest way

frosty parcel
#

The correct way I think for this would be Order Filter though