• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Huskar ultimate spell question!

Status
Not open for further replies.
Level 8
Joined
Dec 30, 2011
Messages
134
Idea taked from http://www.hiveworkshop.com/forums/triggers-scripts-269/move-animation-209927/
But hey, when we use SetUnitX/Y, it does not interrupt orders, right ?
And we still get to order the unit to move/do action whatever they want (which will deviate from original path), but in DotA, Huskar can never receive orders, how they did it ?

I mean when it is charging, no matter what order you gave it, it won't obey such as Move, Attack, etc.

Basically my question is:

HOW CAN I MOVE THE UNIT WITHOUT PAUSING IT AND AVOIDING ORDERS?
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
If I got that right, you want to be able to play a unit's animation while moving it and make it uncontrolable while moving. In order to achieve that, use channel as the base ability, check - something like - "interrupt other abilities" and use SetUnitX/Y to move it.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If I got that right, you want to be able to play a unit's animation while moving it and make it uncontrolable while moving. In order to achieve that, use channel as the base ability, check - something like - "interrupt other abilities" and use SetUnitX/Y to move it.

But in DotA, the unit can be controlled (order to Move, Attack, etc) but the unit does not seem to obey those orders.
Meaning it does not use Channel as base ability.
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
I felt like I had to do something to earn the +rep belatedly, so I made a little test map. not too sure about the code... it's late xP

JASS:
scope LifeBreak initializer init

globals
    private constant real speed = 30
    private hashtable hash = InitHashtable()
    private group LifeBreakers = CreateGroup()
    private group tempGrp = CreateGroup()
endglobals

function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Movement takes nothing returns nothing
    local unit u1
    local unit u2
    local real x1
    local real x2
    local real y1
    local real y2
    local real a
    call GroupAddGroup(LifeBreakers, tempGrp)
    loop
        set u1 = FirstOfGroup(tempGrp)
        exitwhen u1 == null
        call GroupRemoveUnit(tempGrp, u1)
        set u2 = LoadUnitHandle(hash, GetHandleId(u1), 0)
        set x1 = GetUnitX(u1)
        set x2 = GetUnitX(u2)
        set y1 = GetUnitY(u1)
        set y2 = GetUnitY(u2)
        if SquareRoot(Pow(y2 - y1, 2) + Pow(x2 - x1, 2)) > 100 then
            set a = Atan2(y2 - y1, x2 - x1)
            call SetUnitX(u1, x1 + Cos(a) * speed)
            call SetUnitY(u1, y1 + Sin(a) * speed)
            call IssueImmediateOrder(u1, "stop")
        else
            call GroupRemoveUnit(LifeBreakers, u1)
            call SetUnitPathing(u1, true)
        endif
        set u1 = null
        set u2 = null
    endloop
    call GroupClear(tempGrp)
endfunction

function Effect takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local unit u2 = GetSpellTargetUnit()
    call SetUnitPathing(u1, false)
    call GroupAddUnit(LifeBreakers, u1)
    call SaveUnitHandle(hash, GetHandleId(u1), 0, u2)
    set u1 = null
    set u2 = null
endfunction

function EndCast takes nothing returns nothing
    call SetUnitAnimationByIndex(GetTriggerUnit(), 17)
endfunction

function init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local timer tmr = CreateTimer()
    call TriggerAddAction(t, function Effect)
    call TriggerAddCondition(t, function Cond)
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    set t = CreateTrigger()
    call TriggerAddAction(t, function EndCast)
    call TriggerAddCondition(t, function Cond)
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_ENDCAST)
    call TimerStart(tmr, 0.03, true, function Movement)
    call FogMaskEnable(false)
    call FogEnable(false)
    set t = null
    set tmr = null
endfunction

endscope[/Hidden]
 
Last edited:
Status
Not open for further replies.
Top