function Trig_Roar_Copy_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001' and GetUnitTypeId(GetTriggerUnit()) != 'emtg'
endfunction
function SpellDuration takes nothing returns real //This function
return 20. //gives the duration of the Roar ability,
endfunction //so as to make the replacement afterwards.
function TimedReplace takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId (t)
local unit u = LoadUnitHandle (udg_RHash, id, StringHash("mainunit"))
local unit u1 = LoadUnitHandle (udg_RHash, id, StringHash("secunit"))
local real x = GetUnitX (u1)
local real y = GetUnitY (u1)
call SetUnitFacing (u, GetUnitFacing (u1))
call KillUnit (u1)
call RemoveUnit (u1)
call SetUnitX (u, x)
call SetUnitY (u, y)
call ShowUnit (u, true)
call SetPlayerAbilityAvailable (GetOwningPlayer(u), 'Agra', true)
call SelectUnitForPlayerSingle (u, GetOwningPlayer(u))
call FlushChildHashtable (udg_RHash, id)
call DestroyTimer (t)
set t = null
set u = null
set u1 = null
endfunction
function Trig_Roar_Copy_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX (u)
local real y = GetUnitY (u)
local real x1 = GetRectCenterX (udg_region)
local real y1 = GetRectCenterY (udg_region)
local unit a = CreateUnit (GetOwningPlayer(u), 'emtg', x1, y1, GetUnitFacing(u))
local timer t = CreateTimer()
local integer id = GetHandleId (t)
local real duration = SpellDuration()
local destructable d = CreateDestructable ('B000', x, y, 0, 0.001, 1)
call IssueTargetDestructableOrder (a, "grabtree", d)
call ShowUnit (u, false)
call SetUnitX (a, x)
call SetUnitY (a, y)
call SetUnitFacing (a, GetUnitFacing(u))
call SelectUnitForPlayerSingle (a, GetOwningPlayer(u))
call SetPlayerAbilityAvailable (GetOwningPlayer(u), 'Agra', false)
call SaveUnitHandle (udg_RHash, id, StringHash("mainunit"), u)
call SaveUnitHandle (udg_RHash, id, StringHash("secunit"), a)
call PolledWait (0.3)
call IssueImmediateOrder (a, "roar")
call TimerStart (t, duration, false, function TimedReplace)
set u = null
set a = null
set d = null
set t = null
endfunction
//===========================================================================
function InitTrig_Roar_Jass_With_Timer takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Roar_Copy_Conditions ) )
call TriggerAddAction( t, function Trig_Roar_Copy_Actions )
endfunction
function Trig_War_Club_Copy_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A06W' and GetUnitTypeId(GetTriggerUnit()) != 'U005'
endfunction
function SpellDuration takes nothing returns real //This function
return 20. //gives the duration of the Roar ability,
endfunction //so as to make the replacement afterwards.
function TimedReplace takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId (t)
local unit u = LoadUnitHandle (udg_RHash, id, StringHash("mainunit"))
local unit u1 = LoadUnitHandle (udg_RHash, id, StringHash("secunit"))
local real x = GetUnitX (u1)
local real y = GetUnitY (u1)
call SetUnitFacing (u, GetUnitFacing (u1))
call KillUnit (u1)
call RemoveUnit (u1)
call SetUnitX (u, x)
call SetUnitY (u, y)
call ShowUnit (u, true)
call SetPlayerAbilityAvailable (GetOwningPlayer(u), 'Agra', true)
call SelectUnitForPlayerSingle (u, GetOwningPlayer(u))
call FlushChildHashtable (udg_RHash, id)
call DestroyTimer (t)
set t = null
set u = null
set u1 = null
endfunction
function Trig_War_Club_Copy_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX (u)
local real y = GetUnitY (u)
local real x1 = GetRectCenterX (udg_region)
local real y1 = GetRectCenterY (udg_region)
local unit a = CreateUnit (GetOwningPlayer(u), 'U005', x1, y1, GetUnitFacing(u))
local timer t = CreateTimer()
local integer id = GetHandleId (t)
local real duration = SpellDuration()
local destructable d = CreateDestructable ('B000', x, y, 0, 0.001, 1)
call IssueTargetDestructableOrder (a, "grabtree", d)
call ShowUnit (u, false)
call SetUnitX (a, x)
call SetUnitY (a, y)
call SetUnitFacing (a, GetUnitFacing(u))
call SelectUnitForPlayerSingle (a, GetOwningPlayer(u))
call SetPlayerAbilityAvailable (GetOwningPlayer(u), 'Agra', false)
call SaveUnitHandle (udg_RHash, id, StringHash("mainunit"), u)
call SaveUnitHandle (udg_RHash, id, StringHash("secunit"), a)
call PolledWait (0.3)
call IssueImmediateOrder (a, "roar")
call TimerStart (t, duration, false, function TimedReplace)
set u = null
set a = null
set d = null
set t = null
endfunction
//===========================================================================
function InitTrig_War_Club takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_War_Club_Copy_Conditions ) )
call TriggerAddAction( t, function Trig_War_Club_Copy_Actions )
endfunction
Well D4rk G4nd4lf this works fine but how do i remove that tree animation when roar buff ends?