• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Fire nova

Status
Not open for further replies.
Level 3
Joined
Sep 29, 2015
Messages
31
Hello everybody, i want to do a spell, hero blast fire nova in a target point on the map, then fire nova arrive to the targhet she blows and stun enemies, so the problem is thath she dont works i dont know there is the problem, please help me to resolve it, Thank you

Code:
scope Pizdec2 initializer Init
define
    private RAWCODE = 'A098'
    private RAWCODE2 = 'A097' // abil2
    private RAWCODE3 = 'n03S' // gg
    private DMG = 100 * lvl
    private SPEED = 50.
    private EFF = "BlizzardEruption.mdx"
enddefine

private function Trig_Pizdec_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == RAWCODE
endfunction

private function Pizdec2 takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer h = GetHandleId(t)
    local unit u = LoadUnitHandle(udg_Hash, h, 1)
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x1 = LoadReal(udg_Hash, h, 3)
    local real y1 = LoadReal(udg_Hash, h, 4)
    local real dis = LoadReal(udg_Hash, h, 99)+SPEED
    if(DistanceBetweenCoords(x, y, x1, y1) <= 100) then
    call KillUnit(u)
    call DestroyEffect(AddSpecialEffect(EFF, x, y))
    local unit u2 = CreateUnit(GetOwningPlayer(u), RAWCODE3, x, y, 0.)
    call UnitAddAbility(u2, 'A097')
    call IssueImmediateOrder(u2, "stomp")
    call UnitApplyTimedLife(u2, 'BTLF', 5.)
    set u2 = null
    call PauseTimer(t)
    call DestroyTimer(t)
    call FlushChildHashtable(udg_Hash, h)
    else
    local real ang = LoadReal(udg_Hash, h, 5)
    call SetUnitPosition(u, PolarX(LoadReal(udg_Hash, h, 6), dis, ang), PolarY(LoadReal(udg_Hash, h, 7), dis, ang))
    call SaveReal(udg_Hash, h, 99, dis)
    endif
    set t = null
    set u = null
endfunction

private function Trig_Pizdec_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x1 = GetSpellTargetX()
    local real y1 = GetSpellTargetY()
    local unit u2 = CreateUnit(GetOwningPlayer(u), RAWCODE3, x, y, 0.)
    local timer t = CreateTimer()
    local integer h = GetHandleId(t)
    local integer lvl = GetUnitAbilityLevel(u, RAWCODE)
    call SetUnitPathing(u2, false)
    call SaveAgentHandle(udg_Hash, h, 1, u2)
    call SaveReal(udg_Hash, h, 2, DMG)
    call SaveReal(udg_Hash, h, 3, x1)
    call SaveReal(udg_Hash, h, 4, y1)
    call SaveReal(udg_Hash, h, 5, bj_RADTODEG * Atan2(y1 - y, x1 - x))
    call SaveReal(udg_Hash, h, 6, x)
    call SaveReal(udg_Hash, h, 7, y)
    call TimerStart(t, .05, true, function Pizdec2)
    set u = null
    set u2 = null
    set t = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition( function Trig_Pizdec_Conditions))
    call TriggerAddAction(t, function Trig_Pizdec_Actions)
    set t = null
endfunction
endscope
 
Status
Not open for further replies.
Top