JASS:
scope Grab
public function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A044'
endfunction
private function ValidEnemy takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and IsUnitAliveBJ(GetFilterUnit()) and damage_source != GetFilterUnit()
endfunction
private function KillTree takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
private function NotOn takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetUnit(t, "caster")
call SetUnitPathing(u, true)
call FlushChild(t)
call DestroyTimer(t)
endfunction
private function Toss takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit victim = GetUnit(t, "victim")
local location loc = GetUnitLoc(victim)
local unit caster = GetUnit(t, "caster")
local location offset = PolarProjectionBJ(loc, 10, GetReal(t, "angle"))
local real speed = GetReal(t, "speed")
local unit dummy
if RAbsBJ(GetLocationZ(offset)-GetLocationZ(loc))<4 then
call SetUnitPositionLoc(victim, offset)
endif
call SetUnitFlyHeight(victim, GetUnitFlyHeight(victim)+speed, 99999999)
call SetReal(t, "speed", speed-1)
call EnumDestructablesInCircleBJ( 250, offset, function KillTree )
if GetUnitFlyHeight(victim)-GetUnitDefaultFlyHeight(victim)<20 then
set dummy = CreateUnitAtLoc(GetOwningPlayer(caster), 'h00E', offset, 0)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitAddAbility(dummy, 'A045')
call SetUnitAbilityLevel(dummy, 'A045', GetUnitAbilityLevel(caster, 'A044'))
call IssueImmediateOrder(dummy, "stomp")
call DestroyEffect(AddSpecialEffectLoc("war3mapImported\\Earth Stomp_v.mdx", offset))
if IsUnitEnemy(victim, GetOwningPlayer(caster)) then
call UnitDamageTarget(caster, victim, 50*GetUnitAbilityLevel(caster, 'A044'), true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
endif
call PauseUnit(victim, false)
call SetUnitPathing(victim, true)
call SetUnitFlyHeight(victim, GetUnitDefaultFlyHeight(victim), 9999999)
call FlushChild(t)
call DestroyTimer(t)
endif
call RemoveLocation(loc)
call RemoveLocation(offset)
endfunction
private function Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = GetUnit(t, "caster")
//local location start = GetLocation(t, "start")
local real angle = GetUnitFacing(caster)
local integer eval = GetInteger(t, "eval")
local location loc = GetUnitLoc(caster)
local location offset = PolarProjectionBJ(loc, 10, angle)
local group g
local unit victim = GetUnit(t, "victim")
local location vloc = GetUnitLoc(victim)
local real face
// local unit dummy = GetUnit(t, "dummy")
set damage_source = caster
set eval=eval+1
call SetInteger(t, "eval", eval)
call SetUnitX(caster, GetLocationX(offset))
call SetUnitY(caster, GetLocationY(offset))
// call SetUnitPositionLoc(dummy, offset)
// call SetUnitFacing(dummy, angle)
if victim!=null and RAbsBJ(GetLocationZ(offset)-GetLocationZ(vloc))<4 then
call SetUnitPositionLoc(victim, offset)
endif
if eval==60 then
//call RemoveLocation(start)
set g = CreateGroup()
call GroupEnumUnitsInRangeOfLoc(g, offset, 200, Condition(function ValidEnemy))
set victim = GroupPickRandomUnit(g)
call DestroyGroup(g)
if victim==null then
call SetUnitFlyHeight(caster, 150, 150)
// call SetUnitFlyHeight(dummy, 150, 150)
else
call SetUnitFlyHeight(caster, 500, 624)
call UnitAddAbility(victim, 'Arav')
call UnitRemoveAbility(victim, 'Arav')
call SetUnitFlyHeight(victim, 500, 624)
// call SetUnitFlyHeight(dummy, 500, 624)
call SetUnitPathing(victim, false)
call PauseUnit(victim, true)
call SetUnit(t, "victim", victim)
endif
call PauseUnit(caster, false)
call IssuePointOrder(caster, "move", GetLocationX(offset)+Cos(bj_DEGTORAD*angle)*600, GetLocationY(offset)+Sin(bj_DEGTORAD*angle)*600)
endif
if eval==100 then
call SetUnitFlyHeight(caster, GetUnitDefaultFlyHeight(caster), 300)
call SetUnitMoveSpeed(caster, GetUnitDefaultMoveSpeed(caster))
call DestroyEffect(GetEffect(t, "ef1"))
//call DestroyEffect(GetEffect(t, "ef2"))
// call KillUnit(dummy)
call FlushChild(t)
call DestroyTimer(t)
if victim!=null then
set t = CreateTimer()
call TimerStart(t, 0.02, true, function Toss)
call SetUnit(t, "victim", victim)
set face = GetRandomReal(angle-30, angle+30)
if face>360 then
set face = face-360
endif
if face<0 then
set face = face+360
endif
call SetReal(t, "angle", face)
call SetReal(t, "speed", 8)
call SetUnit(t, "caster", caster)
endif
endif
call RemoveLocation(offset)
call RemoveLocation(loc)
call RemoveLocation(vloc)
endfunction
public function Actions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local real angle = AngleBetweenPoints(loc, GetSpellTargetLoc())
local timer t = CreateTimer()
local timer on = CreateTimer()
// local unit dummy = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 'h00K', loc, GetUnitFacing(GetTriggerUnit()))
//call AddSpecialEffectTarget("Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionMissile.mdl", GetTriggerUnit(), "foot,left")
call SetUnitFacing(GetTriggerUnit(), angle)
call UnitAddAbility(GetTriggerUnit(), 'Arav')
call UnitRemoveAbility(GetTriggerUnit(), 'Arav')
// call UnitAddAbility(dummy, 'Arav')
// call UnitRemoveAbility(dummy, 'Arav')
call SetUnitFlyHeight(GetTriggerUnit(), 10, 100)
// call SetUnitFlyHeight(dummy, 10, 100)
call SetUnitPathing(GetTriggerUnit(), false)
call PauseUnit(GetTriggerUnit(), true)
call SetUnitMoveSpeed(GetTriggerUnit(), 1)
call TimerStart(t, 0.02, true, function Move)
call SetUnit(t, "caster", GetTriggerUnit())
call SetReal(t, "angle", angle)
//call SetLocation(t, "start", loc)
call SetInteger(t, "eval", 0)
// call SetEffect(t, "ef1", AddSpecialEffectTarget("war3mapImported\\TornadoMissile.mdx", GetTriggerUnit(), "foot, left"))
//call SetEffect(t, "ef2", AddSpecialEffectTarget("war3mapImported\\TornadoMissile.mdx", GetTriggerUnit(), "foot, right"))
//call SetUnit(t, "dummy", dummy)
call TimerStart(on, 4, false, function NotOn)
call SetUnit(on, "caster", GetTriggerUnit())
call SetTimer(GetTriggerUnit(), "ongrab", on)
call RemoveLocation(loc)
endfunction
endscope
//===========================================================================
function InitTrig_Terror_of_the_Skies takes nothing returns nothing
set gg_trg_Terror_of_the_Skies = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Terror_of_the_Skies, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Terror_of_the_Skies, Condition( function Grab_Conditions ) )
call TriggerAddAction( gg_trg_Terror_of_the_Skies, function Grab_Actions )
endfunction
So, Here is the spell. It works before but now, whenever I cast it.
The Caster just land on the ground then thats it. Nothing happens. It is supposed to glide.
I guess some codes has collided that made this spell doesn't work. But because of me added so much stuff, I don't know what is the reason now why it doesn't work. Can someone help me?