/////////////////////
//Debug Handle
//////////////////////
//function CheckHandleLeaksCBF takes nothing returns nothing
//local location tp=Location(0.0,0.0)
//call BJDebugMsg("Handle num is "+I2S((GetHandleId(tp)-1048576)))
//call RemoveLocation(tp)
//set tp=null
//endfunction
//function CheckHandleLeaks takes nothing returns nothing
//local timer t=CreateTimer()
//call TimerStart(t,1.0,true,function CheckHandleLeaksCBF)
//set t=null
//endfunction
//-------------------------------------
function SmartCameraPanND takes player whichPlayer, location loc, real duration returns nothing
local real dist
local real x=GetLocationX(loc)
local real y=GetLocationY(loc)
if (GetLocalPlayer() == whichPlayer) then
set dist = SquareRoot(((GetCameraTargetPositionX() - x) * (GetCameraTargetPositionX() - x)) + ((GetCameraTargetPositionY() - y) * (GetCameraTargetPositionY() - y)))
if (dist >= bj_SMARTPAN_TRESHOLD_SNAP) then
call PanCameraToTimed(x, y, 0)
elseif (dist >= bj_SMARTPAN_TRESHOLD_PAN) then
call PanCameraToTimed(x, y, duration)
endif
endif
endfunction
function RangeToZ takes real range returns real
local real intem=((8.28186*(Pow(10.0,10.0)))-(113.6364*range*range)-(102272.76*range))
return (287822.0403-SquareRoot(intem))
endfunction
function myinito takes nothing returns nothing
local integer i=0
loop
exitwhen i==11
set udg_Cat_t[i]=0
set udg_alive[i]=0
set i=i+1
endloop
endfunction
//function testloc takes nothing returns nothing
//local integer i=0
//loop
// exitwhen i==10
// call CreateUnitAtLoc(Player(i),'o001',udg_battleloc[i],270.0)
// set i=i+1
//endloop
//endfunction
function ShufflePlayerBattleLoc takes integer n returns nothing
local real array rn
local integer i=0
local integer i2=0
local real cn
local integer array gn
loop
exitwhen i==5
set rn[i]=GetRandomReal(1.0,1000.0)
set gn[i]=0
set i=i+1
endloop
loop
exitwhen i2==5
set cn=rn[0]
set i=0
loop
exitwhen i==5
if ( rn[i] > cn) then
set gn[i2]=i
set cn=rn[i]
endif
set i=i+1
endloop
set rn[gn[i2]]=0
set i2=i2+1
endloop
set udg_PlayerBattleLoc[(n+0)]=udg_battleloc[(gn[0]+n)]
set udg_PlayerBattleLoc[(n+1)]=udg_battleloc[(gn[1]+n)]
set udg_PlayerBattleLoc[(n+2)]=udg_battleloc[(gn[2]+n)]
set udg_PlayerBattleLoc[(n+3)]=udg_battleloc[(gn[3]+n)]
set udg_PlayerBattleLoc[(n+4)]=udg_battleloc[(gn[4]+n)]
endfunction
function RegrowTree takes nothing returns nothing
local integer ii=1
loop
exitwhen ii>=89
if (udg_Dest[ii]!=null) then
if (GetDestructableLife(udg_Dest[ii])<50.00) then
call DestructableRestoreLife(udg_Dest[ii],GetDestructableMaxLife(udg_Dest[ii]), true)
endif
endif
set ii=ii+1
endloop
endfunction
function GarragePan takes nothing returns nothing
local timer t=GetExpiredTimer()
local player p=LoadPlayerHandle(udg_Hash,GetHandleId(t),0)
local location loc=LoadLocationHandle(udg_Hash,GetHandleId(t),1)
call SmartCameraPanND(p,loc,1.00)
call FlushChildHashtable(udg_Hash,GetHandleId(t))
call DestroyTimer(t)
set t=null
set loc=null
endfunction
function MoveCatapultToGarrage takes nothing returns nothing
local integer i=0
local integer CatID=0
local timer t=null
loop
exitwhen i==10
if (udg_alive[i]==0) then
if (udg_Cat_t[i]==1) then
set CatID='o000'
elseif (udg_Cat_t[i]==2) then
set CatID='e000'
endif
if (CatID!=0) then
set udg_Catapult[i]=CreateUnitAtLoc(Player(i),CatID,udg_garrage[i],90.00)
set udg_alive[i]=1
set t=CreateTimer()
call SavePlayerHandle(udg_Hash,GetHandleId(t),0,Player(i))
call SaveLocationHandle(udg_Hash,GetHandleId(t),1,udg_garrage[i])
call TimerStart(t,2.00,false,function GarragePan)
set t=null
set CatID=0
endif
elseif (udg_alive[i]==1) then
call SetUnitPositionLoc(udg_Catapult[i],udg_garrage[i])
call SetUnitState(udg_Catapult[i],UNIT_STATE_LIFE,GetUnitState(udg_Catapult[i],UNIT_STATE_MAX_LIFE))
set t=CreateTimer()
call SavePlayerHandle(udg_Hash,GetHandleId(t),0,Player(i))
call SaveLocationHandle(udg_Hash,GetHandleId(t),1,udg_garrage[i])
call TimerStart(t,2.00,false,function GarragePan)
set t=null
endif
set i=i+1
endloop
endfunction
function StartRound takes nothing returns nothing
local integer i=0
call RegrowTree()
call ShowUnit( gg_unit_n000_0022,false)
call ShowUnit( gg_unit_n000_0023,false )
call ShufflePlayerBattleLoc(0)
call ShufflePlayerBattleLoc(5)
loop
exitwhen i==10
call SetUnitPositionLoc(udg_Catapult[i],udg_PlayerBattleLoc[i])
call PauseUnit(udg_Catapult[i] ,true)
call SmartCameraPanND(Player(i),udg_PlayerBattleLoc [i],1.00)
set i=i+1
endloop
call DisplayTextToForce( GetPlayersAll(),"3")
call TriggerSleepAction(1.00)
call DisplayTextToForce( GetPlayersAll(),"2")
call TriggerSleepAction( 1.00)
call DisplayTextToForce( GetPlayersAll(),"l")
call TriggerSleepAction(1.00)
call DisplayTextToForce( GetPlayersAll(), ( "Round " + ( I2S(udg_Round) + " starts!" ) ) )
call EnableTrigger( gg_trg_RoundVictory)
set udg_battle=true
set i=0
loop
exitwhen i==10
call PauseUnit(udg_Catapult[i],false)
set i=i+1
endloop
endfunction
////////////////////////
//RockCBF
////////////////////////
function AttackAnim takes nothing returns nothing
call SetUnitAnimation(LoadUnitHandle(udg_Hash,GetHandleId(GetExpiredTimer()),0),"Attack")
call FlushChildHashtable(udg_Hash,GetHandleId(GetExpiredTimer()))
call DestroyTimer(GetExpiredTimer())
endfunction
function RockCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group BombardGroup=null
local unit current=null
local real te=LoadReal(udg_Hash,TimerID,10)
local integer i=1
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,100.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=80.00) then
call UnitDamageTarget(Proj,current,150.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,75.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<80.00) then
if (GetDestructableLife(udg_Dest[i])>25.10) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"stand hit")
endif
call SetDestructableLife(udg_Dest[i],(GetDestructableLife(udg_Dest[i])-25.00))
elseif (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(0.60)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRangeOfLoc(BombardGroup,ProjLoc,100.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-GetLocationX(ProjLoc)) * (GetUnitX(current)-GetLocationX(ProjLoc)) + (GetUnitY(current)-GetLocationY(ProjLoc)) * (GetUnitY(current)-GetLocationY(ProjLoc))))<=80.00) then
call UnitDamageTarget(Proj,current,150.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,75.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<80.00) then
if (GetDestructableLife(udg_Dest[i])>25.10) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"stand hit")
endif
call SetDestructableLife(udg_Dest[i],(GetDestructableLife(udg_Dest[i])-25.00))
elseif (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(0.60)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
/////////////////
//Glaive CBF
////////////////////
function GlaiveCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local unit Launcher=LoadUnitHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local real NearestDistanceEver=60.00
local unit NearestUnit=null
local unit current=null
///Destructable destroy mechanism variables
local real NearestDestDist=50.00
local destructable NearestDest=null
local integer i=1
///----------------------------------------
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,50.00,null)
if (FirstOfGroup(HittingGroup)!=null) then
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if ((current!=Launcher)and(GetUnitState(current,UNIT_STATE_LIFE)>0.00)) then
if (DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)<NearestDistanceEver) then
set NearestUnit=current
set NearestDistanceEver=DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)
endif
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
endif
if (NearestUnit!=null) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
if udg_battle then
call UnitDamageTarget(Proj,NearestUnit,120.00,true, false,ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if ((SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<NearestDestDist) and (GetDestructableLife(udg_Dest[i])>0.00)) then
set NearestDest=udg_Dest[i]
set NearestDestDist=SquareRoot((x - GetDestructableX(udg_Dest[i])) * (x - GetDestructableX(udg_Dest[i])) + (y - GetDestructableY(udg_Dest[i])) * (y - GetDestructableY(udg_Dest[i])))
endif
endif
set i=i+1
endloop
if (NearestDest!=null) then
call DestroyTimer(t)
if ((GetDestructableTypeId(NearestDest)=='YTct') or (GetDestructableTypeId(NearestDest)=='ATtc') or (GetDestructableTypeId(NearestDest)=='KTtw')) then
call SetDestructableAnimation(NearestDest,"death")
endif
call KillDestructable(NearestDest)
call KillUnit(Proj)
call FlushChildHashtable(udg_Hash,TimerID)
set NearestDest=null
endif
if (time>=1.0) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call RemoveUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
set Launcher=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set NearestUnit=null
set current=null
endfunction
//////////////////
///Sludge CBF
/////////////////
function SludgeCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
/////////////////////local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group BombardGroup=null
local unit current=null
local real te=LoadReal(udg_Hash,TimerID,10)
local integer i=1
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
///////////////call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
/////////////set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\Slow\\SlowCaster.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
call UnitDamageTarget(Proj,current,100.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call IssuePointOrder(Proj,"silence",x,y)
call KillUnit(Proj)
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<140.00) then
if (GetDestructableLife(udg_Dest[i])>15.10) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"stand hit")
endif
call SetDestructableLife(udg_Dest[i],(GetDestructableLife(udg_Dest[i])-15.00))
elseif (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(1.0)
////////////////call DestroyEffect(ImpactEffect)
//////////////////set ImpactEffect=null
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
//////////call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
////////////set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\Slow\\SlowCaster.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRangeOfLoc(BombardGroup,ProjLoc,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-GetLocationX(ProjLoc)) * (GetUnitX(current)-GetLocationX(ProjLoc)) + (GetUnitY(current)-GetLocationY(ProjLoc)) * (GetUnitY(current)-GetLocationY(ProjLoc))))<=120.00) then
call UnitDamageTarget(Proj,current,100.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,50.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call IssuePointOrder(Proj,"silence",x,y)
call KillUnit(Proj)
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<140.00) then
if (GetDestructableLife(udg_Dest[i])>15.10) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"stand hit")
endif
call SetDestructableLife(udg_Dest[i],(GetDestructableLife(udg_Dest[i])-15.00))
elseif (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(1.0)
///////////////call DestroyEffect(ImpactEffect)
///////////////set ImpactEffect=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
//////////////////////////
//Blossom Explosives CBF
///////////////////////////
function RandomLocInACircle takes real CircleX,real CircleY returns location
local real randomX=GetRandomReal((CircleX-250),(CircleX+250))
local real randomY=GetRandomReal((CircleY-250),(CircleY+250))
loop
exitwhen (SquareRoot((CircleX-randomX)*(CircleX-randomX)+(CircleY-randomY)*(CircleY-randomY))<250)
set randomX=GetRandomReal((CircleX-250),(CircleX+250))
set randomY=GetRandomReal((CircleY-250),(CircleY+250))
endloop
return Location(randomX,randomY)
endfunction
function BlossomExplode takes nothing returns nothing
local integer TimerID=GetHandleId(GetExpiredTimer())
local location RandomLoc=null
local group ExplodeUnits=CreateGroup()
local integer NumExplosions=LoadInteger(udg_Hash,TimerID,0)
local effect ExplosionEffect=null
local unit current=null
local integer i=1
if (NumExplosions >=25) then
call DestroyTimer(GetExpiredTimer())
call FlushChildHashtable(udg_Hash,TimerID)
else
call SaveInteger(udg_Hash,TimerID,0,(NumExplosions+1))
set RandomLoc=RandomLocInACircle(LoadReal(udg_Hash,TimerID,1),LoadReal(udg_Hash,TimerID,2))
set ExplosionEffect=AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl",RandomLoc)
call GroupEnumUnitsInRangeOfLoc(ExplodeUnits,RandomLoc,80.00,null)
loop
set current=FirstOfGroup(ExplodeUnits)
exitwhen current==null
call UnitDamageTarget(LoadUnitHandle(udg_Hash,TimerID,3),current,200.00,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(ExplodeUnits,current)
endloop
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((GetLocationX(RandomLoc)-GetDestructableX(udg_Dest[i]))*(GetLocationX(RandomLoc) - GetDestructableX(udg_Dest[i]))+(GetLocationY(RandomLoc)-GetDestructableY(udg_Dest[i]))*(GetLocationY(RandomLoc)-GetDestructableY(udg_Dest[i])))<80.00) then
if (GetDestructableLife(udg_Dest[i])>33.10) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"stand hit")
endif
call SetDestructableLife(udg_Dest[i],(GetDestructableLife(udg_Dest[i])-33.00))
elseif (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(1.00)
call DestroyEffect(ExplosionEffect)
//clear leaks
call DestroyGroup(ExplodeUnits)
call RemoveLocation(RandomLoc)
set RandomLoc=null
set ExplodeUnits=null
set ExplosionEffect=null
endif
endfunction
function BlossomExplodeCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local real te=LoadReal(udg_Hash,TimerID,10)
local integer i=1
/////Small Explosion vars
local timer BlossomExplodeProg=null
local integer BlossomExplodeProgId
/////--------------------
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",x,y)
if udg_battle then
set BlossomExplodeProg=CreateTimer()
set BlossomExplodeProgId=GetHandleId(BlossomExplodeProg)
call SaveInteger(udg_Hash,BlossomExplodeProgId,0,0) //Num of explosion made
call SaveReal(udg_Hash,BlossomExplodeProgId,1,x) //Position of explosion
call SaveReal(udg_Hash,BlossomExplodeProgId,2,y)
call SaveUnitHandle(udg_Hash,BlossomExplodeProgId,3,LoadUnitHandle(udg_Hash,TimerID,11))
call TimerStart(BlossomExplodeProg,0.10,true,function BlossomExplode)
set BlossomExplodeProg=null
endif
call FlushChildHashtable(udg_Hash,TimerID)
call TriggerSleepAction(0.60)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
////////////////////////////
//Gravity Ball CBF
///////////////////////////
function BlackHoleCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local unit BlackHole=LoadUnitHandle(udg_Hash,TimerID,0)
local location BlackHoleLoc=GetUnitLoc(BlackHole)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local group NearUnits=CreateGroup()
local unit current=null
local location UnitLoc=null
local real UnitAngle
call SaveReal(udg_Hash,TimerID,1,time)
call GroupEnumUnitsInRangeOfLoc(NearUnits,BlackHoleLoc,500.00,null)
loop
set current=FirstOfGroup(NearUnits)
exitwhen current==null
set UnitLoc=GetUnitLoc(current)
set UnitAngle=AngleBetweenPoints(UnitLoc,BlackHoleLoc)
if (DistanceBetweenPoints(UnitLoc,BlackHoleLoc)>24.00) then
call SetUnitX(current,(GetUnitX(current)+(7.75*Cos(bj_DEGTORAD*UnitAngle))))
call SetUnitY(current,(GetUnitY(current)+(7.75*Sin(bj_DEGTORAD*UnitAngle))))
endif
call RemoveLocation(UnitLoc)
set UnitLoc=null
//call UnitDamageTarget(BlackHole,current,1.80,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(NearUnits,current)
endloop
if (time>=8.00) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call RemoveUnit(BlackHole)
endif
set t=null
set BlackHole=null
call RemoveLocation(BlackHoleLoc)
set BlackHoleLoc=null
call DestroyGroup(NearUnits)
set NearUnits=null
endfunction
function GravityBallCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local real te=LoadReal(udg_Hash,TimerID,10)
local timer BlackHoleProg=null
local integer BlackHoleProgId
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
set BlackHoleProg=CreateTimer()
set BlackHoleProgId=GetHandleId(BlackHoleProg)
call SaveUnitHandle(udg_Hash,BlackHoleProgId,0,CreateUnitAtLoc(GetOwningPlayer(Proj),'h007',ProjLoc,90.00))
call SaveReal(udg_Hash,BlackHoleProgId,1,0.00)
call TimerStart(BlackHoleProg,0.03,true,function BlackHoleCBF)
set BlackHoleProg=null
endif
call RemoveUnit(Proj)
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
//////////////////////////
//Detonade CBF
//////////////////////////
function DetonadeCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group BombardGroup=null
local unit current=null
local real te=LoadReal(udg_Hash,TimerID,10)
local integer i=1
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("war3mapImported\\NuclearExplosion.mdx",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,400.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=250.00) then
call UnitDamageTarget(Proj,current,800.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
elseif ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=325.00) then
call UnitDamageTarget(Proj,current,400.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,200.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<300.00) then
if (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(1.50)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("war3mapImported\\NuclearExplosion.mdx",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,400.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=250.00) then
call UnitDamageTarget(Proj,current,800.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
elseif ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=325.00) then
call UnitDamageTarget(Proj,current,400.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,200.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<300.00) then
if (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(1.50)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
///////////////////////////
//Molotov CBF
////////////////////////////
function MolotovCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local player ProjOwner=GetOwningPlayer(Proj)
local group BombardGroup=null
local unit current=null
local real te=LoadReal(udg_Hash,TimerID,10)
local unit caster=null
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
set ImpactEffect=AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",x,y)
set caster=CreateUnit(ProjOwner,'h00A',x,y,90.00)
call IssuePointOrder(caster,"deathanddecay",x,y)
call UnitApplyTimedLife(caster,'BTLF',10.00)
call KillUnit(Proj)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-x) * (GetUnitX(current)-x) + (GetUnitY(current)-y) * (GetUnitY(current)-y)))<=150.00) then
call UnitDamageTarget(Proj,current,250.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,175.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call TriggerSleepAction(1.00)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
set caster=null
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
set ImpactEffect=AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",x,y)
set caster=CreateUnit(ProjOwner,'h00A',x,y,90.00)
call IssuePointOrder(caster,"deathanddecay",x,y)
call UnitApplyTimedLife(caster,'BTLF',10.00)
call KillUnit(Proj)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRangeOfLoc(BombardGroup,ProjLoc,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
if ((SquareRoot((GetUnitX(current)-GetLocationX(ProjLoc)) * (GetUnitX(current)-GetLocationX(ProjLoc)) + (GetUnitY(current)-GetLocationY(ProjLoc)) * (GetUnitY(current)-GetLocationY(ProjLoc))))<=150.00) then
call UnitDamageTarget(Proj,current,250.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
call UnitDamageTarget(Proj,current,175.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call TriggerSleepAction(1.00)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
set caster=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
//////////////////////////////
//SpikyCBF
////////////////////////////////
function SpikyCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local effect ImpactEffect=null
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group BombardGroup=null
local unit current=null
local real te=LoadReal(udg_Hash,TimerID,10)
local integer i=1
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
call UnitDamageTarget(Proj,current,500.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<130.00) then
if (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(0.60)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
set ImpactEffect=AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",x,y)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRangeOfLoc(BombardGroup,ProjLoc,200.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
call UnitDamageTarget(Proj,current,500.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<130.00) then
if (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
call TriggerSleepAction(0.60)
call DestroyEffect(ImpactEffect)
set ImpactEffect=null
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
////////////////////////////
//DecayMushCBF
///////////////////////////////
function CastMushDecayCBF takes nothing returns nothing
local integer TimerID=GetHandleId(GetExpiredTimer())
local unit target=LoadUnitHandle(udg_Hash,TimerID,0)
local player CastingPlayer=LoadPlayerHandle(udg_Hash,TimerID,1)
local unit caster=CreateUnit(CastingPlayer,'h00B',GetUnitX(target),GetUnitY(target),90.00)
call IssueTargetOrder(caster,"unholyfrenzy",target)
call UnitApplyTimedLife(caster,'BTLF',1.00)
set target=null
set CastingPlayer=null
set caster=null
call FlushChildHashtable(udg_Hash,TimerID)
endfunction
function DecayMushCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real zc1=LoadReal(udg_Hash,TimerID,7)
local real zc2=LoadReal(udg_Hash,TimerID,8)
local real zc3=LoadReal(udg_Hash,TimerID,9)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local real z=((zc1*time*time)+(zc2*time)+zc3)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group BombardGroup=null
local real te=LoadReal(udg_Hash,TimerID,10)
local unit current=null
local timer CastDecayMush=null
call SaveReal(udg_Hash,TimerID,1,time)
if (time>=te) then
set x=((xc1*te)+xc2)
set y=((yc1*te)+yc2)
set z=((zc1*te*te)+(zc2*te)+zc3)
call MoveLocation(ProjLoc,x,y)
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*te))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///--------
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRange(BombardGroup,x,y,180.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
set CastDecayMush=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(CastDecayMush),0,current)
call SavePlayerHandle(udg_Hash,GetHandleId(CastDecayMush),1,GetOwningPlayer(Proj))
call TimerStart(CastDecayMush,0.01,false,function CastMushDecayCBF)
call GroupRemoveUnit(BombardGroup, current)
set CastDecayMush=null
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call TriggerSleepAction(1.00)
call KillUnit(Proj)
elseif ((z-GetLocationZ(ProjLoc))<=20.00) then
///Move
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
///----
//Projectile impacts the ground and destroyed
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
call RemoveLocation(ProjLoc)
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_Hash,TimerID,6))
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
set BombardGroup=CreateGroup()
call GroupEnumUnitsInRangeOfLoc(BombardGroup,ProjLoc,180.00,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
set CastDecayMush=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(CastDecayMush),0,current)
call SavePlayerHandle(udg_Hash,GetHandleId(CastDecayMush),1,GetOwningPlayer(Proj))
call TimerStart(CastDecayMush,0.01,false,function CastMushDecayCBF)
call GroupRemoveUnit(BombardGroup, current)
set CastDecayMush=null
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
endif
call TriggerSleepAction(1.00)
call KillUnit(Proj)
else
call SetUnitFlyHeight(Proj,(z-GetLocationZ(ProjLoc)),0)
//call BJDebugMsg("angle is "+I2S(((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90)))
call SetUnitAnimationByIndex(Proj,((R2I(57.2958*Atan((zc2*0.001)+((zc1*0.002)*time))+0.5))+90))
call SetUnitPositionLoc(Proj,ProjLoc)
endif
call RemoveLocation(ProjLoc)
set Proj=null
set ProjLoc=null
set t=null
endfunction
///////////////////////
/////////////////////////
function JavelinCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group DamageExceptionGroup=LoadGroupHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local unit current=null
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,50.00,null)
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if (not(IsUnitInGroup(current,DamageExceptionGroup))) then
call UnitDamageTarget(Proj,current,200.00,true, false,ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(DamageExceptionGroup,current)
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
if (time>=1.04) then
call DestroyTimer(t)
call DestroyGroup(DamageExceptionGroup)
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set DamageExceptionGroup=null
set current=null
endfunction
////////////////////////
function PhoenixCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
if (time>=1.0) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
endfunction
////////////////////////////
function CastChillSoulCBF takes nothing returns nothing
local integer TimerID=GetHandleId(GetExpiredTimer())
local unit target=LoadUnitHandle(udg_Hash,TimerID,0)
local player CastingPlayer=LoadPlayerHandle(udg_Hash,TimerID,1)
local unit caster=CreateUnit(CastingPlayer,'h00J',GetUnitX(target),GetUnitY(target),90.00)
call IssueTargetOrder(caster,"thunderbolt",target)
call UnitApplyTimedLife(caster,'BTLF',1.00)
set target=null
set CastingPlayer=null
set caster=null
call FlushChildHashtable(udg_Hash,TimerID)
endfunction
function ChillSoulCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group DamageExceptionGroup=LoadGroupHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local unit current=null
local timer CastChillSoul=null
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,70.00,null)
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if (not(IsUnitInGroup(current,DamageExceptionGroup))) then
set CastChillSoul=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(CastChillSoul),0,current)
call SavePlayerHandle(udg_Hash,GetHandleId(CastChillSoul),1,GetOwningPlayer(Proj))
call TimerStart(CastChillSoul,0.01,false,function CastChillSoulCBF)
set CastChillSoul=null
call GroupAddUnit(DamageExceptionGroup,current)
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
if (time>=0.95) then
call DestroyTimer(t)
call DestroyGroup(DamageExceptionGroup)
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set DamageExceptionGroup=null
set current=null
endfunction
/////////////////////////////
function ShadowSpearCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local group DamageExceptionGroup=LoadGroupHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local unit current=null
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,65.00,null)
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if (not(IsUnitInGroup(current,DamageExceptionGroup))) then
call SetUnitState(current, UNIT_STATE_LIFE, (GetUnitState(current,UNIT_STATE_LIFE)*0.58))
call GroupAddUnit(DamageExceptionGroup,current)
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
if (time>=1.08) then
call DestroyTimer(t)
call DestroyGroup(DamageExceptionGroup)
call FlushChildHashtable(udg_Hash,TimerID)
call KillUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set DamageExceptionGroup=null
set current=null
endfunction
///////////////////////////////////////
function TorpedoBombardArea takes real x,real y,real aoe,unit damager returns nothing
local group BombardGroup=CreateGroup()
local unit current=null
local integer i=1
call GroupEnumUnitsInRange(BombardGroup,x,y,aoe,null)
loop
set current = FirstOfGroup(BombardGroup)
exitwhen current == null
call UnitDamageTarget(damager,current,800.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(BombardGroup, current)
endloop
call DestroyGroup(BombardGroup)
set BombardGroup=null
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if (SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<200.00) then
if (GetDestructableLife(udg_Dest[i])>0) then
if ((GetDestructableTypeId(udg_Dest[i])=='YTct') or (GetDestructableTypeId(udg_Dest[i])=='ATtc') or (GetDestructableTypeId(udg_Dest[i])=='KTtw')) then
call SetDestructableAnimation(udg_Dest[i],"death")
endif
call KillDestructable(udg_Dest[i])
endif
endif
endif
set i=i+1
endloop
endfunction
function TorpedoCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local unit Launcher=LoadUnitHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local real NearestDistanceEver=150.00
local unit NearestUnit=null
local unit current=null
///Destructable destroy mechanism variables
local real NearestDestDist=150.00
local destructable NearestDest=null
local integer i=1
///----------------------------------------
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,150.00,null)
if (FirstOfGroup(HittingGroup)!=null) then
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if ((current!=Launcher)and(GetUnitState(current,UNIT_STATE_LIFE)>0.00)) then
if (DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)<NearestDistanceEver) then
set NearestUnit=current
set NearestDistanceEver=DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)
endif
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
endif
if (NearestUnit!=null) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
call TorpedoBombardArea(x,y,200.00,Proj)
endif
call KillUnit(Proj)
endif
loop
exitwhen i>=89
if (udg_Dest[i]!=null) then
if ((SquareRoot((x-GetDestructableX(udg_Dest[i]))*(x - GetDestructableX(udg_Dest[i]))+(y-GetDestructableY(udg_Dest[i]))*(y-GetDestructableY(udg_Dest[i])))<NearestDestDist) and (GetDestructableLife(udg_Dest[i])>0.00)) then
set NearestDest=udg_Dest[i]
set NearestDestDist=SquareRoot((x - GetDestructableX(udg_Dest[i])) * (x - GetDestructableX(udg_Dest[i])) + (y - GetDestructableY(udg_Dest[i])) * (y - GetDestructableY(udg_Dest[i])))
endif
endif
set i=i+1
endloop
if (NearestDest!=null) then
call DestroyTimer(t)
if ((GetDestructableTypeId(NearestDest)=='YTct') or (GetDestructableTypeId(NearestDest)=='ATtc') or (GetDestructableTypeId(NearestDest)=='KTtw')) then
call SetDestructableAnimation(NearestDest,"death")
endif
call KillDestructable(NearestDest)
if udg_battle then
call TorpedoBombardArea(x,y,200,Proj)
endif
call KillUnit(Proj)
call FlushChildHashtable(udg_Hash,TimerID)
set NearestDest=null
endif
if (time>=1.0) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call RemoveUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
set Launcher=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set NearestUnit=null
set current=null
endfunction
///////////////////////////////
function CastCurseODCBF takes nothing returns nothing
local integer TimerID=GetHandleId(GetExpiredTimer())
local unit target=LoadUnitHandle(udg_Hash,TimerID,0)
local player CastingPlayer=LoadPlayerHandle(udg_Hash,TimerID,1)
local unit caster=CreateUnit(CastingPlayer,'h00J',GetUnitX(target),GetUnitY(target),90.00)
call IssueTargetOrder(caster,"innerfire",target)
call UnitApplyTimedLife(caster,'BTLF',1.00)
set target=null
set CastingPlayer=null
set caster=null
call FlushChildHashtable(udg_Hash,TimerID)
endfunction
function UglyFingerCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local unit Launcher=LoadUnitHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local real NearestDistanceEver=60.00
local unit NearestUnit=null
local unit current=null
local timer CastCurseOD=null
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,50.00,null)
if (FirstOfGroup(HittingGroup)!=null) then
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if ((current!=Launcher)and(GetUnitState(current,UNIT_STATE_LIFE)>0.00)) then
if (DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)<NearestDistanceEver) then
set NearestUnit=current
set NearestDistanceEver=DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)
endif
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
endif
if (NearestUnit!=null) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
call UnitDamageTarget(Proj,NearestUnit,100.00,true, false,ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set CastCurseOD=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(CastCurseOD),0,NearestUnit)
call SavePlayerHandle(udg_Hash,GetHandleId(CastCurseOD),1,GetOwningPlayer(Proj))
call TimerStart(CastCurseOD,0.01,false,function CastCurseODCBF)
set CastCurseOD=null
endif
call RemoveUnit(Proj)
endif
if (time>=1.55) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call RemoveUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
set Launcher=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set NearestUnit=null
set current=null
endfunction
////////////////////////////////////////
function CastStormBoltCBF takes nothing returns nothing
local integer TimerID=GetHandleId(GetExpiredTimer())
local unit target=LoadUnitHandle(udg_Hash,TimerID,0)
local player CastingPlayer=LoadPlayerHandle(udg_Hash,TimerID,1)
local unit caster=CreateUnit(CastingPlayer,'h00B',GetUnitX(target),GetUnitY(target),90.00)
call IssueTargetOrder(caster,"thunderbolt",target)
call UnitApplyTimedLife(caster,'BTLF',1.00)
set target=null
set CastingPlayer=null
set caster=null
call FlushChildHashtable(udg_Hash,TimerID)
endfunction
function StormBoltCBF takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer TimerID=GetHandleId(t)
local real time=LoadReal(udg_Hash,TimerID,1)+0.03
local real xc1=LoadReal(udg_Hash,TimerID,2)
local real xc2=LoadReal(udg_Hash,TimerID,3)
local real yc1=LoadReal(udg_Hash,TimerID,4)
local real yc2=LoadReal(udg_Hash,TimerID,5)
local real x=((xc1*time)+xc2)
local real y=((yc1*time)+yc2)
local location ProjLoc=Location(x,y)
local unit Proj=LoadUnitHandle(udg_Hash,TimerID,0)
local unit Launcher=LoadUnitHandle(udg_Hash,TimerID,6)
local group HittingGroup=CreateGroup()
local real NearestDistanceEver=60.00
local unit NearestUnit=null
local unit current=null
local timer CastStormBolt=null
//update time
call SaveReal(udg_Hash,TimerID,1,time)
//.............
//Move Glaive
call SetUnitPositionLoc(Proj,ProjLoc)
//..............
call GroupEnumUnitsInRangeOfLoc(HittingGroup,ProjLoc,50.00,null)
if (FirstOfGroup(HittingGroup)!=null) then
loop
set current=FirstOfGroup(HittingGroup)
exitwhen current==null
if ((current!=Launcher)and(GetUnitState(current,UNIT_STATE_LIFE)>0.00)) then
if (DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)<NearestDistanceEver) then
set NearestUnit=current
set NearestDistanceEver=DistanceBetweenPoints(GetUnitLoc(current),ProjLoc)
endif
endif
call GroupRemoveUnit(HittingGroup,current)
endloop
endif
if (NearestUnit!=null) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
if udg_battle then
call UnitDamageTarget(Proj,NearestUnit,400.00,true, false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set CastStormBolt=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(CastStormBolt),0,NearestUnit)
call SavePlayerHandle(udg_Hash,GetHandleId(CastStormBolt),1,GetOwningPlayer(Proj))
call TimerStart(CastStormBolt,0.01,false,function CastStormBoltCBF)
set CastStormBolt=null
endif
call RemoveUnit(Proj)
endif
if (time>=1.0) then
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,TimerID)
call RemoveUnit(Proj)
endif
//Removing leaks
set t=null
call RemoveLocation(ProjLoc)
set ProjLoc=null
set Proj=null
set Launcher=null
call DestroyGroup(HittingGroup)
set HittingGroup=null
set NearestUnit=null
set current=null
endfunction
////////////////////////////////////
Name | Type | is_array | initial_value |
alive | integer | Yes | |
ammo_shop | unit | Yes | |
ammo_shop_loc | location | Yes | |
battle | boolean | No | |
battleloc | location | Yes | |
Cat_t | integer | Yes | |
Catapult | unit | Yes | |
Dest | destructable | Yes | |
GameScore | multiboard | No | |
garrage | location | Yes | |
Hash | hashtable | No | |
PlayerBattleLoc | location | Yes | |
realnum | real | No | |
Round | integer | No | |
StartRoundTimer | timer | No | |
StartRoundTimerWindow | timerdialog | No | |
teamA | force | No | |
TeamAvictories | integer | No | |
teamB | force | No | |
TeamBVictories | integer | No |
function Combine_Items_Conditions takes nothing returns boolean
return GetItemCharges(GetManipulatedItem()) > 0
endfunction
function Item2Num takes item ExaminedItem returns integer
local integer ItemNum=GetItemTypeId(ExaminedItem)
///Catapult Ammo
if (ItemNum=='I000') then //Sludge Ball
return 1
elseif (ItemNum=='I001') then //Gravity Ball
return 1
elseif (ItemNum=='I002') then //Blossom Explosives
return 1
elseif (ItemNum=='I003') then //Detonade
return 1
elseif (ItemNum=='I004') then //Molotov
return 1
elseif (ItemNum=='I005') then //Spiky Ball
return 1
elseif (ItemNum=='I00D') then //Decayer Mushroom
return 1
///Ballista ammo
elseif (ItemNum=='I006') then //Javelin
return 2
elseif (ItemNum=='I007') then //Phoenix
return 2
elseif (ItemNum=='I008') then //Chilling Souls
return 2
elseif (ItemNum=='I009') then //Shadow spears
return 2
elseif (ItemNum=='I00A') then //Torpedo
return 2
elseif (ItemNum=='I00B') then //Storm Bolt
return 2
elseif (ItemNum=='I00C') then //Ugly Finger
return 2
endif
return 3
endfunction
function Item2Cost takes item ExaminedItem returns integer
local integer ItemNum=GetItemTypeId(ExaminedItem)
///Catapult Ammo
if (ItemNum=='I000') then //Sludge Ball
return 130
elseif (ItemNum=='I001') then //Gravity Ball
return 650
elseif (ItemNum=='I002') then //Blossom Explosives
return 150
elseif (ItemNum=='I003') then //Detonade
return 500
elseif (ItemNum=='I004') then //Molotov
return 80
elseif (ItemNum=='I005') then //Spiky Ball
return 240
elseif (ItemNum=='I00D') then //Decayer Mushroom
return 60
///Ballista ammo
elseif (ItemNum=='I006') then //Javelin
return 50
elseif (ItemNum=='I007') then //Phoenix
return 210
elseif (ItemNum=='I008') then //Chilling Souls
return 200
elseif (ItemNum=='I009') then //Shadow spears
return 250
elseif (ItemNum=='I00A') then //Torpedo
return 450
elseif (ItemNum=='I00B') then //Storm Bolt
return 300
elseif (ItemNum=='I00C') then //Ugly Finger
return 100
endif
endfunction
function Combine_Items_Actions takes nothing returns nothing
local item NEWITEM = GetManipulatedItem()
local unit OURUNIT = GetManipulatingUnit()
local integer MAXIMUM = 100 //The max no. of charges allowed
local integer ITEMCOUNT = 0
local integer ITEMLOOP = 0
local integer CHARGES = 0
if ((Item2Num(NEWITEM)==1) and(GetUnitTypeId(OURUNIT)!='o000')) then
call AdjustPlayerStateBJ( Item2Cost(NEWITEM), GetOwningPlayer(OURUNIT), PLAYER_STATE_RESOURCE_GOLD )
call RemoveItem(NEWITEM)
return
elseif ((Item2Num(NEWITEM)==2) and(GetUnitTypeId(OURUNIT)!='e000')) then
call AdjustPlayerStateBJ( Item2Cost(NEWITEM), GetOwningPlayer(OURUNIT), PLAYER_STATE_RESOURCE_GOLD )
call RemoveItem(NEWITEM)
return
endif
loop
exitwhen ITEMLOOP > 6
if GetItemTypeId(NEWITEM) == GetItemTypeId(UnitItemInSlot(OURUNIT, ITEMLOOP)) then
if GetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM) <= MAXIMUM then
if not (UnitItemInSlot(OURUNIT, ITEMLOOP) == NEWITEM) then
set CHARGES = GetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM)
call SetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP), CHARGES)
call RemoveItem(NEWITEM)
set ITEMLOOP = 7
endif
endif
endif
if (ITEMLOOP < 7) then
set ITEMLOOP = ITEMLOOP + 1
endif
endloop
set NEWITEM = null
set OURUNIT = null
endfunction
function InitTrig_Combine_Items takes nothing returns nothing
set gg_trg_Combine_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Combine_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Combine_Items, Condition( function Combine_Items_Conditions ) )
call TriggerAddAction( gg_trg_Combine_Items, function Combine_Items_Actions )
endfunction
function Trig_TestRangeToZ_Actions takes nothing returns nothing
call BJDebugMsg("Range To Z is "+R2S(RangeToZ(S2R(SubString(GetEventPlayerChatString(), 10, 13)))))
endfunction
//===========================================================================
function InitTrig_TestRangeToZ takes nothing returns nothing
set gg_trg_TestRangeToZ = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_TestRangeToZ, Player(0), "-rangetoz", false )
call TriggerAddAction( gg_trg_TestRangeToZ, function Trig_TestRangeToZ_Actions )
endfunction
function Trig_Register_Catapult_Conditions takes nothing returns boolean
if ( ( GetTriggerUnit() == gg_unit_n000_0022 ) ) then
return true
endif
if ( ( GetTriggerUnit() == gg_unit_n000_0023 ) ) then
return true
endif
return false
endfunction
function Trig_Register_Catapult_Actions takes nothing returns nothing
local unit u=GetSoldUnit()
local integer nbct=0
local integer pn=GetPlayerId(GetOwningPlayer(u))
if (GetUnitTypeId(u) == 'o000' ) then
set nbct=1
endif
if (GetUnitTypeId(u) == 'e000' ) then
set nbct=2
endif
if (udg_Cat_t[pn]==0) then
if (nbct==1) then
set udg_Catapult[pn]=u
set udg_Cat_t[pn]=1
set udg_ammo_shop[pn]=CreateUnitAtLoc(GetOwningPlayer(u),'o001',udg_ammo_shop_loc[pn],270.0)
set udg_alive[pn]=1
call SetUnitPositionLoc(u,udg_garrage[pn])
call SmartCameraPanND( GetOwningPlayer(u),udg_garrage[pn] ,1.00 )
call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"You can now buy ammo from ammo shop")
return
endif
if (nbct==2) then
set udg_Catapult[pn]=u
set udg_Cat_t[pn]=2
set udg_ammo_shop[pn]=CreateUnitAtLoc(GetOwningPlayer(u),'u000',udg_ammo_shop_loc[pn],270.0)
set udg_alive[pn]=1
call SetUnitPositionLoc(u,udg_garrage[pn])
call SmartCameraPanND( GetOwningPlayer(u),udg_garrage[pn] , 1.00 )
call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"You can now buy ammo from ammo shop")
return
endif
endif
if (udg_Cat_t[pn]==1) then
if (nbct==1) then
call RemoveUnit(u)
call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"You have already own this type of catapult")
return
endif
if (nbct==2) then
call RemoveUnit(udg_Catapult[pn])
call SetUnitPositionLoc(u,udg_garrage[pn])
call SmartCameraPanND( GetOwningPlayer(u),udg_garrage[pn] ,1.00 )
call RemoveUnit(udg_ammo_shop[pn])
set udg_ammo_shop[pn]=CreateUnitAtLoc(GetOwningPlayer(u),'u000',udg_ammo_shop_loc[pn],270.0)
set udg_alive[pn]=1
set udg_Catapult[pn]=u
set udg_Cat_t[pn]=2
return
endif
endif
if (udg_Cat_t[pn]==2) then
if (nbct==1) then
call RemoveUnit(udg_Catapult[pn])
call SetUnitPositionLoc(u,udg_garrage[pn])
call SmartCameraPanND( GetOwningPlayer(u),udg_garrage[pn] ,1.00 )
call RemoveUnit(udg_ammo_shop[pn])
set udg_ammo_shop[pn]=CreateUnitAtLoc(GetOwningPlayer(u),'o001',udg_ammo_shop_loc[pn],270.0)
set udg_alive[pn]=1
set udg_Catapult[pn]=u
set udg_Cat_t[pn]=1
return
endif
if (nbct==2) then
call RemoveUnit(u)
call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"You have already own this type of catapult")
return
endif
endif
endfunction
//===========================================================================
function InitTrig_Register_Catapult takes nothing returns nothing
set gg_trg_Register_Catapult = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Register_Catapult, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( gg_trg_Register_Catapult, Condition( function Trig_Register_Catapult_Conditions ) )
call TriggerAddAction( gg_trg_Register_Catapult, function Trig_Register_Catapult_Actions )
endfunction
function Trig_RoundVictory_Conditions takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'o000' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'e000' ) ) then
return true
endif
return false
endfunction
function Trig_RoundVictory_Func001Func002Func001Func003Func001A takes nothing returns nothing
call AdjustPlayerStateBJ( 600, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
call DisplayTextToPlayer(GetEnumPlayer(),0,0,"|cffffcc00+600 gold|r")
endfunction
function Trig_RoundVictory_Func001Func002Func001Func003Func007A takes nothing returns nothing
call CustomVictoryBJ( GetEnumPlayer(), true, true )
endfunction
function Trig_RoundVictory_Func001Func002Func001Func003Func008A takes nothing returns nothing
call CustomDefeatBJ( GetEnumPlayer(), "TRIGSTR_159" )
endfunction
function Trig_RoundVictory_Func001Func002Func004Func001A takes nothing returns nothing
call AdjustPlayerStateBJ( 600, GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
call DisplayTextToPlayer(GetEnumPlayer(),0,0,"|cffffcc00+600 gold|r")
endfunction
function Trig_RoundVictory_Func001Func002Func004Func007A takes nothing returns nothing
call CustomVictoryBJ( GetEnumPlayer(), true, true )
endfunction
function Trig_RoundVictory_Func001Func002Func004Func008A takes nothing returns nothing
call CustomDefeatBJ( GetEnumPlayer(), "TRIGSTR_155" )
endfunction
function Trig_RoundVictory_Actions takes nothing returns nothing
//call BJDebugMsg(I2S(GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) - 1 ))
if (udg_Catapult[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) - 1 )] == GetTriggerUnit()) then
set udg_alive[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) - 1 )] = 0
call SetUnitPositionLoc(GetTriggerUnit(),udg_garrage[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) - 1 )])
//call BJDebugMsg(I2S((udg_alive[0]+udg_alive[1]+udg_alive[2]+udg_alive[3]+udg_alive[4])))
//call BJDebugMsg(I2S((udg_alive[5]+udg_alive[6]+udg_alive[7]+udg_alive[8]+udg_alive[9])))
if ( ( (udg_alive[0]+udg_alive[1]+udg_alive[2]+udg_alive[3]+udg_alive[4]) == 0 ) ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_154" )
set udg_battle=false
call DisableTrigger( gg_trg_RoundVictory )
set udg_TeamBVictories = ( udg_TeamBVictories + 1 )
call MultiboardSetItemValueBJ(udg_GameScore, 2, 3, I2S(udg_TeamBVictories) )
if ( udg_TeamBVictories == 5 ) then
call DisplayTextToForce(GetPlayersAll(),"Team B has won the match.")
call DisplayTextToForce(GetPlayersAll(),"Game ends in 10 seconds.")
call TriggerSleepAction(10.00)
call ForForce( udg_teamB, function Trig_RoundVictory_Func001Func002Func004Func007A )
call ForForce( udg_teamA, function Trig_RoundVictory_Func001Func002Func004Func008A )
else
call ForForce( GetPlayersAll(), function Trig_RoundVictory_Func001Func002Func004Func001A )
call StartTimerBJ( udg_StartRoundTimer, false, 30.00 )
call CreateTimerDialogBJ( udg_StartRoundTimer, ( "Round " + ( I2S(( udg_Round + 1 )) + " starts in" ) ) )
set udg_StartRoundTimerWindow = GetLastCreatedTimerDialogBJ()
call DisplayTextToForce( GetPlayersAll(), ( "Round " + ( I2S(( udg_Round + 1 )) + " starts in 30 seconds." ) ) )
call MoveCatapultToGarrage()
call ShowUnit( gg_unit_n000_0022,true )
call ShowUnit( gg_unit_n000_0023,true )
endif
else
if ( ( (udg_alive[5]+udg_alive[6]+udg_alive[7]+udg_alive[8]+udg_alive[9]) == 0 ) ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_158" )
set udg_battle=false
call DisableTrigger( gg_trg_RoundVictory )
set udg_TeamAvictories = ( udg_TeamAvictories + 1 )
call MultiboardSetItemValueBJ(udg_GameScore, 2, 2, I2S(udg_TeamAvictories) )
if ( udg_TeamAvictories == 5 ) then
call DisplayTextToForce(GetPlayersAll(),"Team A has won the match.")
call DisplayTextToForce(GetPlayersAll(),"Game ends in 10 seconds.")
call TriggerSleepAction(10.00)
call ForForce( udg_teamA, function Trig_RoundVictory_Func001Func002Func001Func003Func007A )
call ForForce( udg_teamB, function Trig_RoundVictory_Func001Func002Func001Func003Func008A )
else
call ForForce( GetPlayersAll(), function Trig_RoundVictory_Func001Func002Func001Func003Func001A )
call StartTimerBJ( udg_StartRoundTimer, false, 30.00 )
call CreateTimerDialogBJ( udg_StartRoundTimer, ( "Round " + ( I2S(( udg_Round + 1 )) + " starts in" ) ) )
set udg_StartRoundTimerWindow = GetLastCreatedTimerDialogBJ()
call DisplayTextToForce( GetPlayersAll(), ( "Round " + ( I2S(( udg_Round + 1 )) + " starts in 30 seconds." ) ) )
call MoveCatapultToGarrage()
call ShowUnit( gg_unit_n000_0022,true )
call ShowUnit( gg_unit_n000_0023,true )
endif
else
endif
endif
else
endif
endfunction
//===========================================================================
function InitTrig_RoundVictory takes nothing returns nothing
set gg_trg_RoundVictory = CreateTrigger( )
call DisableTrigger( gg_trg_RoundVictory )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RoundVictory, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_RoundVictory, Condition( function Trig_RoundVictory_Conditions ) )
call TriggerAddAction( gg_trg_RoundVictory, function Trig_RoundVictory_Actions )
endfunction
function Trig_CreateProj_C300_Conditions takes nothing returns boolean
if (GetSpellAbilityId() == 'A00E') then
return true
endif
return false
endfunction
function Trig_CreateProj_C300_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(1000*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(1000*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/1000.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h001',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function RockCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_CreateProj_C300 takes nothing returns nothing
set gg_trg_CreateProj_C300 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_CreateProj_C300, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_CreateProj_C300, Condition( function Trig_CreateProj_C300_Conditions ) )
call TriggerAddAction( gg_trg_CreateProj_C300, function Trig_CreateProj_C300_Actions )
endfunction
function Trig_Create_Sludge_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Sludge_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(800*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(800*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/800.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<200.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I000')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h005',TrigUnitLoc,LaunchAngle)
////////////////////set ProjEffect=AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\CorrosiveBreath\\CorrosiveBreathMissile.mdl",Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
////////////////call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function SludgeCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Sludge takes nothing returns nothing
set gg_trg_Create_Sludge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Sludge, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Sludge, Condition( function Trig_Create_Sludge_Conditions ) )
call TriggerAddAction( gg_trg_Create_Sludge, function Trig_Create_Sludge_Actions )
endfunction
function Trig_Create_Blossom_Explosives_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A004' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Blossom_Explosives_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(1000*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(1000*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/1000.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I002')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h001',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call SaveUnitHandle(udg_Hash,ProjProgressID,11,TrigUnit)
call TimerStart(ProjProgress,0.03,true,function BlossomExplodeCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Blossom_Explosives takes nothing returns nothing
set gg_trg_Create_Blossom_Explosives = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Blossom_Explosives, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Blossom_Explosives, Condition( function Trig_Create_Blossom_Explosives_Conditions ) )
call TriggerAddAction( gg_trg_Create_Blossom_Explosives, function Trig_Create_Blossom_Explosives_Actions )
endfunction
function Trig_Create_Gravity_Ball_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A003' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Gravity_Ball_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(900*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(900*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/900.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<250.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I001')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h001',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("Doodads\\Cinematic\\EyeOfSargeras\\EyeOfSargeras.mdl" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function GravityBallCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Gravity_Ball takes nothing returns nothing
set gg_trg_Create_Gravity_Ball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Gravity_Ball, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Gravity_Ball, Condition( function Trig_Create_Gravity_Ball_Conditions ) )
call TriggerAddAction( gg_trg_Create_Gravity_Ball, function Trig_Create_Gravity_Ball_Actions )
endfunction
function Trig_Create_Detonade_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A005' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Detonade_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(900*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(900*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/900.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I003')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h008',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("war3mapImported\\s_ExplosiveBarrel Missile.mdx" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function DetonadeCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Detonade takes nothing returns nothing
set gg_trg_Create_Detonade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Detonade, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Detonade, Condition( function Trig_Create_Detonade_Conditions ) )
call TriggerAddAction( gg_trg_Create_Detonade, function Trig_Create_Detonade_Actions )
endfunction
function Trig_Create_Molotov_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A006' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Molotov_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(1000*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(1000*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/1000.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I004')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h001',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("Abilities\\Weapons\\BatTrollMissile\\BatTrollMissile.mdl" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function MolotovCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Molotov takes nothing returns nothing
set gg_trg_Create_Molotov = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Molotov, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Molotov, Condition( function Trig_Create_Molotov_Conditions ) )
call TriggerAddAction( gg_trg_Create_Molotov, function Trig_Create_Molotov_Actions )
endfunction
function Trig_Create_Spiky_Ball_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A007' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Spiky_Ball_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(1000*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(1000*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/1000.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I005')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h008',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("war3mapImported\\SpikeBall.mdx" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function SpikyCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Spiky_Ball takes nothing returns nothing
set gg_trg_Create_Spiky_Ball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Spiky_Ball, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Spiky_Ball, Condition( function Trig_Create_Spiky_Ball_Conditions ) )
call TriggerAddAction( gg_trg_Create_Spiky_Ball, function Trig_Create_Spiky_Ball_Actions )
endfunction
function Trig_Create_Decayer_Mushroom_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A008' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Decayer_Mushroom_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local location TargetLoc=GetSpellTargetLoc()
local real LaunchAngle=AngleBetweenPoints(TrigUnitLoc,TargetLoc)
local real xc1=(800*(Cos(0.01745*LaunchAngle)))
local real xc2=GetUnitX(TrigUnit)
local real yc1=(800*(Sin(0.01745*LaunchAngle)))
local real yc2=GetUnitY(TrigUnit)
local real zc3=(60.00+GetLocationZ(TrigUnitLoc))
local real zt=(20.00+GetLocationZ(TargetLoc))
local unit Proj=null
local effect ProjEffect=null
local real range=DistanceBetweenPoints(TrigUnitLoc,TargetLoc)
local real zm=(RangeToZ(range)+RMaxBJ(zc3,zt)) //Max Height
local real te=(range/800.0) //Total time of travel
local real intem=((zc3-zt)/(zm-zc3)) //intermediate calculation steps
local real tm=((te/intem)*(SquareRoot(1+intem)-1)) //Time to reach max height
local real Arcc=((zm-zc3)/(tm*tm)) //Arc curve
local integer i=0 //iterator
local timer ProjProgress=null
local integer ProjProgressID
local timer AttackAnimProgress=null
if (range<150.00) then
call DisplayTextToPlayer(GetOwningPlayer(TrigUnit),0,0,"Target is in minimum range")
call UnitAddItemById(TrigUnit,'I00D')
return
endif
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h009',TrigUnitLoc,LaunchAngle)
set ProjEffect=AddSpecialEffectTarget("war3mapImported\\missile001.mdx" ,Proj,"origin")
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,60.00,0)
set ProjProgress=CreateTimer()
set ProjProgressID=GetHandleId(ProjProgress)
//storing data into udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,xc1)
call SaveReal(udg_Hash,ProjProgressID,3,xc2)
call SaveReal(udg_Hash,ProjProgressID,4,yc1)
call SaveReal(udg_Hash,ProjProgressID,5,yc2)
call SaveEffectHandle(udg_Hash,ProjProgressID,6,ProjEffect)
call SaveReal(udg_Hash,ProjProgressID,7,(-1.0*Arcc)) //zc1
call SaveReal(udg_Hash,ProjProgressID,8,(2*Arcc*tm)) //zc2
call SaveReal(udg_Hash,ProjProgressID,9,zc3)
call SaveReal(udg_Hash,ProjProgressID,10,te)
call TimerStart(ProjProgress,0.03,true,function DecayMushCBF)
call RemoveLocation(TrigUnitLoc)
set TrigUnitLoc=null
call RemoveLocation(TargetLoc)
set TargetLoc=null
set TrigUnit=null
set Proj=null
set ProjEffect=null
set ProjProgress=null
set AttackAnimProgress=null
endfunction
//===========================================================================
function InitTrig_Create_Decayer_Mushroom takes nothing returns nothing
set gg_trg_Create_Decayer_Mushroom = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Decayer_Mushroom, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Decayer_Mushroom, Condition( function Trig_Create_Decayer_Mushroom_Conditions ) )
call TriggerAddAction( gg_trg_Create_Decayer_Mushroom, function Trig_Create_Decayer_Mushroom_Actions )
endfunction
function Trig_CreateProj_BL_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00H' ) ) then
return false
endif
return true
endfunction
function Trig_CreateProj_BL_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h004',TrigUnitLoc,LaunchAngle)
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1100*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1100*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveUnitHandle(udg_Hash,ProjProgressID,6,TrigUnit) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function GlaiveCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_CreateProj_BL takes nothing returns nothing
set gg_trg_CreateProj_BL = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_CreateProj_BL, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_CreateProj_BL, Condition( function Trig_CreateProj_BL_Conditions ) )
call TriggerAddAction( gg_trg_CreateProj_BL, function Trig_CreateProj_BL_Actions )
endfunction
function Trig_Create_Javelin_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00I' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Javelin_Actions takes nothing returns nothing
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00C',TrigUnitLoc,LaunchAngle)
local group DamageExceptionGroup=CreateGroup()
local timer AttackAnimProgress=null
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
call GroupAddUnit(DamageExceptionGroup,TrigUnit)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1150*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1150*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveGroupHandle(udg_Hash,ProjProgressID,6,DamageExceptionGroup) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function JavelinCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set DamageExceptionGroup=null
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Javelin takes nothing returns nothing
set gg_trg_Create_Javelin = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Javelin, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Javelin, Condition( function Trig_Create_Javelin_Conditions ) )
call TriggerAddAction( gg_trg_Create_Javelin, function Trig_Create_Javelin_Actions )
endfunction
function Trig_Create_Phoenix_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00J' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Phoenix_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00D',TrigUnitLoc,LaunchAngle)
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(800*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(800*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function PhoenixCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Phoenix takes nothing returns nothing
set gg_trg_Create_Phoenix = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Phoenix, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Phoenix, Condition( function Trig_Create_Phoenix_Conditions ) )
call TriggerAddAction( gg_trg_Create_Phoenix, function Trig_Create_Phoenix_Actions )
endfunction
function Trig_Create_Chilling_souls_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A002' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Chilling_souls_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00E',TrigUnitLoc,LaunchAngle)
local group DamageExceptionGroup=CreateGroup()
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
call GroupAddUnit(DamageExceptionGroup,TrigUnit)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1050*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1050*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveGroupHandle(udg_Hash,ProjProgressID,6,DamageExceptionGroup) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function ChillSoulCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set DamageExceptionGroup=null
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Chilling_souls takes nothing returns nothing
set gg_trg_Create_Chilling_souls = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Chilling_souls, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Chilling_souls, Condition( function Trig_Create_Chilling_souls_Conditions ) )
call TriggerAddAction( gg_trg_Create_Chilling_souls, function Trig_Create_Chilling_souls_Actions )
endfunction
function Trig_Create_Shadow_spears_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00K' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Shadow_spears_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00G',TrigUnitLoc,LaunchAngle)
local group DamageExceptionGroup=CreateGroup()
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
call GroupAddUnit(DamageExceptionGroup,TrigUnit)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1200*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1200*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveGroupHandle(udg_Hash,ProjProgressID,6,DamageExceptionGroup) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function ShadowSpearCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set DamageExceptionGroup=null
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Shadow_spears takes nothing returns nothing
set gg_trg_Create_Shadow_spears = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Shadow_spears, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Shadow_spears, Condition( function Trig_Create_Shadow_spears_Conditions ) )
call TriggerAddAction( gg_trg_Create_Shadow_spears, function Trig_Create_Shadow_spears_Actions )
endfunction
function Trig_Create_Torpedo_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A009' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Torpedo_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00H',TrigUnitLoc,LaunchAngle)
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1100*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1100*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveUnitHandle(udg_Hash,ProjProgressID,6,TrigUnit) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function TorpedoCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Torpedo takes nothing returns nothing
set gg_trg_Create_Torpedo = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Torpedo, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Torpedo, Condition( function Trig_Create_Torpedo_Conditions ) )
call TriggerAddAction( gg_trg_Create_Torpedo, function Trig_Create_Torpedo_Actions )
endfunction
function Trig_Create_Storm_bolt_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00A' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Storm_bolt_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00I',TrigUnitLoc,LaunchAngle)
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1100*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1100*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveUnitHandle(udg_Hash,ProjProgressID,6,TrigUnit) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function StormBoltCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Storm_bolt takes nothing returns nothing
set gg_trg_Create_Storm_bolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Storm_bolt, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Storm_bolt, Condition( function Trig_Create_Storm_bolt_Conditions ) )
call TriggerAddAction( gg_trg_Create_Storm_bolt, function Trig_Create_Storm_bolt_Actions )
endfunction
function Trig_Create_Ugly_finger_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00B' ) ) then
return false
endif
return true
endfunction
function Trig_Create_Ugly_finger_Actions takes nothing returns nothing
local timer AttackAnimProgress=null
local unit TrigUnit=GetTriggerUnit()
local location TrigUnitLoc=GetUnitLoc(TrigUnit)
local real LaunchAngle=(bj_RADTODEG*Atan2(GetLocationY(GetSpellTargetLoc()) - GetLocationY(TrigUnitLoc), GetLocationX(GetSpellTargetLoc()) - GetLocationX(TrigUnitLoc)))
local timer ProjProgress=CreateTimer()
local integer ProjProgressID=GetHandleId(ProjProgress)
local unit Proj=CreateUnitAtLoc(GetOwningPlayer(TrigUnit),'h00F',TrigUnitLoc,LaunchAngle)
set AttackAnimProgress=CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(AttackAnimProgress),0,TrigUnit)
call TimerStart(AttackAnimProgress,0.01,false,function AttackAnim)
set AttackAnimProgress=null
call UnitAddAbility(Proj,'Amrf') //give ground proj dummy fly ability
call UnitRemoveAbility(Proj,'Amrf')
call SetUnitFlyHeight(Proj,30.00,0)
//Save data on udg_Hash
call SaveUnitHandle(udg_Hash,ProjProgressID,0,Proj)
call SaveReal(udg_Hash,ProjProgressID,1,0.00) //time
call SaveReal(udg_Hash,ProjProgressID,2,(1100*(Cos(bj_DEGTORAD*LaunchAngle)))) //xc1
call SaveReal(udg_Hash,ProjProgressID,3,GetLocationX(TrigUnitLoc)) //xc2
call SaveReal(udg_Hash,ProjProgressID,4,(1100*(Sin(bj_DEGTORAD*LaunchAngle)))) //yc1
call SaveReal(udg_Hash,ProjProgressID,5,GetLocationY(TrigUnitLoc)) //yc2
call SaveUnitHandle(udg_Hash,ProjProgressID,6,TrigUnit) //Launcher
//Save data ends.................
call TimerStart(ProjProgress,0.03,true,function UglyFingerCBF)
//Remove memory leaks
set Proj=null
call RemoveLocation(TrigUnitLoc)
set TrigUnit=null
set TrigUnitLoc=null
set ProjProgress=null
//memory leaks removed.................
endfunction
//===========================================================================
function InitTrig_Create_Ugly_finger takes nothing returns nothing
set gg_trg_Create_Ugly_finger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Ugly_finger, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Create_Ugly_finger, Condition( function Trig_Create_Ugly_finger_Conditions ) )
call TriggerAddAction( gg_trg_Create_Ugly_finger, function Trig_Create_Ugly_finger_Actions )
endfunction