//10
constant function Caster_UnitId takes nothing returns integer
return 'e000'
endfunction
constant function Caster_DefaultAttackType takes nothing returns attacktype
return ATTACK_TYPE_CHAOS
endfunction
constant function Caster_DefaultDamageType takes nothing returns damagetype
return DAMAGE_TYPE_UNIVERSAL
endfunction
function DamageTreeDetectorId takes nothing returns integer
return 'Aeat'
endfunction
function CasterSytem_H2I takes handle h returns integer
return h
return 0
endfunction
function SpellEffectModelPath takes integer abilityid,effecttype t returns string
return GetAbilityEffectById(abilityid,t,0)
endfunction
function AddCasterFacing takes real fac returns unit
set udg_currentcaster=CreateUnit(Player(15),Caster_UnitId(),0,0,fac)
call UnitAddAbility(udg_currentcaster,'Aloc')
return udg_currentcaster
endfunction
function AddCaster takes nothing returns unit
return AddCasterFacing(0)
endfunction
function CreateCasters takes integer n returns nothing
local integer a=0
local unit c
set udg_castervars[100]=-1
set udg_castervars[101]=-1
set udg_castervars[102]=-1
set udg_castervars[103]=-1
set udg_castervars[104]=-1
loop
exitwhen a>=n
set c=AddCaster()
call GroupAddUnit(udg_casters,c)
set a=a+1
endloop
set c=null
call RemoveLocation(udg_sourcehack)
set udg_sourcehack=null
endfunction
function GetACaster takes nothing returns unit
set udg_currentcaster=FirstOfGroup(udg_casters)
if udg_currentcaster==null then
set udg_currentcaster=AddCaster()
endif
call GroupRemoveUnit(udg_casters,udg_currentcaster)
call SetUnitState(udg_currentcaster,UNIT_STATE_MANA,1000)
return udg_currentcaster
endfunction
function RecicleCaster takes unit caster returns nothing
if not IsUnitDeadBJ(caster) then
call SetUnitOwner(caster,Player(15),true)
call SetUnitVertexColor(caster,255,255,255,255)
call SetUnitScale(caster,1,1,1)
call SetUnitTimeScale(caster,1)
call SetUnitMoveSpeed(caster,522)
call SetUnitFlyHeight(caster,0,0)
call UnitAddAbility(caster,'Aloc')
call SetUnitTurnSpeed(caster,0.6)
call GroupAddUnit(udg_casters,caster)
endif
endfunction
function CasterWaitForEndCast takes nothing returns nothing
local unit caster=udg_currentcaster
local integer abilid=udg_currentabi
local real delay=udg_castervars[0]
local boolean activeability=(udg_castervars[1]>0)
loop
exitwhen GetUnitCurrentOrder(caster)==0
call TriggerSleepAction(0)
endloop
if activeability then
call PolledWait(delay)
call UnitRemoveAbility(caster,abilid)
else
call UnitRemoveAbility(caster,abilid)
call PolledWait(delay)
endif
call RecicleCaster(caster)
set caster=null
endfunction
function RecicleCasterAfterCastEx takes unit caster,real delaytime,integer abilid,boolean activeability returns nothing
set udg_castervars[0]=delaytime
set udg_castervars[1]=IntegerTertiaryOp(activeability,1,0)
set udg_currentabi=abilid
set udg_currentcaster=caster
call ExecuteFunc("CasterWaitForEndCast")
endfunction
function RecicleCasterAfterCast takes unit caster,integer abilid returns nothing
call RecicleCasterAfterCastEx(caster,udg_delayhack,abilid,false)
endfunction
function PreloadAbility takes integer abilid returns integer
local unit u=FirstOfGroup(udg_casters)
if u==null then
set u=GetACaster()
call UnitAddAbility(u,abilid)
call UnitRemoveAbility(u,abilid)
call RecicleCaster(u)
else
call UnitAddAbility(u,abilid)
call UnitRemoveAbility(u,abilid)
endif
set u=null
return abilid
endfunction
function CasterCastAbilityLevel takes player owner,integer abilid,integer level,string order,widget target,boolean instant returns unit
local unit caster=GetACaster()
local boolean done=false
call SetUnitOwner(caster,owner,false)
call UnitAddAbility(caster,abilid)
call SetUnitAbilityLevel(caster,abilid,level)
if udg_sourcehack!=null then
call SetUnitPositionLoc(caster,udg_sourcehack)
else
call SetUnitPosition(caster,GetWidgetX(target),GetWidgetY(target))
endif
if S2I(order)!=0 then
set done=IssueTargetOrderById(caster,S2I(order),target)
else
set done=IssueTargetOrder(caster,order,target)
endif
if instant or not(done) then
call UnitRemoveAbility(caster,abilid)
call RecicleCaster(caster)
else
call RecicleCasterAfterCastEx(caster,udg_delayhack,abilid,true)
endif
set udg_currentcaster=caster
set caster=null
return udg_currentcaster
endfunction
function CasterCastAbility takes player owner,integer abilid,string order,widget target,boolean instant returns unit
return CasterCastAbilityLevel(owner,abilid,1,order,target,instant)
endfunction
function CasterCastAbilityLevelPoint takes player owner,integer abilid,integer level,string order,real x,real y,boolean instant returns unit
local unit caster=GetACaster()
call SetUnitOwner(caster,owner,false)
call UnitAddAbility(caster,abilid)
call SetUnitAbilityLevel(caster,abilid,level)
if udg_sourcehack!=null then
call SetUnitPositionLoc(caster,udg_sourcehack)
else
call SetUnitPosition(caster,x,y)
endif
if S2I(order)!=0 then
if not IssuePointOrderById(caster,S2I(order),x,y) then
call IssueImmediateOrderById(caster,S2I(order))
endif
else
if not IssuePointOrder(caster,order,x,y) then
call IssueImmediateOrder(caster,order)
endif
endif
if instant then
call UnitRemoveAbility(caster,abilid)
call RecicleCaster(caster)
else
call RecicleCasterAfterCastEx(caster,udg_delayhack,abilid,true)
endif
set udg_currentcaster=caster
set caster=null
return udg_currentcaster
endfunction
function CasterCastAbilityPoint takes player owner,integer abilid,string order,real x,real y,boolean instant returns unit
return CasterCastAbilityLevelPoint(owner,abilid,1,order,x,y,instant)
endfunction
function CasterCastAbilityPointLoc takes player owner,integer abilid,string order,location loc,boolean instant returns unit
return CasterCastAbilityLevelPoint(owner,abilid,1,order,GetLocationX(loc),GetLocationY(loc),instant)
endfunction
function CasterCastAbilityLevelPointLoc takes player owner,integer abilid,integer level,string order,location loc,boolean instant returns unit
return CasterCastAbilityLevelPoint(owner,abilid,level,order,GetLocationX(loc),GetLocationY(loc),instant)
endfunction
function CasterUseAbilityStatic_Child takes nothing returns nothing
local unit caster=udg_currentcaster
local effect fx=bj_lastCreatedEffect
local integer abilid=udg_currentabi
call PolledWait(udg_castervars[1])
call DestroyEffect(fx)
call UnitRemoveAbility(caster,abilid)
call TriggerSleepAction(2)
call RecicleCaster(caster)
set fx=null
set caster=null
endfunction
function CasterUseAbilityLevelStatic takes player owner,string modelpath,integer abilityid,integer level,real duration,real x,real y returns unit
set udg_currentcaster=GetACaster()
call SetUnitPosition(udg_currentcaster,x,y)
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,udg_currentcaster,"origin")
set udg_castervars[1]=duration
call SetUnitOwner(udg_currentcaster,owner,true)
call UnitAddAbility(udg_currentcaster,abilityid)
call SetUnitAbilityLevel(udg_currentcaster,abilityid,level)
set udg_currentabi=abilityid
call ExecuteFunc("CasterUseAbilityStatic_Child")
return udg_currentcaster
endfunction
function CasterUseAbilityStatic takes player owner,string modelpath,integer abilityid,real duration,real x,real y returns unit
return CasterUseAbilityLevelStatic(owner,modelpath,abilityid,1,duration,x,y)
endfunction
function CasterUseAbilityStaticLoc takes player owner,string modelpath,integer abilityid,real duration,location loc returns unit
return CasterUseAbilityLevelStatic(owner,modelpath,abilityid,1,duration,GetLocationX(loc),GetLocationY(loc))
endfunction
function CasterUseAbilityLevelStaticLoc takes player owner,string modelpath,integer abilityid,integer level,real duration,location loc returns unit
return CasterUseAbilityLevelStatic(owner,modelpath,abilityid,level,duration,GetLocationX(loc),GetLocationY(loc))
endfunction
function CasterCastAbilityLevelGroup takes player owner,integer abilid,integer level,string order,group targetgroup,boolean instant returns nothing
local group affected
local unit tempunit
local unit caster=null
if bj_wantDestroyGroup then
set bj_wantDestroyGroup=false
set affected=targetgroup
else
set affected=CreateGroup()
call GroupAddGroup(targetgroup,affected)
endif
loop
set tempunit=FirstOfGroup(affected)
exitwhen tempunit==null
if instant then
if caster==null then
set caster=GetACaster()
call SetUnitOwner(caster,owner,false)
call UnitAddAbility(caster,abilid)
call SetUnitAbilityLevel(caster,abilid,level)
endif
if udg_sourcehack!=null then
call SetUnitPositionLoc(caster,udg_sourcehack)
else
call SetUnitPosition(caster,GetUnitX(tempunit),GetUnitY(tempunit))
endif
if S2I(order)!=0 then
call IssueTargetOrderById(caster,S2I(order),tempunit)
else
call IssueTargetOrder(caster,order,tempunit)
endif
else
call CasterCastAbilityLevel(owner,abilid,level,order,tempunit,false)
endif
call GroupRemoveUnit(affected,tempunit)
endloop
if caster!=null then
call UnitRemoveAbility(caster,abilid)
call RecicleCaster(caster)
endif
call DestroyGroup(affected)
set affected=null
set tempunit=null
set caster=null
endfunction
function CasterCastAbilityGroup takes player owner,integer abilid,string order,group targetgroup,boolean instant returns nothing
call CasterCastAbilityLevelGroup(owner,abilid,1,order,targetgroup,instant)
endfunction
function CasterAOE_IsFilterEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),bj_groupEnumOwningPlayer) and not(IsUnitDeadBJ(GetFilterUnit()))
endfunction
function CasterAOE_IsFilterAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),bj_groupEnumOwningPlayer) and not(IsUnitDeadBJ(GetFilterUnit()))
endfunction
function CasterCastAbilityLevelAOE takes player owner,integer abilid,integer level,string order,real x,real y,real radius,boolean goodeffect,boolean instant returns nothing
local boolexpr b
local group aoe=CreateGroup()
set bj_groupEnumOwningPlayer=owner
if goodeffect then
set b=Condition(function CasterAOE_IsFilterAlly)
else
set b=Condition(function CasterAOE_IsFilterEnemy)
endif
call GroupEnumUnitsInRange(aoe,x,y,radius,b)
set bj_wantDestroyGroup=true
call CasterCastAbilityLevelGroup(owner,abilid,level,order,aoe,instant)
call DestroyBoolExpr(b)
set b=null
set aoe=null
endfunction
function CasterCastAbilityAOE takes player owner,integer abilid,string order,real x,real y,real radius,boolean goodeffect,boolean instant returns nothing
call CasterCastAbilityLevelAOE(owner,abilid,1,order,x,y,radius,goodeffect,instant)
endfunction
function CasterCastAbilityAOELoc takes player owner,integer abilid,string order,location center,real radius,boolean goodeffect,boolean instant returns nothing
call CasterCastAbilityLevelAOE(owner,abilid,1,order,GetLocationX(center),GetLocationY(center),radius,goodeffect,instant)
endfunction
function CasterCastAbilityLevelAOELoc takes player owner,integer abilid,integer level,string order,location center,real radius,boolean goodeffect,boolean instant returns nothing
call CasterCastAbilityLevelAOE(owner,abilid,level,order,GetLocationX(center),GetLocationY(center),radius,goodeffect,instant)
endfunction
function ResetSourceHack takes nothing returns nothing
call RemoveLocation(udg_sourcehack)
set udg_sourcehack=null
call DestroyTimer(GetExpiredTimer())
endfunction
function CasterSetCastSource takes real x,real y returns nothing
set udg_sourcehack=Location(x,y)
call TimerStart(CreateTimer(),0,false,function ResetSourceHack)
endfunction
function CasterSetCastSourceLoc takes location loc returns nothing
call CasterSetCastSource(GetLocationX(loc),GetLocationY(loc))
endfunction
function ResetDelayHack takes nothing returns nothing
set udg_delayhack=0
call DestroyTimer(GetExpiredTimer())
endfunction
function CasterSetRecycleDelay takes real Delay returns nothing
set udg_delayhack=Delay
call TimerStart(CreateTimer(),0,false,function ResetDelayHack)
endfunction
function DamageTypes takes attacktype attT,damagetype dmgT returns integer
set udg_castervars[100]=CasterSytem_H2I(attT)
set udg_castervars[101]=CasterSytem_H2I(dmgT)
return 1
endfunction
function DamageException takes unittype Exception,real ExceptionFactor returns integer
set udg_castervars[102]=CasterSytem_H2I(Exception)
set udg_castervars[103]=ExceptionFactor
return 2
endfunction
function DamageOnlyTo takes unittype ThisUnitType returns integer
set udg_castervars[104]=CasterSytem_H2I(ThisUnitType)
return 4
endfunction
function DontDamageSelf takes nothing returns integer
return 8
endfunction
function DamageTrees takes nothing returns integer
return 16
endfunction
function DamageOnlyVisibles takes nothing returns integer
return 32
endfunction
function GetDamageFactor takes unit u,attacktype a,damagetype d returns real
local real hp=GetWidgetLife(u)
local real r
call UnitDamagePoint(u,0,1,GetUnitX(u),GetUnitY(u),0.01,true,false,a,d,null)
set r=(hp-GetWidgetLife(u))*100
call SetWidgetLife(u,hp)
return r
endfunction
function GetDamageFactorByOptions takes unit hurter,unit target,integer DamageOptions returns real
local real r=1
if DamageOptions>=32 then
set DamageOptions=DamageOptions-32
if not IsUnitVisible(target,GetOwningPlayer(hurter)) then
return 0.0
endif
endif
if DamageOptions>=16 then
set DamageOptions=DamageOptions-16
endif
if DamageOptions>=8 then
set DamageOptions=DamageOptions-8
if hurter==target then
return 0.0
endif
endif
if DamageOptions>=4 then
set DamageOptions=DamageOptions-4
if not IsUnitType(target,ConvertUnitType(R2I(udg_castervars[104]))) then
return 0.0
endif
endif
if DamageOptions>=2 then
set DamageOptions=DamageOptions-2
if IsUnitType(target,ConvertUnitType(R2I(udg_castervars[102]))) then
set r=r*udg_castervars[103]
endif
endif
if DamageOptions>=1 then
set DamageOptions=DamageOptions-1
set r=r*GetDamageFactor(target,ConvertAttackType(R2I(udg_castervars[100])),ConvertDamageType(R2I(udg_castervars[101])))
endif
return r
endfunction
function DamageUnitByTypes takes unit hurter,unit target,real dmg,attacktype attT,damagetype dmgT returns boolean
return UnitDamageTarget(hurter,target,dmg*GetDamageFactor(target,attT,dmgT),true,false,null,null,null)
endfunction
function DamageUnitByOptions takes unit hurter,unit target,real dmg,integer DamageOptions returns boolean
return UnitDamageTarget(hurter,target,dmg*GetDamageFactorByOptions(hurter,target,DamageOptions),true,false,null,null,null)
endfunction
function DamageUnit takes player hurter,real damage,unit victim returns boolean
local unit caster=GetACaster()
call UnitRemoveAbility(caster,'Aloc')
call SetUnitPosition(caster,GetUnitX(victim),GetUnitY(victim))
call SetUnitOwner(caster,hurter,false)
call DamageUnitByTypes(caster,victim,damage,Caster_DefaultAttackType(),Caster_DefaultDamageType())
call RecicleCaster(caster)
return GetWidgetLife(victim)<=0
endfunction
function UnitDamageUnitTimed_Child takes nothing returns nothing
local real damage=udg_castervars[0]
local real damageperiod=udg_castervars[2]
local effect fx=bj_lastCreatedEffect
local timer t=CreateTimer()
local unit hurter=udg_currenthurter
local real next=0
local integer i=0
local real c
local unit target=udg_currentcaster
local damagetype dmgT=ConvertDamageType(R2I(udg_castervars[4]))
local attacktype attT=ConvertAttackType(R2I(udg_castervars[3]))
call TimerStart(t,udg_castervars[1]-0.01,false,null)
loop
if TimerGetElapsed(t)>=next then
exitwhen not DamageUnitByTypes(hurter,target,damage,attT,dmgT)
exitwhen IsUnitDeadBJ(target)
set i=i+1
set next=i*damageperiod
endif
exitwhen (TimerGetRemaining(t)<=0) or IsUnitDeadBJ(target)
call TriggerSleepAction(0)
endloop
call DestroyEffect(fx)
call DestroyTimer(t)
set t=null
set fx=null
set dmgT=null
set attT=null
endfunction
function UnitDamageUnitTimed takes unit hurter,real damageps,real damageperiod,real duration,unit target,string modelpath,string attachPointName,attacktype attT,damagetype dmgT returns nothing
local unit c=udg_currentcaster
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,target,attachPointName)
set udg_currentcaster=target
set udg_castervars[0]=damageps
set udg_castervars[1]=duration
set udg_castervars[2]=damageperiod
set udg_castervars[3]=CasterSytem_H2I(attT)
set udg_castervars[4]=CasterSytem_H2I(dmgT)
set udg_currenthurter=hurter
call ExecuteFunc("UnitDamageUnitTimed_Child")
set udg_currentcaster=c
set c=null
endfunction
function DamageUnitTimedEx_Child takes nothing returns nothing
local real damage=udg_castervars[0]
local real damageperiod=udg_castervars[2]
local effect fx=bj_lastCreatedEffect
local timer t=CreateTimer()
local integer id=udg_currentabi
local real next=0
local integer i=0
local real c
local unit target=udg_currentcaster
call TimerStart(t,udg_castervars[1]-0.01,false,null)
loop
if TimerGetElapsed(t)>=next then
exitwhen DamageUnit(Player(id),damage,target)
set i=i+1
set next=i*damageperiod
endif
exitwhen (TimerGetRemaining(t)<=0) or IsUnitDeadBJ(target)
call TriggerSleepAction(0)
endloop
call DestroyEffect(fx)
call DestroyTimer(t)
set t=null
set fx=null
endfunction
function DamageUnitTimedEx takes player owner,real damageps,real damageperiod,real duration,unit target,string modelpath,string attachPointName returns nothing
local unit c=udg_currentcaster
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,target,attachPointName)
set udg_currentcaster=target
set udg_castervars[0]=damageps
set udg_castervars[1]=duration
set udg_castervars[2]=damageperiod
set udg_currentabi=GetPlayerId(owner)
call ExecuteFunc("DamageUnitTimedEx_Child")
set udg_currentcaster=c
set c=null
endfunction
function DamageUnitTimed takes player owner,real damageps,real duration,unit target,string modelpath,string attachPointName returns nothing
call DamageUnitTimedEx(owner,damageps,1,duration,target,modelpath,attachPointName)
endfunction
function CasterSystemCache takes nothing returns gamecache
return InitGameCache("castersystem.c")
endfunction
function SetDamageOptions_i takes gamecache g,integer n,integer DamageOptions returns nothing
local string key="DOPT"+I2S(n)
call StoreInteger(g,key,"value",DamageOptions)
if DamageOptions>=32 then
set DamageOptions=DamageOptions-32
endif
if DamageOptions>=16 then
set DamageOptions=DamageOptions-16
endif
if DamageOptions>=8 then
set DamageOptions=DamageOptions-8
endif
if DamageOptions>=4 then
call StoreInteger(g,key,"only",R2I(udg_castervars[104]))
set DamageOptions=DamageOptions-4
endif
if DamageOptions>=2 then
call StoreInteger(g,key,"excp",R2I(udg_castervars[102]))
call StoreReal(g,key,"excf",udg_castervars[103])
set DamageOptions=DamageOptions-2
endif
if DamageOptions>=1 then
call StoreInteger(g,key,"attT",R2I(udg_castervars[100]))
call StoreInteger(g,key,"dmgT",R2I(udg_castervars[101]))
endif
endfunction
function SetDamageOptions takes integer id,integer DamageOptions returns nothing
call SetDamageOptions_i(CasterSystemCache(),id,DamageOptions)
endfunction
function CreateDamageOptions takes integer DamageOptions returns integer
local gamecache g=CasterSystemCache()
local integer n=GetStoredInteger(g,"misc","DOPTn")+1
call StoreInteger(g,"misc","DOPTn",n)
call SetDamageOptions_i(g,n,DamageOptions)
set g=null
return n
endfunction
function DestroyDamageOptions takes integer id returns nothing
call FlushStoredMission(CasterSystemCache(),"DOPT"+I2S(id))
endfunction
function LoadDamageOptions takes integer id returns integer
local gamecache g=CasterSystemCache()
local string key="DOPT"+I2S(id)
local integer opt=GetStoredInteger(g,key,"value")
local integer v=opt
if v>=32 then
set v=v-32
endif
if v>=16 then
set v=v-16
endif
if v>=8 then
set v=v-8
endif
if v>=4 then
set udg_castervars[104]=GetStoredInteger(g,key,"only")
set v=v-4
endif
if v>=2 then
set udg_castervars[102]=GetStoredInteger(g,key,"excp")
set udg_castervars[103]=GetStoredReal(g,key,"excf")
set v=v-2
endif
if v>=1 then
set udg_castervars[100]=GetStoredInteger(g,key,"attT")
set udg_castervars[101]=GetStoredInteger(g,key,"dmgT")
endif
set g=null
return opt
endfunction
function DamageTreesInCircleEnum takes nothing returns nothing
local destructable d=GetEnumDestructable()
local unit u=udg_currentcaster
if IssueTargetOrder(udg_currentcaster,"eattree",d) and (SquareRoot(Pow(GetDestructableX(d)-udg_castervars[200],2)+Pow(GetDestructableY(d)-udg_castervars[201],2))<=udg_castervars[202]) then
call KillDestructable(d)
endif
set udg_currentcaster=u
set u=null
set d=null
endfunction
function DamageTreesInCircle takes real x,real y,real radius returns nothing
local rect r=Rect(x-radius,y-radius,x+radius,y+radius)
local unit c=GetACaster()
set udg_castervars[200]=x
set udg_castervars[201]=y
set udg_castervars[202]=radius
call UnitAddAbility(c,DamageTreeDetectorId())
call SetUnitPosition(c,x,y)
set udg_currentcaster=c
call EnumDestructablesInRect(r,null,function DamageTreesInCircleEnum)
call UnitRemoveAbility(c,DamageTreeDetectorId())
call RecicleCaster(c)
call RemoveRect(r)
set r=null
set c=null
endfunction
function DamageTreesInCircleLoc takes location loc,real radius returns nothing
call DamageTreesInCircle(GetLocationX(loc),GetLocationY(loc),radius)
endfunction
function DamageUnitGroupEx takes unit hurter,real damage,group targetgroup,integer DamageOptions returns nothing
local attacktype attT
local damagetype dmgT
local real efct=0
local real dmex
local real D
local group affected
local unit p
local unittype onlyif=null
local unittype exc=null
local boolean self
local boolean inv
local player pla
if DamageOptions>=32 then
set inv=true
set pla=GetOwningPlayer(hurter)
set DamageOptions=DamageOptions-32
else
set inv=false
endif
if DamageOptions>=16 then
set DamageOptions=DamageOptions-16
endif
if DamageOptions>=8 then
set self=false
set DamageOptions=DamageOptions-8
else
set self=true
endif
if DamageOptions>=4 then
set onlyif=ConvertUnitType(R2I(udg_castervars[104]))
set DamageOptions=DamageOptions-4
endif
if DamageOptions>=2 then
set exc=ConvertUnitType(R2I(udg_castervars[102]))
set dmex=damage*udg_castervars[103]
set DamageOptions=DamageOptions-2
endif
if DamageOptions>=1 then
set attT=ConvertAttackType(R2I(udg_castervars[100]))
set dmgT=ConvertDamageType(R2I(udg_castervars[101]))
else
set attT=Caster_DefaultAttackType()
set dmgT=Caster_DefaultDamageType()
endif
if bj_wantDestroyGroup then
set bj_wantDestroyGroup=false
set affected=targetgroup
else
set affected=CreateGroup()
call GroupAddGroup(targetgroup,affected)
endif
loop
set p=FirstOfGroup(affected)
exitwhen p==null
if (onlyif==null or IsUnitType(p,onlyif)) and (self or p!=hurter) and (not(inv) or IsUnitVisible(p,pla)) then
if p!=null and exc!=null and IsUnitType(p,exc) then
set D=dmex
else
set D=damage
endif
call DamageUnitByTypes(hurter,p,D,attT,dmgT)
endif
call GroupRemoveUnit(affected,p)
endloop
call DestroyGroup(affected)
set affected=null
set p=null
set attT=null
set dmgT=null
set onlyif=null
set exc=null
endfunction
function DamageUnitsInAOEEx takes unit hurter,real damage,real x,real y,real radius,boolean affectallied,integer DamageOptions returns nothing
local boolexpr b=null
local group aoe=CreateGroup()
set bj_groupEnumOwningPlayer=GetOwningPlayer(hurter)
if DamageOptions>=16 then
call DamageTreesInCircle(x,y,radius)
set DamageOptions=DamageOptions-16
endif
if not(affectallied) then
set b=Condition(function CasterAOE_IsFilterEnemy)
endif
call GroupEnumUnitsInRange(aoe,x,y,radius,b)
set bj_wantDestroyGroup=true
call DamageUnitGroupEx(hurter,damage,aoe,DamageOptions)
call DestroyBoolExpr(b)
set b=null
set aoe=null
endfunction
function DamageUnitsInAOEExLoc takes unit hurter,real damage,location loc,real radius,boolean affectallied,integer DamageOptions returns nothing
call DamageUnitsInAOEEx(hurter,damage,GetLocationX(loc),GetLocationY(loc),radius,affectallied,DamageOptions)
endfunction
function DamageUnitGroup takes player hurter,real damage,group targetgroup returns nothing
local unit caster=GetACaster()
call UnitRemoveAbility(caster,'Aloc')
call SetUnitOwner(caster,hurter,false)
call DamageUnitGroupEx(caster,damage,targetgroup,0)
call RecicleCaster(caster)
set caster=null
endfunction
function DamageUnitsInAOE takes player hurter,real damage,real x,real y,real radius,boolean affectallied returns nothing
local unit caster=GetACaster()
call UnitRemoveAbility(caster,'Aloc')
call SetUnitOwner(caster,hurter,false)
call DamageUnitsInAOEEx(caster,damage,x,y,radius,affectallied,0)
call RecicleCaster(caster)
set caster=null
endfunction
function DamageUnitsInAOELoc takes player hurter,real damage,location loc,real radius,boolean affectallied returns nothing
call DamageUnitsInAOE(hurter,damage,GetLocationX(loc),GetLocationY(loc),radius,affectallied)
endfunction
function AddAreaDamagerForUnit_Child takes nothing returns nothing
local real D
local real damageps=udg_castervars[0]
local real area=udg_castervars[2]
local real damageperiod=udg_castervars[3]
local real excd=udg_castervars[8]
local boolean affectallies=(udg_castervars[4]==1)
local boolean self=(udg_castervars[5]==1)
local effect fx=bj_lastCreatedEffect
local unit hurter=udg_currenthurter
local unit fire=udg_currentcaster
local player owner=GetOwningPlayer(fire)
local timer t=CreateTimer()
local real next=0
local integer a=0
local group inrange=CreateGroup()
local string c
local string art=bj_lastPlayedMusic
local string attach=""
local unit picked
local boolean recicled=false
local unittype only=null
local unittype exce=null
local attacktype attT
local damagetype dmgT
local boolean trees=(udg_castervars[11]==1)
local boolean inv=(udg_castervars[12]==1)
if udg_castervars[6]!=-1 then
set only=ConvertUnitType(R2I(udg_castervars[6]))
endif
if udg_castervars[7]!=-1 then
set exce=ConvertUnitType(R2I(udg_castervars[7]))
endif
if udg_castervars[9]!=-1 then
set attT=ConvertAttackType(R2I(udg_castervars[9]))
else
set attT=Caster_DefaultAttackType()
endif
if udg_castervars[10]!=-1 then
set dmgT=ConvertDamageType(R2I(udg_castervars[10]))
else
set dmgT=Caster_DefaultDamageType()
endif
loop
set c=SubString(art,a,a+1)
exitwhen c=="!" or c==""
set attach=attach+c
set a=a+1
endloop
set art=SubString(art,a+1,10000)
call TimerStart(t,udg_castervars[1]-0.01,false,null)
set a=0
loop
if IsUnitInGroup(fire,udg_casters) then
set recicled=true
call GroupRemoveUnit(udg_casters,fire)
endif
exitwhen recicled
if TimerGetElapsed(t)>=next then
set a=a+1
set next=a*damageperiod
call GroupEnumUnitsInRange(inrange,GetUnitX(fire),GetUnitY(fire),area,null)
if trees then
call DamageTreesInCircle(GetUnitX(fire),GetUnitY(fire),area)
endif
loop
set picked=FirstOfGroup(inrange)
exitwhen picked==null
if (self or picked!=hurter) and not(IsUnitDeadBJ(picked)) and (affectallies or IsUnitEnemy(picked,owner)) and (only==null or IsUnitType(picked,only)) then
if not(inv) or IsUnitVisible(picked,owner) then
set D=0
endif
if exce!=null and IsUnitType(picked,exce) then
set D=excd
else
set D=damageps
endif
if D!=0 then
call UnitDamageUnitTimed(hurter,D,damageperiod,damageperiod,picked,art,attach,attT,dmgT)
endif
endif
call GroupRemoveUnit(inrange,picked)
endloop
endif
exitwhen TimerGetRemaining(t)<=0
call TriggerSleepAction(0)
endloop
call DestroyGroup(inrange)
call DestroyEffect(fx)
call TriggerSleepAction(2)
call RecicleCaster(fire)
call DestroyTimer(t)
set inrange=null
set fire=null
set t=null
set owner=null
set fx=null
set picked=null
endfunction
function AddAreaDamagerForUnit takes unit hurter,string modelpath,string targetart,string targetattach,real x,real y,real damage,real damageperiod,real duration,real area,boolean affectallies,integer DamageOptions returns unit
local string s=bj_lastPlayedMusic
set bj_lastPlayedMusic=targetattach+"!"+targetart
set udg_currentcaster=GetACaster()
call SetUnitPosition(udg_currentcaster,x,y)
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,udg_currentcaster,"origin")
set udg_castervars[0]=damage
set udg_castervars[1]=duration
set udg_castervars[2]=area
set udg_castervars[3]=damageperiod
set udg_castervars[4]=IntegerTertiaryOp(affectallies,1,0)
if DamageOptions>=32 then
set udg_castervars[12]=1
set DamageOptions=DamageOptions-32
else
set udg_castervars[12]=0
endif
if DamageOptions>=16 then
set udg_castervars[11]=1
set DamageOptions=DamageOptions-16
else
set udg_castervars[11]=0
endif
if DamageOptions>=8 then
set udg_castervars[5]=0
set DamageOptions=DamageOptions-8
else
set udg_castervars[5]=1
endif
if DamageOptions>=4 then
set udg_castervars[6]=udg_castervars[104]
set DamageOptions=DamageOptions-4
else
set udg_castervars[6]=-1
endif
if DamageOptions>=2 then
set udg_castervars[7]=udg_castervars[102]
set udg_castervars[8]=damage*udg_castervars[103]
set DamageOptions=DamageOptions-2
else
set udg_castervars[7]=-1
set udg_castervars[8]=-1
endif
if DamageOptions>=1 then
set udg_castervars[9]=udg_castervars[100]
set udg_castervars[10]=udg_castervars[101]
else
set udg_castervars[9]=-1
set udg_castervars[10]=-1
endif
set udg_currenthurter=hurter
call SetUnitOwner(udg_currentcaster,GetOwningPlayer(hurter),true)
call ExecuteFunc("AddAreaDamagerForUnit_Child")
set bj_lastPlayedMusic=s
return udg_currentcaster
endfunction
function AddAreaDamagerForUnitLoc takes unit hurter,string modelpath,string targetart,string targetattach,location loc,real damage,real damageperiod,real duration,real area,boolean affectallies,integer DamageOptions returns unit
return AddAreaDamagerForUnit(hurter,modelpath,targetart,targetattach,GetLocationX(loc),GetLocationY(loc),damage,damageperiod,duration,area,affectallies,DamageOptions)
endfunction
function AddDamagingEffectEx takes player owner,string modelpath,string targetart,string targetattach,real x,real y,real damage,real damageperiod,real duration,real area,boolean affectallies returns unit
local string s=bj_lastPlayedMusic
set bj_lastPlayedMusic=targetattach+"!"+targetart
set udg_currentcaster=GetACaster()
call SetUnitPosition(udg_currentcaster,x,y)
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,udg_currentcaster,"origin")
set udg_castervars[0]=damage
set udg_castervars[1]=duration
set udg_castervars[2]=area
set udg_castervars[3]=damageperiod
set udg_castervars[4]=IntegerTertiaryOp(affectallies,1,0)
set udg_castervars[5]=1
set udg_castervars[6]=-1
set udg_castervars[7]=-1
set udg_castervars[8]=-1
set udg_castervars[9]=-1
set udg_castervars[10]=-1
set udg_currenthurter=udg_currentcaster
call SetUnitOwner(udg_currentcaster,owner,true)
call ExecuteFunc("AddAreaDamagerForUnit_Child")
set bj_lastPlayedMusic=s
return udg_currentcaster
endfunction
function AddDamagingEffectExLoc takes player owner,string modelpath,string targetart,string targetattach,location loc,real damage,real damageperiod,real duration,real area,boolean affectallies returns unit
return AddDamagingEffectEx(owner,modelpath,targetart,targetattach,GetLocationX(loc),GetLocationY(loc),damage,damageperiod,duration,area,affectallies)
endfunction
function AddDamagingEffect takes player owner,string modelpath,real x,real y,real damageps,real duration,real area,boolean affectallies returns unit
return AddDamagingEffectEx(owner,modelpath,"","",x,y,damageps,1,duration,area,affectallies)
endfunction
function AddDamagingEffectLoc takes player owner,string modelpath,location loc,real damageps,real duration,real area,boolean affectallies returns unit
return AddDamagingEffectEx(owner,modelpath,"","",GetLocationX(loc),GetLocationY(loc),damageps,1,duration,area,affectallies)
endfunction
function UnitMoveToAsProjectileGen takes unit m,real arc,real x2,real y2,unit target,real z2 returns nothing
local real x1=GetUnitX(m)
local real y1=GetUnitY(m)
local real acel=arc*1600
local real speed=GetUnitMoveSpeed(m)
local real z1=GetUnitFlyHeight(m)
local real d
local real d1
local real d2
local real t
local real vel
local real dif=0
local boolean tounit=(target!=null)
local boolean b=false
local boolean mode=false
if tounit then
set x2=GetUnitX(target)
set y2=GetUnitY(target)
set z2=GetUnitFlyHeight(target)+z2
endif
set mode=(z2>z1)
set d=SquareRoot(Pow(x2-x1,2)+Pow(y2-y1,2))
set d1=1000000
set d2=0
set t=d/speed
if t==0 then
set t=0.001
endif
set vel=(z2-z1+0.5*acel*t*t)/t
call SetUnitFacing(m,Atan2BJ(y2-y1,x2-x2))
call IssuePointOrder(m,"move",x2,y2)
set t=0
loop
set d2=d1
if tounit then
if IsUnitDeadBJ(target) then
set tounit=false
else
set x2=GetUnitX(target)
set y2=GetUnitY(target)
endif
endif
set d1=SquareRoot(Pow(x2-GetUnitX(m),2)+Pow(y2-GetUnitY(m),2))
exitwhen b or d1==0
set b=(d1<=speed*(t-dif))
exitwhen (mode and b) or (GetUnitCurrentOrder(m)!=OrderId("move"))
if tounit then
call IssuePointOrder(m,"move",x2,y2)
endif
set dif=t
if dif==0.001 then
set t=0.1
else
set t=(d-d1)/speed
endif
set t=2*t-dif
call SetUnitFlyHeight(m,z1+(vel*t-0.5*acel*t*t),RAbsBJ(vel-acel*(t+dif)/2))
set t=(t+dif)/2
call TriggerSleepAction(0)
endloop
if tounit then
set x2=GetUnitX(target)
set y2=GetUnitY(target)
endif
call SetUnitFlyHeight(m,z2,0)
call SetUnitPosition(m,x2,y2)
endfunction
function UnitMoveToAsProjectile takes unit m,real arc,real x2,real y2,real z2 returns nothing
call UnitMoveToAsProjectileGen(m,arc,x2,y2,null,z2)
endfunction
function ProjectileLaunchEx takes player owner,string modelpath,real scale,integer red,integer green,integer blue,integer alpha,real speed,real arc,real x1,real y1,real z1,real x2,real y2,real z2 returns nothing
local unit m=AddCasterFacing(Atan2BJ(y2-y1,x2-x1))
local effect fx=null
call SetUnitPosition(m,x1,y1)
call SetUnitScale(m,scale,scale,scale)
call SetUnitVertexColor(m,red,green,blue,alpha)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set fx=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,owner,true)
call UnitMoveToAsProjectile(m,arc,x2,y2,z2)
call DestroyEffect(fx)
call ExplodeUnitBJ(m)
set owner=null
set fx=null
set m=null
endfunction
function ProjectileLaunchExLoc takes player owner,string modelpath,real scale,integer red,integer green,integer blue,integer alpha,real speed,real arc,location loc1,real z1,location loc2,real z2 returns nothing
call ProjectileLaunchEx(owner,modelpath,scale,red,green,blue,alpha,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,GetLocationX(loc2),GetLocationY(loc2),z2)
endfunction
function ProjectileLaunch takes string modelpath,real speed,real arc,real x1,real y1,real z1,real x2,real y2,real z2 returns nothing
call ProjectileLaunchEx(Player(15),modelpath,1,255,255,255,255,speed,arc,x1,y1,z1,x2,y2,z2)
endfunction
function ProjectileLaunchLoc takes string modelpath,real speed,real arc,location loc1,real z1,location loc2,real z2 returns nothing
call ProjectileLaunchExLoc(Player(15),modelpath,1,255,255,255,255,speed,arc,loc1,z1,loc2,z2)
endfunction
function DamagingProjectileLaunchAOE_Child takes nothing returns nothing
local unit m=udg_currentcaster
local effect fx=bj_lastCreatedEffect
local real x2=udg_castervars[0]
local real y2=udg_castervars[1]
local real aoeradius=udg_castervars[3]
local real damage=udg_castervars[4]
local boolean affectallied=bj_isUnitGroupInRectResult
local integer DamageOptions=R2I(udg_castervars[5])
local real array opt
local unit hurter=udg_currenthurter
set opt[0]=udg_castervars[10]
set opt[1]=udg_castervars[11]
set opt[2]=udg_castervars[9]
set opt[3]=udg_castervars[8]
set opt[4]=udg_castervars[7]
call UnitMoveToAsProjectile(m,bj_meleeNearestMineDist,udg_castervars[0],udg_castervars[1],udg_castervars[2])
call DestroyEffect(fx)
set udg_castervars[100]=opt[0]
set udg_castervars[101]=opt[1]
set udg_castervars[102]=opt[2]
set udg_castervars[103]=opt[3]
set udg_castervars[104]=opt[4]
call DamageUnitsInAOEEx(hurter,damage,x2,y2,aoeradius,affectallied,DamageOptions)
call ExplodeUnitBJ(m)
set m=null
set fx=null
endfunction
function DamagingProjectileLaunchAOE takes unit hurter,string modelpath,real speed,real arc,real x1,real y1,real z1,real x2,real y2,real z2,real aoeradius,real damage,boolean affectallied,integer DamageOptions returns unit
local unit m=AddCasterFacing(Atan2BJ(y2-y1,x2-x1))
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set udg_currentcaster=m
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,GetOwningPlayer(hurter),true)
set bj_meleeNearestMineDist=arc
set udg_castervars[0]=x2
set udg_castervars[1]=y2
set udg_castervars[2]=z2
set udg_castervars[3]=aoeradius
set udg_castervars[4]=damage
set udg_castervars[5]=DamageOptions
if DamageOptions>=32 then
set DamageOptions=DamageOptions-32
endif
if DamageOptions>=16 then
set DamageOptions=DamageOptions-16
endif
if DamageOptions>=8 then
set DamageOptions=DamageOptions-8
endif
if DamageOptions>=4 then
set udg_castervars[7]=udg_castervars[104]
set DamageOptions=DamageOptions-4
else
set udg_castervars[7]=-1
endif
if DamageOptions>=2 then
set udg_castervars[8]=udg_castervars[102]
set udg_castervars[9]=udg_castervars[103]
set DamageOptions=DamageOptions-2
else
set udg_castervars[8]=-1
set udg_castervars[9]=-1
endif
if DamageOptions>=1 then
set udg_castervars[10]=udg_castervars[100]
set udg_castervars[11]=udg_castervars[101]
else
set udg_castervars[10]=-1
set udg_castervars[11]=-1
endif
set bj_isUnitGroupInRectResult=affectallied
set udg_currenthurter=hurter
call ExecuteFunc("DamagingProjectileLaunchAOE_Child")
set m=null
return udg_currentcaster
endfunction
function DamagingProjectileLaunchAOELoc takes unit hurter,string modelpath,real speed,real arc,location loc1,real z1,location loc2,real z2,real aoeradius,real damage,boolean affectallied,integer DamageOptions returns unit
return DamagingProjectileLaunchAOE(hurter,modelpath,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,GetLocationX(loc2),GetLocationY(loc2),z2,aoeradius,damage,affectallied,DamageOptions)
endfunction
function ProjectileLaunchDamage takes player owner,string modelpath,real speed,real arc,real x1,real y1,real z1,real x2,real y2,real z2,real aoeradius,real damage,boolean affectallied returns unit
local unit m=AddCasterFacing(Atan2BJ(y2-y1,x2-x1))
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set udg_currentcaster=m
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,owner,true)
set bj_meleeNearestMineDist=arc
set udg_castervars[0]=x2
set udg_castervars[1]=y2
set udg_castervars[2]=z2
set udg_castervars[3]=aoeradius
set udg_castervars[4]=damage
set udg_castervars[5]=0
set udg_castervars[6]=1
set udg_castervars[7]=-1
set udg_castervars[8]=-1
set udg_castervars[9]=-1
set udg_castervars[10]=-1
set udg_castervars[11]=-1
set bj_isUnitGroupInRectResult=affectallied
set udg_currenthurter=m
call ExecuteFunc("DamagingProjectileLaunchAOE_Child")
set m=null
return udg_currentcaster
endfunction
function ProjectileLaunchDamageLoc takes player owner,string modelpath,real speed,real arc,location loc1,real z1,location loc2,real z2,real aoeradius,real damage,boolean affectallied returns unit
return ProjectileLaunchDamage(owner,modelpath,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,GetLocationX(loc2),GetLocationY(loc2),z2,aoeradius,damage,affectallied)
endfunction
function ProjectileLaunchKill_Child takes nothing returns nothing
local unit m=udg_currentcaster
local effect fx=bj_lastCreatedEffect
local real x2=udg_castervars[0]
local real y2=udg_castervars[1]
call UnitMoveToAsProjectile(m,bj_meleeNearestMineDist,udg_castervars[0],udg_castervars[1],udg_castervars[2])
call ExplodeUnitBJ(m)
call DestroyEffect(fx)
set m=null
set fx=null
endfunction
function ProjectileLaunchKill takes player owner,string modelpath,real speed,real arc,real x1,real y1,real z1,real x2,real y2,real z2 returns unit
local unit m=AddCasterFacing(Atan2BJ(y2-y1,x2-x1))
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set udg_currentcaster=m
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,owner,true)
set bj_meleeNearestMineDist=arc
set udg_castervars[0]=x2
set udg_castervars[1]=y2
set udg_castervars[2]=z2
call ExecuteFunc("ProjectileLaunchKill_Child")
set m=null
return udg_currentcaster
endfunction
function ProjectileLaunchKillLoc takes player owner,string modelpath,real speed,real arc,location loc1,real z1,location loc2,real z2 returns unit
return ProjectileLaunchKill(owner,modelpath,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,GetLocationX(loc2),GetLocationY(loc2),z2)
endfunction
function UnitMoveToUnitAsProjectile takes unit m,real arc,unit target,real zoffset returns nothing
call UnitMoveToAsProjectileGen(m,arc,0,0,target,zoffset)
endfunction
function ProjectileLaunchToUnitEx takes player owner,string modelpath,real scale,integer red,integer green,integer blue,integer alpha,real speed,real arc,real x1,real y1,real z1,unit target,real zoffset returns nothing
local unit m=AddCasterFacing(Atan2BJ(GetUnitY(target)-y1,GetUnitX(target)-x1))
local effect fx=null
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
call SetUnitScale(m,scale,scale,scale)
call SetUnitVertexColor(m,red,green,blue,alpha)
set fx=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,owner,true)
call UnitMoveToUnitAsProjectile(m,arc,target,zoffset)
call DestroyEffect(fx)
call ExplodeUnitBJ(m)
set m=null
set fx=null
endfunction
function ProjectileLaunchToUnitExLoc takes player owner,string modelpath,real scale,integer red,integer green,integer blue,integer alpha,real speed,real arc,location loc1,real z1,unit target,real zoffset returns nothing
call ProjectileLaunchToUnitEx(owner,modelpath,scale,red,green,blue,alpha,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,target,zoffset)
endfunction
function ProjectileLaunchToUnit takes string modelpath,real speed,real arc,real x1,real y1,real z1,unit target,real zoffset returns nothing
call ProjectileLaunchToUnitEx(Player(15),modelpath,1,255,255,255,255,speed,arc,x1,y1,z1,target,zoffset)
endfunction
function ProjectileLaunchToUnitLoc takes string modelpath,real speed,real arc,location loc1,real z1,unit target,real zoffset returns nothing
call ProjectileLaunchToUnitExLoc(Player(15),modelpath,1,255,255,255,255,speed,arc,loc1,z1,target,zoffset)
endfunction
function DamagingProjectileLaunchTarget_Child takes nothing returns nothing
local unit m=udg_currentcaster
local unit target=bj_meleeNearestMine
local effect fx=bj_lastCreatedEffect
local real damage=udg_castervars[4]
local damagetype dmgT=ConvertDamageType(R2I(udg_castervars[6]))
local attacktype attT=ConvertAttackType(R2I(udg_castervars[5]))
local unit hurter=udg_currenthurter
call UnitMoveToUnitAsProjectile(m,bj_meleeNearestMineDist,target,udg_castervars[2])
call DestroyEffect(fx)
call DamageUnitByTypes(hurter,target,damage,attT,dmgT)
call ExplodeUnitBJ(m)
set m=null
set hurter=null
set target=null
set fx=null
set dmgT=null
set attT=null
endfunction
function DamagingProjectileLaunchTarget takes unit hurter,string modelpath,real speed,real arc,real x1,real y1,real z1,unit target,real zoffset,real damage,attacktype attT,damagetype dmgT returns unit
local unit m=AddCasterFacing(Atan2BJ(GetUnitY(target)-y1,GetUnitX(target)-x1))
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set udg_currentcaster=m
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,GetOwningPlayer(hurter),true)
set bj_meleeNearestMineDist=arc
set udg_castervars[2]=zoffset
set bj_meleeNearestMine=target
set udg_castervars[4]=damage
set udg_castervars[5]=CasterSytem_H2I(attT)
set udg_castervars[6]=CasterSytem_H2I(dmgT)
set udg_currenthurter=hurter
call ExecuteFunc("DamagingProjectileLaunchTarget_Child")
set m=null
return udg_currentcaster
endfunction
function DamagingProjectileLaunchTargetLoc takes unit hurter,string modelpath,real speed,real arc,location loc,real z1,unit target,real zoffset,real damage,attacktype attT,damagetype dmgT returns unit
return DamagingProjectileLaunchTarget(hurter,modelpath,speed,arc,GetLocationX(loc),GetLocationY(loc),z1,target,zoffset,damage,attT,dmgT)
endfunction
function ProjectileLaunchToUnitDamage takes player owner,string modelpath,real speed,real arc,real x1,real y1,real z1,unit target,real zoffset,real damage returns unit
local unit m=AddCasterFacing(Atan2BJ(GetUnitY(target)-y1,GetUnitX(target)-x1))
call SetUnitPosition(m,x1,y1)
call SetUnitMoveSpeed(m,speed)
call SetUnitFlyHeight(m,z1,0)
set udg_currentcaster=m
set bj_lastCreatedEffect=AddSpecialEffectTarget(modelpath,m,"origin")
call SetUnitOwner(m,owner,true)
set bj_meleeNearestMineDist=arc
set udg_castervars[2]=zoffset
set bj_meleeNearestMine=target
set udg_castervars[4]=damage
set udg_castervars[5]=CasterSytem_H2I(Caster_DefaultAttackType())
set udg_castervars[6]=CasterSytem_H2I(Caster_DefaultDamageType())
set udg_currenthurter=m
call ExecuteFunc("DamagingProjectileLaunchTarget_Child")
set m=null
return udg_currentcaster
endfunction
function ProjectileLaunchToUnitDamageLoc takes player owner,string modelpath,real speed,real arc,location loc1,real z1,unit target,real zoffset,real damage returns unit
return ProjectileLaunchToUnitDamage(owner,modelpath,speed,arc,GetLocationX(loc1),GetLocationY(loc1),z1,target,zoffset,damage)
endfunction
Name | Type | is_array | initial_value |
casters | group | No | |
castertrigger | trigger | No | |
castervars | real | Yes | |
currentabi | integer | No | |
currentcaster | unit | No | |
currenthurter | unit | No | |
delayhack | real | No | |
kills | integer | Yes | |
NUM_HEROES | integer | No | |
player | player | Yes | |
PointVar | location | No | |
PointVar2 | location | No | |
Random_HELPER | integer | Yes | |
RANDOM_HERO | unitcode | Yes | |
RANDOM_HERO_ARRAY | unitcode | Yes | |
RANDOM_RUNE | itemcode | Yes | |
RealVar | real | No | |
sourcehack | location | No | |
SpecialEFF | effect | No | |
UnitVar | unit | No |
Notes
¯¯¯¯¯
If Your wanted Spell's Trigger says it requires the caster system, download the file in
http://www.wc3campaigns.com/forumdisplay.php?f=534 that place has the Caster System and a
forum to help you implement it and stuff, it also always include the latest version, so better
keep an eye on it.
This update uses the new Caster system 10.0 functions , so make sure to have at least 10.0
Most of the times after having that stuff implemented you just need to copy the spell's
Trigger to your map, save to see there are no compile errors, if there are no errors, copy
the Ability itself and the other required abilities if any, then you have to modiffy a part
of the trigger that says the rawcodes of the abilities or buffs
Most of the spells' art can be changed in the object editor since I use some really
cool natives, but make sure the path of the models art ends with .mdl (add it in case there
is no extension)
To know the rawcode of an ability in your map, go to Object Editor then Select the
ability, then choose "Show values as Raw Data" in the "View" menu, a 4 letters code will
appear close to the name of the ability, that is its rawcode, replace that code in the
trigger:
Example : The trigger says: return 'A005' //// The ability's Rawcode
Change it to: return 'A04F' //// The ability's Rawcode
( In case the rawcode of the ability in your map is A04F )
May sound difficult but it is not, and it is a kind of unavoidable step because the
Rawcodes almost always change when copying an ability/unit type/buff/doodad type/upgrade from
a map to another.
PM Vexorian at wc3campaigns.com for further questions.
Disclaimer
¯¯¯¯¯¯¯¯¯¯
You can use/modiffy any of the spells here as long as you give Vexorian Credit, To use the
imported icons give credits to their authors as well (they are specified unless they come from
blizzard) . You can't however release modiffied versions of these spells in resource maps.
Other Stuff By Vexorian
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Recently submitted / updated :
Ice Nova : http://www.wc3sear.ch/index.php?p=Spells&ID=600
Temple Guardian : http://www.wc3sear.ch/index.php?p=Spells&ID=548
Tower Sell : http://www.wc3sear.ch/index.php?p=Spells&ID=531
Pocket Stash : http://www.wc3sear.ch/index.php?p=Spells&ID=569
* Classic:
Selection System : http://www.wc3sear.ch/index.php?p=Spells&ID=60
Spell Templates System : http://www.wc3sear.ch/index.php?p=Spells&ID=109
History
¯¯¯¯¯¯¯
Update 8: - Fixed stampede giving ethernal frozen effect.
Update 7: - Cold Slash, Freezing Bolt, Charged Bolt, shield of divinity and Exorcism
now use damage options.
- Shield of divinity and Targeteable stampede, no longer use RunSeparated, for
compatibility with the new caster system.
Update 6: 1.17 and caster system 9.4 copatibility ,
- spells have more options now, likely charge doesn't work on buildings.
- Fixed a bug with flaming shield, when the target unit died
- Fixed Ice wave's tooltips
- The banishment figurine now has a dispellable buff.
Update 5: - Charge now uses a speed bonus instead of a speed change by triggers, because it
was often giving huge bonuses to heroes after the effect of the charge.
- Removed the ranger
Update 4: Updated Caster System and Fixed some instructions problems
Update 3: Updated Caster System and Fixed a probably bug with Flaming Shield and
Freezing Arrow, also a leak in Freezing Arrow.
Update 2: Fixed a leak in charge, and charge no longer is useable as blink.
Update 1: Auto Shot now is autocast, and Implemented the Caster System 7.5 that has a better
projectile engine. Also fixed an issue with Shield Of Divinity's target effect not
appearing.
//***************************************************************************************************
//*
//* Unholy Shield
//*
//* Requires:
//* -An item, put its id in the UnholyShieldItem_ItemId function
//* -The Caster System
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right item rawcode)
//*
//***************************************************************************************************
//===================================================================================================
// Unholy Shield Spell Configuration:
//
constant function UnholyShieldItem_ItemId takes nothing returns integer
return 'I007' //// The item rawcode
endfunction
constant function UnholyShieldItem_Percent takes nothing returns real
return 10.0 //// The percent chance to work when damaged.
endfunction
constant function UnholyShieldItem_Area takes nothing returns real
return 250.00 //// The area of effect of the damage.
endfunction
constant function UnholyShieldItem_DmgFactor takes nothing returns real
return 2.00 //// The Factor of the returned damage.
endfunction
constant function UnholyShield_AttackType takes nothing returns attacktype
return ATTACK_TYPE_NORMAL
endfunction
constant function UnholyShield_DamageType takes nothing returns damagetype
return DAMAGE_TYPE_DEFENSIVE
endfunction
//===================================================================================================
function Trig_UnholyShield_Get_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == UnholyShieldItem_ItemId()
endfunction
function Trig_UnholyShield_Effect_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x
local unit picked
local group affected
if not( UnitHasItemOfTypeBJ(u, UnholyShieldItem_ItemId() ) ) then
call DestroyTrigger(GetTriggeringTrigger())
elseif GetRandomReal(0,100) <= UnholyShieldItem_Percent() then
set x=GetEventDamage()
call SetUnitLifeBJ( u, GetWidgetLife(u) + x)
set affected=CreateGroup()
call GroupEnumUnitsInRange( affected, GetUnitX(u), GetUnitY(u), UnholyShieldItem_Area(), null)
set x=x*UnholyShieldItem_DmgFactor()
loop
set picked=FirstOfGroup(affected)
exitwhen picked==null
if not IsUnitDeadBJ(picked) and IsUnitEnemy(picked, GetOwningPlayer(u) ) then
call UnitDamageTarget( u, picked, x,true,false, UnholyShield_AttackType(), UnholyShield_DamageType() ,WEAPON_TYPE_WHOKNOWS)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl", picked, "origin"))
endif
call GroupRemoveUnit(affected,picked)
endloop
call DestroyGroup(affected)
set affected=null
set picked=null
endif
set u=null
endfunction
function Trig_UnholyShield_Get_Actions takes nothing returns nothing
local trigger t
local integer a=0
local unit u=GetTriggerUnit()
loop
exitwhen a>5
if (UnitItemInSlot(u, a) != GetManipulatedItem()) and ( GetItemTypeId( UnitItemInSlot(u, a) ) == UnholyShieldItem_ItemId() ) then
set u=null
return
endif
set a=a+1
endloop
set t=CreateTrigger()
call TriggerAddAction(t, function Trig_UnholyShield_Effect_Actions)
call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
set t=null
set u=null
endfunction
//===================================================================================================
function InitTrig_Unholy_Shield takes nothing returns nothing
set gg_trg_Unholy_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Unholy_Shield, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Unholy_Shield, Condition( function Trig_UnholyShield_Get_Conditions ) )
call TriggerAddAction( gg_trg_Unholy_Shield, function Trig_UnholyShield_Get_Actions )
endfunction
//***************************************************************************************************
//*
//* Mana Shield Item
//*
//* Requires:
//* -An item, put its id in the ManaShieldItem_ItemId function
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right item rawcode)
//*
//***************************************************************************************************
//===================================================================================================
// Mana Shield Item Configuration:
//
constant function ManaShieldItem_ItemId takes nothing returns integer
return 'I000' //// The mana shield item's rawcode
endfunction
constant function ManaShieldItem_MinHP takes nothing returns real
return 100.00 //// Minimum HP to have during the effect of the mana shield item
endfunction
//===================================================================================================
function Trig_Mana_Shield_Get_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == ManaShieldItem_ItemId()
endfunction
function Trig_Mana_Shield_Effect_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x
if not( UnitHasItemOfTypeBJ(u, ManaShieldItem_ItemId() ) ) then
call DestroyTrigger(GetTriggeringTrigger())
elseif GetWidgetLife(u) < ManaShieldItem_MinHP() then
set x=RMinBJ( GetUnitState(u, UNIT_STATE_MANA) , ManaShieldItem_MinHP()-GetWidgetLife(u) )
if x >= 1 then
call SetUnitManaBJ( u, GetUnitState(u, UNIT_STATE_MANA)-x )
call SetUnitLifeBJ( u, GetWidgetLife(u) + x)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl", u , "chest" ) )
endif
endif
set u=null
endfunction
function Trig_Mana_Shield_Get_Actions takes nothing returns nothing
local trigger t
local integer a=0
local unit u=GetTriggerUnit()
loop
exitwhen a>5
if (UnitItemInSlot(u, a) != GetManipulatedItem()) and ( GetItemTypeId( UnitItemInSlot(u, a) ) == ManaShieldItem_ItemId() ) then
set u=null
return
endif
set a=a+1
endloop
set t=CreateTrigger()
call TriggerAddAction(t, function Trig_Mana_Shield_Effect_Actions)
call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
set t=null
set u=null
endfunction
//===================================================================================================
function InitTrig_Mana_Shield_Gemstone takes nothing returns nothing
set gg_trg_Mana_Shield_Gemstone = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Shield_Gemstone, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Mana_Shield_Gemstone, Condition( function Trig_Mana_Shield_Get_Conditions ) )
call TriggerAddAction( gg_trg_Mana_Shield_Gemstone, function Trig_Mana_Shield_Get_Actions )
endfunction
//***************************************************************************************************
//*
//* Thunder Shield
//*
//* Requires:
//* -The Thunder Shield Ability
//* -The Caster System
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: The Spell is currently used by an item, but you can convert it into a hero ability
//* and add levels / tooltips without problems.
//*
//* Art:
//* The Ability's Target art determines the effect used.
//*
//***************************************************************************************************
//===================================================================================================
// Thunder Shield Spell Configuration:
//
constant function ThunderShield_AbilityId takes nothing returns integer
return 'A01L' //* ThurderShield Ability Rawcode
endfunction
constant function ThunderShield_Damage takes integer level returns real
return 5.0+ 5.0*level //* ThunderShield's Damage Formula
endfunction
function ThunderShield_DamageOptions takes nothing returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_LIGHTNING)+DamageOnlyTo(UNIT_TYPE_GROUND)
// See the caster system readme for more info
endfunction
//===================================================================================================
function Trig_ThunderShield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ThunderShield_AbilityId()
endfunction
function Trig_ThunderShield_Actions takes nothing returns nothing
local unit juer=GetTriggerUnit()
local real grad=0
local real x
local real y
local unit u1
local unit u2
local real ouch=ThunderShield_Damage( GetUnitAbilityLevel(juer,ThunderShield_AbilityId()) )
loop
exitwhen (grad>=3600) or (IsUnitDeadBJ(GetTriggerUnit()))
set x=GetUnitX(juer)+75.00*CosBJ(GetUnitFacing(juer) + grad)
set y=GetUnitY(juer)+75.00*SinBJ(GetUnitFacing(juer) + grad)
call DestroyEffect( AddSpellEffectById( GetSpellAbilityId() , EFFECT_TYPE_TARGET,x,y))
call DamageUnitsInAOEEx( juer, ouch, x, y, 50, false,ThunderShield_DamageOptions())
set x=GetUnitX(juer)+75.00*CosBJ(GetUnitFacing(juer) - grad)
set y=GetUnitY(juer)+75.00*SinBJ(GetUnitFacing(juer) - grad)
call DestroyEffect( AddSpellEffectById( GetSpellAbilityId() , EFFECT_TYPE_TARGET,x,y))
call DamageUnitsInAOEEx( juer, ouch, x, y, 150, false,ThunderShield_DamageOptions())
set grad = grad + 30
call TriggerSleepAction( 0 )
endloop
endfunction
//===================================================================================================
function InitTrig_ThunderShield takes nothing returns nothing
set gg_trg_ThunderShield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ThunderShield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ThunderShield, Condition( function Trig_ThunderShield_Conditions ) )
call TriggerAddAction( gg_trg_ThunderShield, function Trig_ThunderShield_Actions )
endfunction
//***************************************************************************************************
//*
//* Banishment Item
//*
//* Requires:
//* -The Banishment (Triggerer) Ability
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: The Spell is currently used by an item, but you can convert it into a hero ability
//* and add levels / tooltips without problems.
//*
//* Art:
//* - The Ability's Special art determines the missile effect
//* - The Ability's effect is attached during the banishment
//*
//***************************************************************************************************
//===================================================================================================
function Banishment_duration takes integer level returns integer
return 30+10*level /// The time the unit will take to dissappear
endfunction
function Trig_Banishment_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A013' //// Replace A03D with the ability rawcode of the triggerer
endfunction
function Banishment_Buff takes nothing returns integer
return 'B002'
endfunction
//===================================================================================================
function Trig_Banishment_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit a=GetSpellTargetUnit()
local integer s=GetSpellAbilityId()
local integer l=GetUnitAbilityLevel( u, s)
local timer t=CreateTimer()
call TimerStart( t, Banishment_duration(l) , false, null)
loop
exitwhen UnitHasBuffBJ(a,Banishment_Buff())
call TriggerSleepAction(0)
endloop
loop
call SetUnitVertexColor( a, 255,255,255, R2I( 255*TimerGetRemaining(t)/Banishment_duration(l) ))
exitwhen TimerGetRemaining(t) <= 0 or not(UnitHasBuffBJ(a,Banishment_Buff()))
call TriggerSleepAction(0)
endloop
call DestroyTimer(t)
if UnitHasBuffBJ(a,Banishment_Buff()) then
call ShowUnit(a,false)
call UnitDamageTarget( u,a, GetWidgetLife(a)+10,true,false, ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
else
call SetUnitVertexColor( a, 255,255,255, 255)
endif
set t=null
set a=null
set u=null
endfunction
//===================================================================================================
function InitTrig_Banishment takes nothing returns nothing
set gg_trg_Banishment = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Banishment, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Banishment, Condition( function Trig_Banishment_Conditions ) )
call TriggerAddAction( gg_trg_Banishment, function Trig_Banishment_Actions )
endfunction
//***************************************************************************************************
//*
//* Flames Barrel
//*
//* Requires:
//* -The Explosive (barrel) Ability
//* -The Flames (explosive) Ability
//* -The Caster System
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: The Spell is currently used by an item, but you can convert it into a hero ability
//* and add levels / tooltips without problems.
//*
//* Art:
//* - The Ability's Special art determines the main effect
//* - The Ability's Target art is an effect that keeps appearing at the overhead of the effect
//*
//***************************************************************************************************
//===================================================================================================
// Flames Barrel Spell Configuration:
//
constant function FlamesBarrel_SpellId takes nothing returns integer
return 'A046' //// The Explosive (barrel) ability rawcode
endfunction
constant function FlamesBarrel_Time takes integer level returns integer
return 3 //// The time before explosion
endfunction
constant function FlamesBarrel_FlamesSpellId takes integer level returns integer
return 'A047'
endfunction
//===================================================================================================
function Trig_Nafta_Explosives_Conditions takes nothing returns boolean
return GetSpellAbilityId() == FlamesBarrel_SpellId()
endfunction
function Trig_Nafta_Explosives_Actions takes nothing returns nothing
local location loc=GetSpellTargetLoc()
local integer l=GetUnitAbilityLevel( GetTriggerUnit(), FlamesBarrel_SpellId() )
local integer a=FlamesBarrel_Time(l)
local integer abil=FlamesBarrel_FlamesSpellId(l)
local unit barrel= AddDamagingEffectLoc( GetOwningPlayer(GetTriggerUnit()) , SpellEffectModelPath( GetSpellAbilityId(), EFFECT_TYPE_SPECIAL), loc, 0 , a, 0, false)
local texttag Float = CreateTextTagUnitBJ( "", barrel, 50, 15.00, 100, 0.00, 0.00, 0.00 )
call SetUnitScale( barrel, 0.75, 0.75, 0.75)
loop
exitwhen a==0
call SetTextTagText(Float,I2S(a),TextTagSize2Height(15))
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET, barrel, "overhead"))
call PolledWait( 1.00 )
set a=a-1
endloop
call DestroyTextTag(Float)
set udg_delayhack = 45
call CasterCastAbilityPointLoc( GetOwningPlayer(GetTriggerUnit()) , abil, "flamestrike", loc , false)
call RemoveLocation(loc)
set udg_delayhack = 0
set Float=null
set barrel=null
set loc=null
endfunction
//===================================================================================================
function InitTrig_Flames_Barrel takes nothing returns nothing
set gg_trg_Flames_Barrel = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flames_Barrel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Flames_Barrel, Condition( function Trig_Nafta_Explosives_Conditions ) )
call TriggerAddAction( gg_trg_Flames_Barrel, function Trig_Nafta_Explosives_Actions )
endfunction
//***************************************************************************************************
//*
//* Stone of Lightning
//*
//* Requires:
//* -The Lightning Rain Ability
//* -The Caster System
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: The Spell is currently used by an item, but you can convert it into a hero ability
//* and add levels / tooltips without problems.
//*
//* Art:
//* - The Ability's special art determines the main missile effect
//* - The Ability's target art determines the secondary missile effect
//*
//***************************************************************************************************
//===================================================================================================
// Stone of Lightning Spell Configuration
//
constant function StoneOfLightning_SpellId takes nothing returns integer
return 'A00T' //// Lightning Rain Ability Rawcode
endfunction
constant function StoneOfLightning_BoltNumber takes integer level returns integer
return 9+level*1 //// The total number of Lightning Bolts to fall.
endfunction
constant function StoneOfLightning_Damage takes integer level returns integer
return 25+level*25 //// The damage per bolt explosion
endfunction
constant function StoneOfLightning_TotalArea takes integer level returns integer
return 200+level*50 //// The Spell Area of effect
endfunction
constant function StoneOfLightning_BoltArea takes integer level returns integer
return 75+level*25 //// The area of effect for each bolt explosion.
endfunction
function StoneOfLightning_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_LIGHTNING)
// See the caster system readme for more info
endfunction
//===================================================================================================
function Trig_Stone_of_Ligthning_Conditions takes nothing returns boolean
return GetSpellAbilityId() == StoneOfLightning_SpellId()
endfunction
function Trig_Stone_of_Ligthning_Actions takes nothing returns nothing
local location loc=GetSpellTargetLoc()
local unit u=GetTriggerUnit()
local integer s=GetSpellAbilityId()
local integer l=GetUnitAbilityLevel(u,s)
local location pos=GetUnitLoc(u)
local integer n=StoneOfLightning_BoltNumber(l)
local real x
local real grad
call SetUnitAnimation( u, "attack" )
call ProjectileLaunchExLoc( GetOwningPlayer(u) , SpellEffectModelPath( GetSpellAbilityId() , EFFECT_TYPE_SPECIAL), 1.4, 255, 255, 255, 255, 522, 0.15, pos, 0, loc, 200 )
loop
exitwhen n==0
set grad = GetRandomReal(0, 360.00)
set x=n*(StoneOfLightning_TotalArea(l)/StoneOfLightning_BoltNumber(l))
call MoveLocation( pos, GetLocationX(loc)+CosBJ(grad)*x , GetLocationY(loc)+SinBJ(grad)*x )
call DamagingProjectileLaunchAOELoc( u, GetAbilityEffectById(s,EFFECT_TYPE_TARGET,0), 0, 0.35, loc, 200, pos, 10, StoneOfLightning_BoltArea(l), StoneOfLightning_Damage(l) ,true,StoneOfLightning_DamageOptions(l))
set n=n-1
endloop
call RemoveLocation(loc)
call RemoveLocation(pos)
set u=null
set loc=null
set pos=null
endfunction
//===================================================================================================
function InitTrig_Stone_of_Ligthning takes nothing returns nothing
set gg_trg_Stone_of_Ligthning = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Stone_of_Ligthning, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Stone_of_Ligthning, Condition( function Trig_Stone_of_Ligthning_Conditions ) )
call TriggerAddAction( gg_trg_Stone_of_Ligthning, function Trig_Stone_of_Ligthning_Actions )
endfunction
//***************************************************************************************************
//*
//* Elemental Fury
//*
//* Requires:
//* - The Elemental Fury Ability
//* - The Caster System (http://www.wc3campaigns.com/forumdisplay.php?f=534)
//* - This Trigger (make sure the Configuration Section is pointing to
//* the right ability)
//*
//* Art Notes:
//* - To change the area of effect model , make a new effect in the buff editor.
//* - The Area Effect Art Determines the model used for the damaging effects.
//* - The Special Art is attached to units affected by the fire, second value is
//* the attachment point.
//* - The Effect Art Determines one of the models used against the target units
//* - The Target Art Determines the other one of the models used against the target units
//*
//***************************************************************************************************
//===================================================================================================
// Elemental Fury Spell Configuration:
//
constant function ElementalFury_SpellId takes nothing returns integer
return 'S000' //// Elemental Fury Ability Id, replace S000 with its rawcode in your map
endfunction
constant function ElementalFury_Damage takes integer level returns real
return 10.00 * level
endfunction
function ElementalFury_LightningDamageOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_LIGHTNING)
// Will Do chaos lightning damage.
endfunction
constant function ElementalFury_FlamesDamage takes integer level returns real
return 20.00 + 10.00 * level
endfunction
constant function ElementalFury_FlamesDuration takes integer level returns real
return 10.00 + 5.00 * level
endfunction
function ElementalFury_Flames_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_FIRE)+DamageTrees()+DontDamageSelf()+DamageOnlyTo(UNIT_TYPE_GROUND)
// See the caster system readme for more info
endfunction
constant function ElementalFury_Area takes integer level returns real
return 200.0+50.0*level
endfunction
//===================================================================================================
function Trig_Elemental_Fury_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ElementalFury_SpellId()
endfunction
function Trig_Elemental_Fury_IsLivingEnemy takes nothing returns boolean
return IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
endfunction
function Trig_Elemental_Fury_Actions takes nothing returns nothing
local location center=GetSpellTargetLoc()
local unit panda=GetTriggerUnit()
local trigger end=CreateTrigger()
local group UnitsInRange
local unit PickedUnit
local integer s=GetSpellAbilityId()
local integer l=GetUnitAbilityLevel( panda,s)
local real ouch=ElementalFury_Damage( l)
local real angle
local real dist
local real area=ElementalFury_Area( l)
local integer a=0
local effect ef
local real fct
call TriggerRegisterUnitEvent( end, panda, EVENT_UNIT_SPELL_ENDCAST )
call TriggerRegisterUnitEvent( end, panda, EVENT_UNIT_DEATH )
loop
exitwhen GetTriggerEvalCount(end) > 0
call PolledWait(1.00)
set angle= GetRandomReal(0.001,360)
set dist= GetRandomReal(0, area)
call AddAreaDamagerForUnit( panda, GetAbilityEffectById( s,EFFECT_TYPE_AREA_EFFECT,0),GetAbilityEffectById( s,EFFECT_TYPE_SPECIAL,0),GetAbilityEffectById( s,EFFECT_TYPE_SPECIAL,1), GetLocationX(center) + dist*CosBJ(angle) , GetLocationY(center) + dist*SinBJ(angle) , ElementalFury_FlamesDamage(l) , 1, ElementalFury_FlamesDuration(l), 100, true, ElementalFury_Flames_DamageOptions(l))
set UnitsInRange=GetUnitsInRangeOfLocMatching(area, center, Condition(function Trig_Elemental_Fury_IsLivingEnemy))
loop
set PickedUnit=FirstOfGroup(UnitsInRange)
exitwhen PickedUnit==null or GetTriggerEvalCount(end) > 0
set ef= AddSpellEffectById(s,EFFECT_TYPE_EFFECT, GetUnitX(PickedUnit),GetUnitY(PickedUnit))
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(),EFFECT_TYPE_TARGET, PickedUnit, "origin" ) )
set fct=GetDamageFactorByOptions(panda,PickedUnit,ElementalFury_LightningDamageOptions(l))
if fct!=0 then
call UnitDamageTarget( panda,PickedUnit, ouch*fct, true,false, null,null,null)
endif
call GroupRemoveUnit( UnitsInRange, PickedUnit)
call TriggerSleepAction( 0 )
call DestroyEffect(ef)
endloop
call DestroyGroup(UnitsInRange)
set a=a+1
endloop
call DestroyTrigger(end)
call RemoveLocation(center)
set center=null
set UnitsInRange=null
set end=null
set panda=null
set ef=null
endfunction
//===========================================================================
function InitTrig_Elemental_Fury takes nothing returns nothing
set gg_trg_Elemental_Fury = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Elemental_Fury, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Elemental_Fury, Condition( function Trig_Elemental_Fury_Conditions ) )
call TriggerAddAction( gg_trg_Elemental_Fury, function Trig_Elemental_Fury_Actions )
endfunction
//************************************************************************************************
//*
//* Fire Ball
//*
//* Requires:
//* -The FireBalll Ability
//* - The Caster System (http://www.wc3campaigns.com/forumdisplay.php?f=534)
//* -The Fireball Flames Abilities (as many levels as FireBall)
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/units)
//* Art:
//* - The ability's Special Art determines the missile effect.
//* - The ability's Target Art determines the Impact effect.
//*
//************************************************************************************************
//================================================================================================
// Fire Ball Spell Configuration:
//
constant function FireBall_AbilityId takes nothing returns integer
return 'A00G' //* Fireball's Ability RawCode (It changes betwen maps)
endfunction
constant function FireBall_FlameStrikeAbility takes nothing returns integer
return 'A00H' //// Fireball's FlamesTrike Based ability RawCode (It changes betwen maps)
endfunction
constant function FireBall_FlamesDuration takes integer level returns real
return 5.00+ 10.00*level //// The duration of the flames, should match the duration of
//// the flames ability, otherwise the player may lose bounty/xp
endfunction
//================================================================================================
function Trig_Fire_Ball_Conditions takes nothing returns boolean
return GetSpellAbilityId() == FireBall_AbilityId()
endfunction
function Trig_Fire_Ball_Actions takes nothing returns nothing
local location target= GetSpellTargetLoc()
local location loc=GetUnitLoc( GetTriggerUnit() )
local integer l=GetUnitAbilityLevel( GetTriggerUnit(), FireBall_AbilityId() )
call ProjectileLaunchLoc( SpellEffectModelPath( GetSpellAbilityId(), EFFECT_TYPE_SPECIAL), 522, 0.1, loc, 20, target, 20)
set udg_delayhack=FireBall_FlamesDuration(l)
call DestroyEffect( AddSpellEffectByIdLoc( GetSpellAbilityId(), EFFECT_TYPE_TARGET, target))
call CasterCastAbilityLevelPointLoc( GetOwningPlayer(GetTriggerUnit()) , FireBall_FlameStrikeAbility(),l ,"flamestrike", target, false)
set udg_delayhack=0
call RemoveLocation( loc)
call RemoveLocation( target)
set loc=null
set target=null
endfunction
//================================================================================================
function InitTrig_Fire_Ball takes nothing returns nothing
local integer a=1
call PreloadAbility( FireBall_FlameStrikeAbility() )
set gg_trg_Fire_Ball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Ball, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Fire_Ball, Condition( function Trig_Fire_Ball_Conditions ) )
call TriggerAddAction( gg_trg_Fire_Ball, function Trig_Fire_Ball_Actions )
endfunction
//***************************************************************************************************
//*
//* Thunder Storm
//*
//* Requires:
//* -The Thunder Storm Ability
//* -The ReplaceableTextures\ActiveButtons\BTNMonsoon.blp Imported Icon
//* -The Thunder Storm Buff
//* -The Thunder Storm (caster buff)
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/buffs)
//*
//* Art:
//* - Just change the models of the buffs to change the art used by this spell
//*
//***************************************************************************************************
//===================================================================================================
// Thunder Storm Spell Configuration:
//
constant function ThunderStormAbility takes nothing returns integer
return 'A00M' //* Replace A004 with the ability's Rawcode (It's different betwen maps):
endfunction
constant function ThunderStormDuration takes integer level returns integer
return 0+10*level //* The Duration per level formula
endfunction
//===================================================================================================
function Trig_Thunder_Storm_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ThunderStormAbility()
endfunction
//===================================================================================================
function Trig_Thunder_Storm_blorder takes nothing returns nothing
if IsUnitDeadBJ(GetTriggerUnit()) then
call DestroyTrigger(GetTriggeringTrigger())
return
endif
if GetIssuedOrderIdBJ() == String2OrderIdBJ("unimmolation") then
call DisableTrigger(GetTriggeringTrigger())
call PauseUnit( GetTriggerUnit(), true)
call IssueImmediateOrder( GetTriggerUnit(), "stop" )
call PauseUnit( GetTriggerUnit(), false)
call EnableTrigger(GetTriggeringTrigger())
endif
endfunction
function Trig_Thunder_Storm_Actions takes nothing returns nothing
local unit caster=GetTriggerUnit()
local trigger no=CreateTrigger()
call TriggerAddAction( no, function Trig_Thunder_Storm_blorder)
call TriggerRegisterUnitEvent( no, caster, EVENT_UNIT_ISSUED_ORDER )
call PolledWait( ThunderStormDuration(GetUnitAbilityLevel(caster, ThunderStormAbility())) )
call DestroyTrigger(no)
if not(IsUnitDeadBJ(caster)) then
call IssueImmediateOrder( caster, "unimmolation" )
endif
set no=null
set caster=null
endfunction
//===========================================================================
function InitTrig_Thunder_Storm takes nothing returns nothing
set gg_trg_Thunder_Storm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Thunder_Storm, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Thunder_Storm, Condition( function Trig_Thunder_Storm_Conditions ) )
call TriggerAddAction( gg_trg_Thunder_Storm, function Trig_Thunder_Storm_Actions )
endfunction
//***************************************************************************************************
//* *
//* Targeteable Stampede *
//* *
//* Requires: *
//* - Stampede (unit targeteable) Ability *
//* - The Caster System (http://www.wc3campaigns.com/forumdisplay.php?f=534) *
//* - This Trigger (make sure the Configuration Section is pointing *
//* to the right ability rawcodes) *
//* *
//* Note: To change the lizard model modiffy the missile art in the object editor. *
//* To change the lizard explosion model modify the Area Effect art in the object editor. *
//* *
//***************************************************************************************************
//===================================================================================================
// Targeteable Stampede Spell Configuration:
//
constant function OtherStampede_SpellId takes nothing returns integer
return 'A00S' //// The Ability's Rawcode (Changes between maps)
endfunction
constant function OtherStampede_TotalArea takes real level returns real
return 900+100*level //// The Total Area of effect (the initial distance between the target and the beasts)
endfunction
constant function OtherStampede_Number takes integer level returns integer
return 7+3*level //// The Total number of lizards
endfunction
constant function OtherStampede_BeastCollision takes real level returns real
return 200.0 //// The Collision radius of the lizards (the distance to make them explode)
endfunction
constant function OtherStampede_DamageArea takes real level returns real
return 250+level*25 //// The explosion area for each lizard
endfunction
constant function OtherStampede_TargetDamage takes real level returns real
return 50+level*10 //// The Damage done if the target was reached
endfunction
constant function OtherStampede_NormalDamage takes real level returns real
return 15+level*5 //// The Damage done when the lizards couldn't get to the target
endfunction
function OtherStampede_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL)
// See the caster system readme for more info
endfunction
//===================================================================================================
function Trig_OtherStampede_Conditions takes nothing returns boolean
return GetSpellAbilityId() == OtherStampede_SpellId()
endfunction
function Trig_OtherStampede_LizardAI takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer l=GetUnitAbilityLevel( u, OtherStampede_SpellId() )
local unit target=GetSpellTargetUnit()
local unit lizard=bj_lastCreatedUnit
local effect fx=bj_lastCreatedEffect
local group g=CreateGroup()
local boolexpr bol=Condition( function CasterAOE_IsFilterEnemy)
local integer alpha=127
loop
set bj_groupEnumOwningPlayer=GetOwningPlayer(u)
call GroupEnumUnitsInRangeCounted( g, GetUnitX(lizard), GetUnitY(lizard), OtherStampede_BeastCollision(l) , bol,1)
exitwhen FirstOfGroup(g) != null or SquareRoot( Pow(GetUnitX(lizard)-GetUnitX(target),2)+Pow(GetUnitY(lizard)-GetUnitY(target),2) ) <= OtherStampede_BeastCollision(l)
call IssuePointOrder( lizard, "move", GetUnitX(target), GetUnitY(target) )
call SetUnitVertexColor( lizard, 255,255,255,alpha)
call TriggerSleepAction(0)
set alpha=alpha+15
endloop
if SquareRoot( Pow(GetUnitX(lizard)-GetUnitX(target),2)+Pow(GetUnitY(lizard)-GetUnitY(target),2) ) <= OtherStampede_BeastCollision(l) then
call DamageUnitsInAOEEx( u, OtherStampede_NormalDamage(l), GetUnitX(lizard), GetUnitY(lizard), OtherStampede_DamageArea(l), false,OtherStampede_DamageOptions(l))
else
call DamageUnitsInAOEEx( u, OtherStampede_NormalDamage(l), GetUnitX(lizard), GetUnitY(lizard), OtherStampede_DamageArea(l), false,OtherStampede_DamageOptions(l))
endif
call DestroyEffect(fx)
call DestroyEffect( AddSpellEffectById( OtherStampede_SpellId(), EFFECT_TYPE_AREA_EFFECT, GetUnitX(lizard), GetUnitY(lizard)))
call RemoveUnit(lizard)
call DestroyBoolExpr(bol)
set fx=null
call DestroyGroup(g)
set g=null
set u=null
set bol=null
set target=null
set lizard=null
endfunction
function Trig_OtherStampede_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer l=GetUnitAbilityLevel( u, OtherStampede_SpellId() )
local unit target=GetSpellTargetUnit()
local unit lizard
local integer n=OtherStampede_Number(l)
local integer a=1
local real area=OtherStampede_TotalArea(l)
local real grad=500
loop
exitwhen a>n
set grad=360*(a-1)/n
set lizard=AddCasterFacing( grad-180 )
call SetUnitPosition( lizard, GetUnitX(target)+area*CosBJ(grad), GetUnitY(target)+area*SinBJ(grad) )
set bj_lastCreatedEffect= AddSpellEffectTargetById( OtherStampede_SpellId(), EFFECT_TYPE_MISSILE, lizard, "origin" )
set bj_lastCreatedUnit=lizard
call ExecuteFunc("Trig_OtherStampede_LizardAI")
set a=a+1
endloop
set u=null
set target=null
set lizard=null
endfunction
//===========================================================================
function InitTrig_OtherStampede takes nothing returns nothing
set gg_trg_OtherStampede = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_OtherStampede, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_OtherStampede, Condition( function Trig_OtherStampede_Conditions ) )
call TriggerAddAction( gg_trg_OtherStampede, function Trig_OtherStampede_Actions )
endfunction
//***************************************************************************
//*
//* Earth Crush
//*
//* Requires:
//* -The Earth Crush Ability
//* -The Caster System
//* -The Earth Crush Warstomp abilitiy
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/buffs)
//*
//* Art:
//* - The Ability's Caster Art determines the missile effect
//* - And the impact effect is determinied by the warstomp ability.
//*
//***************************************************************************
//===========================================================================
// Earth Crush Spell Configuration:
//
constant function Earth_Crush_SpellId takes nothing returns integer
return 'A014' //Earth Crush 's Ability Rawcode
endfunction
constant function Earth_Crush_Warstomp takes nothing returns integer
return 'A015' //// Earth Crush Warstomp Ability Rawcode
endfunction
//===========================================================================
function Trig_Earth_Crush_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Earth_Crush_SpellId()
endfunction
function Trig_Earth_Crush_Actions takes nothing returns nothing
local unit caster=GetTriggerUnit()
local location target=GetSpellTargetLoc()
local integer l=GetUnitAbilityLevel(caster,GetSpellAbilityId())
local location loc=GetUnitLoc(caster)
local boolean sel
set sel=IsUnitSelected( caster, GetOwningPlayer(caster) )
call ShowUnit(caster, false)
call ProjectileLaunchExLoc( GetOwningPlayer(caster), SpellEffectModelPath( GetSpellAbilityId(), EFFECT_TYPE_CASTER ) , 1.75, 255,255,255,255, 522, 0.25, loc, 50, target, 0 )
call CasterCastAbilityLevelPointLoc( GetOwningPlayer(caster), Earth_Crush_Warstomp(),l,"stomp", target, true )
call ShowUnit(caster, true)
call SetUnitAnimation(caster, "birth")
if sel then
call SelectUnitAddForPlayer( caster, GetOwningPlayer(caster) )
endif
call RemoveLocation(loc)
call RemoveLocation(target)
set loc=null
set target=null
endfunction
//===========================================================================
function InitTrig_Earth_Crush takes nothing returns nothing
call PreloadAbility( Earth_Crush_Warstomp() )
set gg_trg_Earth_Crush = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Earth_Crush, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Earth_Crush, Condition( function Trig_Earth_Crush_Conditions ) )
call TriggerAddAction( gg_trg_Earth_Crush, function Trig_Earth_Crush_Actions )
endfunction
//***************************************************************************************************
//*
//* Incineration Nova
//*
//* Requires:
//* - The Caster System *
//* - The Incineration Nova Ability
//* - The Incineration Nova Buff
//* - The Incineration Nova Damage ability (as much levels as Incineration Nova)
//* (Please make sure they use the Incineration Nova buff)
//* - This Trigger (Make sure the Configuration section has your map's rawcodes)
//*
//* Note: To Change the art, use the Incineration Nova Ability's Special and target fields, also the
//* Target field for the buff, the scale of the missile can be changed in the config. section
//*
//***************************************************************************************************
//===================================================================================================
// Incineration Nova Spell Configuration:
//
constant function IncinerationNova_SpellId takes nothing returns integer
return 'A00B' //// The spell id for the Incineration nova ability (its rawcode after copying to your map)
////(Custom Abilities\orc\heroes\)
endfunction
constant function IncinerationNova_DamageSpellId takes nothing returns integer
////(Custom Abilities\human\units\)
return 'A00C' /// Rawcode for the Incineration nova damager spell
return 0
endfunction
constant function IncinerationNova_Number takes integer level returns integer
return 15+level*0 //// The number of Incineration nova missiles
endfunction
constant function IncinerationNova_Duration takes integer level returns integer
return 2+level*0 //// The duration of each Incineration nova missile
endfunction
constant function IncinerationNova_Scale takes integer level returns real
return 2.0+level*0 //// The model scale of Incineration nova missiles
endfunction
//===================================================================================================
function Trig_Incineration_Nova_Conditions takes nothing returns boolean
return GetSpellAbilityId() == IncinerationNova_SpellId()
endfunction
function Trig_Incineration_Nova_AI takes nothing returns nothing
local unit m=bj_lastCreatedUnit
local real dir=udg_castervars[8]
local integer l=R2I( udg_castervars[9] )
call SetUnitScale( m, IncinerationNova_Scale(l),IncinerationNova_Scale(l),IncinerationNova_Scale(l))
call SetUnitFlyHeight( m, 100,0)
call SetUnitMoveSpeed( m, 300)
loop
exitwhen GetUnitAbilityLevel(m,IncinerationNova_DamageSpellId() ) == 0
call IssuePointOrder(m, "move", GetUnitX(m)+200*CosBJ(dir), GetUnitY(m)+200*SinBJ(dir) )
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET, m, "origin") )
set dir=dir+12
call TriggerSleepAction(0)
endloop
endfunction
function Trig_Incineration_Nova_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer l=GetUnitAbilityLevel( u,GetSpellAbilityId())
local trigger ai=CreateTrigger()
call TriggerAddAction( ai, function Trig_Incineration_Nova_AI)
set udg_castervars[8]=0
set udg_castervars[9]=l
loop
exitwhen udg_castervars[8]==360
set bj_lastCreatedUnit=CasterUseAbilityLevelStatic( GetOwningPlayer(u), GetAbilityEffectById(GetSpellAbilityId(),EFFECT_TYPE_SPECIAL,0) , IncinerationNova_DamageSpellId(),l, IncinerationNova_Duration(l), GetUnitX(u), GetUnitY(u) )
call TriggerExecute( ai)
set udg_castervars[8]=udg_castervars[8]+360/IncinerationNova_Number(l)
endloop
call DestroyTrigger(ai)
set ai=null
endfunction
//===========================================================================0=0=0=0=0=0=0=0=0=0=0=0=
function InitTrig_Incineration_Nova takes nothing returns nothing
call PreloadAbility(IncinerationNova_DamageSpellId())
set gg_trg_Incineration_Nova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Incineration_Nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Incineration_Nova, function Trig_Incineration_Nova_Actions )
call TriggerAddCondition( gg_trg_Incineration_Nova, Condition(function Trig_Incineration_Nova_Conditions ) )
endfunction
//***************************************************************************************************
//*
//* Flaming Shield
//*
//* Requires:
//* - The Flaming Shield Ability
//* - The Flaming Shield Damage Ability (must have as many levels as Flaming Shield)
//* - The Flame Shield Buff
//* (make sure the Flaming Shield Damage Abilities use it)
//* - The Caster System.
//* - This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: To change the fire balls' model, change the art in the buff.
//*
//***************************************************************************************************
//===================================================================================================
// Flaming Shield Spell Configuration:
//
constant function Flaming_Shield_SpellId takes nothing returns integer
return 'A00V'
endfunction
constant function Flaming_Shield_FireBall takes nothing returns integer
return 'n000'
endfunction
constant function Flaming_Shield_DamageSpellId takes nothing returns integer
return 'A00W' // Flame Shield Damage Ability Rawcode
endfunction
constant function Flaming_Shield_Duration takes integer level returns real
return 45.00+level*7.00
endfunction
constant function Flaming_Shield_FireBallNumber takes integer level returns integer
return 3 //* The number of fire balls, should be a divisor of 360, high numbers lag the game out
endfunction
//===================================================================================================
function Trig_Flaming_Shield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Flaming_Shield_SpellId()
endfunction
function Trig_Flaming_Shield_Actions takes nothing returns nothing
local unit objective=GetSpellTargetUnit()
local unit caster=GetTriggerUnit()
local unit array elec
local timer t
local real grad=0
local integer a=0
local integer l=GetUnitAbilityLevel(caster, Flaming_Shield_SpellId())
local integer n=Flaming_Shield_FireBallNumber(l)
local integer abi=Flaming_Shield_DamageSpellId()
call PolledWait( SquareRoot(Pow( GetUnitX(caster) - GetUnitX(objective) , 2) + Pow( GetUnitY(caster) - GetUnitY(objective) , 2) ) /750 )
if IsUnitDeadBJ(objective) then
set n=-1
endif
loop
exitwhen a>=n
set elec[a]=GetACaster()
call SetUnitOwner( elec[a], GetOwningPlayer(caster), true )
call SetUnitPosition( elec[a], GetUnitX(objective), GetUnitY(objective) )
call UnitAddAbility(elec[a],abi )
call SetUnitAbilityLevel(elec[a],abi,l)
call SetUnitTurnSpeed( elec[a], 0.5)
set a=a+1
endloop
set t=CreateTimer()
call TimerStart( t, Flaming_Shield_Duration(GetUnitAbilityLevel(caster, Flaming_Shield_SpellId()) ), false, null)
loop
exitwhen (TimerGetRemaining(t)<=0) or (IsUnitDeadBJ(objective))
set a=0
loop
exitwhen a>=n
call IssuePointOrder(elec[a],"smart", GetUnitX(objective)+150*CosBJ(grad+a*360/n), GetUnitY(objective)+150*SinBJ(grad+a*360/n))
set a=a+1
endloop
set grad = ModuloReal(grad+30,360)
call TriggerSleepAction(0)
endloop
call DestroyTimer(t)
set t=null
set a=0
loop
exitwhen a>=n
call RecicleCasterAfterCast( elec[a], abi)
set elec[a]=null
set a=a+1
endloop
endfunction
//===================================================================================================
function InitTrig_Flaming_Shield takes nothing returns nothing
set gg_trg_Flaming_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flaming_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Flaming_Shield, Condition( function Trig_Flaming_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Flaming_Shield, function Trig_Flaming_Shield_Actions )
endfunction
//***************************************************************************************************
//*
//* ChainFire
//*
//* Requires:
//* - The ChainFire Ability
//* - The Caster System *
//* - This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Note: To Change the art, use the Object editor an edit these fields of the ability:
//*
//* - Missile Art = Missile Effect
//* - Special Art = Attached to the targets during the ignition.
//*
//***************************************************************************************************
//===================================================================================================
// ChainFire Spell Configuration:
//
constant function ChainFire_SpellId takes nothing returns integer
return 'A004' //// ChainFire's Ability Rawcode
endfunction
constant function ChainFire_Area takes integer level returns real
return 200.0+50*level //// Maximum distance between the affected units
endfunction
constant function ChainFire_Damage takes integer level returns real
return 15.0 + level*5.0 //// Chain Fire 's Damage per second for 1st target
endfunction
constant function ChainFire_AttackType takes integer level returns attacktype
return ATTACK_TYPE_CHAOS
endfunction
constant function ChainFire_DamageType takes integer level returns damagetype
return DAMAGE_TYPE_FIRE
endfunction
constant function ChainFire_Duration takes integer level returns real
return 15.0 + level*5.0 //// Chain Fire 's Duration of the burning effect
endfunction
constant function ChainFire_n takes integer level returns integer
return 2+level //// Chain Fire 's Total number of targets
endfunction
constant function ChainFire_Factor takes nothing returns real
return 0.75 //// The factor of the damage reduction per new target.
endfunction
//===================================================================================================
function Trig_ChainFire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ChainFire_SpellId()
endfunction
function Trig_ChainFire_Actions takes nothing returns nothing
local unit closest=GetSpellTargetUnit()
local unit closer
local unit u=GetTriggerUnit()
local integer s=GetSpellAbilityId()
local group victimlog=CreateGroup()
local group area=CreateGroup()
local unit picked
local real dist
local real x
local integer l=GetUnitAbilityLevel(u,s)
local integer a=ChainFire_n(l)
local real ouch=ChainFire_Damage(l)
set a=a-1
call ProjectileLaunchToUnit( GetAbilityEffectById(s,EFFECT_TYPE_MISSILE,0), 522, 0, GetUnitX(u), GetUnitY(u), 100, closest, 100)
call UnitDamageUnitTimed( u, ouch, 1, ChainFire_Duration(l), closest,GetAbilityEffectById(s,EFFECT_TYPE_SPECIAL,0), "chest", ChainFire_AttackType(l),ChainFire_DamageType(l))
loop
call GroupAddUnit( victimlog, closest)
exitwhen a<=0
call GroupEnumUnitsInRange( area, GetUnitX(closest), GetUnitY(closest), ChainFire_Area(l), null)
set dist=1000000
set closer=null
loop
set picked=FirstOfGroup(area)
exitwhen picked==null
if IsUnitEnemy( picked, GetOwningPlayer(u) ) and not(IsUnitInGroup(picked, victimlog) and IsUnitAliveBJ(picked) ) then
set x=SquareRoot( Pow( GetUnitX(picked)-GetUnitX(closest) ,2) + Pow(GetUnitY(picked)-GetUnitY(closest),2) )
if x<dist then
set closer=picked
set dist=x
endif
endif
call GroupRemoveUnit(area,picked)
endloop
exitwhen closer==null
call ProjectileLaunchToUnit( GetAbilityEffectById(s,EFFECT_TYPE_MISSILE,0), 522, 0, GetUnitX(closest), GetUnitY(closest), 100, closer, 100)
set ouch=ouch*ChainFire_Factor()
call UnitDamageUnitTimed( u, ouch, 1, ChainFire_Duration(l),closest, GetAbilityEffectById(s,EFFECT_TYPE_SPECIAL,0), "chest", ChainFire_AttackType(l),ChainFire_DamageType(l))
set closest=closer
set a=a-1
endloop
call DestroyGroup(victimlog)
call DestroyGroup(area)
set closest=null
set closer=null
set u=null
set victimlog=null
set area=null
set picked=null
endfunction
//===================================================================================================
function InitTrig_Chain_Burning takes nothing returns nothing
set gg_trg_Chain_Burning = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chain_Burning, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Chain_Burning, Condition( function Trig_ChainFire_Conditions ) )
call TriggerAddAction( gg_trg_Chain_Burning, function Trig_ChainFire_Actions )
endfunction
//***************************************************************************************************
//*
//* Freezing Bolt
//*
//* Requires:
//* - The Caster System *
//* - The Freezing Bolt Ability
//* - This Trigger (Make sure the Configuration section has your map's rawcodes)
//*
//* Note: To Change the art, use the Object editor an edit these fields of the ability:
//* - Special Art = The missile used by the ability.
//* - Target Art = Attached to the target during the freeze time
//* - Effect Art = Appears when the unit dies if it was frozen
//*
//***************************************************************************************************
//===================================================================================================
// Freezing Bolt Spell Configuration:
//
constant function FreezingBolt_SpellId takes nothing returns integer
return 'A00R'
endfunction
constant function FreezingBolt_Duration takes integer level returns integer
return 4+level
endfunction
constant function FreezingBolt_Damage takes integer level returns integer
return 300+100*level
endfunction
function FreezingBolt_DamageOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_COLD)
// See caster system readme for more info
endfunction
//===================================================================================================
function Trig_FreezingBolt_Conditions takes nothing returns boolean
return GetSpellAbilityId() == FreezingBolt_SpellId()
endfunction
function FreezingBolt_TargetDies takes nothing returns nothing
local unit d=GetTriggerUnit()
call DestroyEffect( AddSpellEffectById(FreezingBolt_SpellId(),EFFECT_TYPE_EFFECT, GetUnitX(d) , GetUnitY(d) ) )
if not IsUnitType( d, UNIT_TYPE_HERO) then
call RemoveUnit(d)
endif
set d=null
endfunction
function Trig_FreezingBolt_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer l=GetUnitAbilityLevel(u, GetSpellAbilityId() )
local unit target=GetSpellTargetUnit()
local effect fx
local trigger dead=CreateTrigger()
call PauseUnit(u,true)
call PauseUnit(u,false)
call SetUnitAnimation(u, "attack" )
call ProjectileLaunchToUnit( GetAbilityEffectById( GetSpellAbilityId(), EFFECT_TYPE_SPECIAL,0), 522, 0.15, GetUnitX(u), GetUnitY(u), 60, target, 60 )
if not IsUnitDeadBJ(target) then
call TriggerRegisterUnitEvent( dead, target, EVENT_UNIT_DEATH )
call TriggerAddAction( dead, function FreezingBolt_TargetDies )
set fx= AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET, target, "origin" )
call DamageUnitByOptions( u,target, FreezingBolt_Damage(l),FreezingBolt_DamageOptions(l))
call TriggerSleepAction(0)
call PauseUnit( target, true)
call SetUnitTimeScale( target, 0)
call PolledWait(FreezingBolt_Duration(l) )
call DestroyTrigger(dead)
call SetUnitTimeScale( target, 1)
call PauseUnit( target, false)
call DestroyEffect(fx)
endif
set u=null
set fx=null
set target=null
call DestroyTrigger(dead)
set dead=null
endfunction
//===========================================================================
function InitTrig_FreezingBolt takes nothing returns nothing
set gg_trg_FreezingBolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FreezingBolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_FreezingBolt, Condition( function Trig_FreezingBolt_Conditions ) )
call TriggerAddAction( gg_trg_FreezingBolt, function Trig_FreezingBolt_Actions )
endfunction
//***************************************************************************************************
//*
//* Cold Slash
//*
//* Requires:
//* - The Caster System *
//* - The Coldslash Ability
//* - This Trigger (Make sure the Configuration section has your map's rawcodes)
//*
//* Note: To Change the art, use the Object editor and edit these fields of the ability:
//* - Caster Art = The Effect to attach to the hands of the hero
//* - Target Art = The hit art that appears on the target
//* - Special Art = Appears below the hero before hiting a new target-
//*
//***************************************************************************************************
//===================================================================================================
// Cold Slash Spell Configuration:
//
constant function Coldslash_SpellId takes nothing returns integer
return 'A006' //// The spell id for the Coldslash ability (its rawcode after copying to your map)
////(Custom Abilities\orc\heroes\)
endfunction
constant function Coldslash_TotalHits takes integer level returns integer
return 1+level*2 //// The total number of hits formula
endfunction
constant function Coldslash_Area takes integer level returns integer
return 350+level*10 //// The Area of effect formula (the distance for acquiring new targets)
endfunction
constant function Coldslash_MainDamage takes integer level returns integer
return 100+level*50 //// The damage for the first hit
endfunction
constant function Coldslash_DamageFactor takes integer level returns real
return 1.0 //// the damage factor per hit (it is 1.0 at this moment so it always do the same
//// damage, change it to 0.5 if you want the damage halved like chain lightning.
endfunction
function ColdSlash_DamageOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_COLD) + DamageException(UNIT_TYPE_STRUCTURE,0) + DamageOnlyTo(UNIT_TYPE_GROUND)
// Will Do Cold spell damage, won't affect buildings nor Flying units
// See the caster system readme for more info.
endfunction
//===================================================================================================
function Trig_Cold_Slash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Coldslash_SpellId()
endfunction
function Trig_Cold_Slash_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer s= GetSpellAbilityId()
local integer l=GetUnitAbilityLevel( u,s )
local group targetlog=CreateGroup()
local group inrange=CreateGroup()
local integer i=Coldslash_TotalHits(l)
local unit target=GetSpellTargetUnit()
local unit picked
local unit other=GetSpellTargetUnit()
local real grad=GetUnitX( u)
local real damage=Coldslash_MainDamage(l)
local effect fx1=AddSpellEffectTargetById(s, EFFECT_TYPE_CASTER, u, "hand left" )
local effect fx2=AddSpellEffectTargetById(s, EFFECT_TYPE_CASTER, u, "hand right" )
local real fct
call PauseUnit(u, true)
call SetUnitPathing(u,false)
loop
call GroupAddUnit( targetlog,target)
set grad=Atan2BJ( GetUnitY(target) - GetUnitY(u), GetUnitX(target) - GetUnitX(u) )
call DestroyEffect( AddSpellEffectById(s, EFFECT_TYPE_SPECIAL, GetUnitX(u), GetUnitY(u) ) )
call SetUnitFacing( u, grad )
call SetUnitAnimation( u, "attack slam")
call PolledWait(0.25)
call SetUnitPosition( u, GetUnitX(target)+100*CosBJ(grad), GetUnitY(target)+100*SinBJ(grad) )
call DamageUnitByOptions(u,target, damage, ColdSlash_DamageOptions(l))
call DestroyEffect( AddSpellEffectTargetById(s, EFFECT_TYPE_TARGET, target, "origin" ) )
call PolledWait(0.25)
set i=i-1
set damage=damage*Coldslash_DamageFactor(l)
exitwhen i==0 or IsUnitDeadBJ(u)
call GroupClear(inrange)
call GroupEnumUnitsInRange(inrange, GetUnitX(target), GetUnitY(target) , Coldslash_Area(l) , null)
set target=null
set other=null
set grad=1000000
loop
set picked=FirstOfGroup(inrange)
exitwhen picked==null
if IsUnitEnemy(picked, GetOwningPlayer(u) ) and IsUnitAliveBJ(picked) then
set fct=GetDamageFactorByOptions(u,picked,ColdSlash_DamageOptions(l))
else
set fct=0
endif
if fct!=0 then
if not( IsUnitInGroup(picked,targetlog) ) and SquareRoot( Pow(GetUnitX(u)-GetUnitX(picked),2) + Pow(GetUnitY(u)-GetUnitY(picked),2) ) <= grad then
set grad=SquareRoot( Pow(GetUnitX(u)-GetUnitX(picked),2) + Pow(GetUnitY(u)-GetUnitY(picked),2) )
set target=picked
endif
set other=picked
endif
call GroupRemoveUnit(inrange,picked)
endloop
if target==null then
set target=other
endif
exitwhen target==null
endloop
call DestroyEffect( AddSpellEffectTargetById(s, EFFECT_TYPE_SPECIAL, u, "origin" ) )
call PauseUnit(u,false)
call SetUnitPathing(u,true)
call SetUnitPosition(u, GetUnitX(u), GetUnitY(u) )
call DestroyEffect(fx1)
call DestroyEffect(fx2)
set fx1=null
set fx2=null
set u=null
call DestroyGroup(targetlog)
set targetlog=null
call DestroyGroup(inrange)
set inrange=null
set target=null
set other=null
endfunction
//===================================================================================================
function InitTrig_Cold_Slash takes nothing returns nothing
set gg_trg_Cold_Slash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cold_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Cold_Slash, Condition( function Trig_Cold_Slash_Conditions ) )
call TriggerAddAction( gg_trg_Cold_Slash, function Trig_Cold_Slash_Actions )
endfunction
//***************************************************************************************************
//*
//* SnowStorm
//*
//* Requires:
//* -The SnowStorm Ability
//* -The SnowStorm Attack Bonus and Armor Bonus Abilities
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities)
//*
//* Art: The only easy to customize art is the one used by the Frost Attack bonus abilities
//*
//***************************************************************************************************
//===================================================================================================
// SnowStorm Spell Configuration:
//
constant function SnowStormAbilityId takes nothing returns integer
return 'A00K' //* SnowStorm's RawCode (It changes betwen maps)
endfunction
constant function SnowStormBonusAbilityId takes integer b returns integer
if b==1 then
return 'A00L' //* SnowStorm's Attack Bonus RawCode (It changes betwen maps)
elseif b==2 then
return 'AId2' //* SnowStorm's Armor Bonus Rawcode (In case you want to change it with another passive skill)
/////// To Add more bonus abilities to the channeling aura, add a new line starting with
////// elseif b==(number of bonus) then
////// return 'xxxx' ///Being xxxx the rawcode of the new bonus ability.
////// Then in the last return put the total number of bonuses.
endif
return 2 //// The total number of bonus abilities.
endfunction
constant function SnowStormRadius takes integer level returns real
return 400.0 + level * 100 //* SnowStorm's Radius formula
endfunction
//===================================================================================================
function Trig_Snowstorm_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SnowStormAbilityId()
endfunction
function Trig_Snowstorm_Actions takes nothing returns nothing
local unit caster=GetTriggerUnit()
local location loc=GetUnitLoc(caster)
local group inrange
local group affected=CreateGroup()
local group aux=CreateGroup()
local trigger end= CreateTrigger()
local unit current
local integer l=GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real range=SnowStormRadius(l)
local rect efa=Rect( GetUnitX(caster) - range/5,GetUnitY(caster) - range/5,GetUnitX(caster) + range/5,GetUnitY(caster) + range/5)
local weathereffect snow
local integer a=0
set snow=AddWeatherEffect(efa, 'SNhs')
call EnableWeatherEffect(snow, true)
call TriggerRegisterUnitEvent( end, caster, EVENT_UNIT_SPELL_ENDCAST )
call TriggerRegisterUnitEvent( end, caster, EVENT_UNIT_DEATH )
call PolledWait(1)
loop
exitwhen GetTriggerEvalCount( end) > 0
set inrange=GetUnitsInRangeOfLocAll(range, loc)
call GroupAddGroup( affected, aux)
loop
set current= FirstOfGroup(aux)
exitwhen current == null
call GroupRemoveUnit( aux, current)
if not IsUnitInGroup( current, inrange) then
call GroupRemoveUnit( affected, current)
set a=SnowStormBonusAbilityId(0)
loop
exitwhen a==0
call UnitRemoveAbility( current,SnowStormBonusAbilityId(a))
set a=a-1
endloop
endif
endloop
loop
set current= FirstOfGroup(inrange)
exitwhen current==null
call GroupRemoveUnit( inrange, current)
if not IsUnitInGroup( current, affected) and GetOwningPlayer(current) == GetOwningPlayer(caster) then
call GroupAddUnit( affected, current)
set a=SnowStormBonusAbilityId(0)
loop
exitwhen a==0
call UnitAddAbility( current,SnowStormBonusAbilityId(a))
call SetUnitAbilityLevel( current,SnowStormBonusAbilityId(a),l)
set a=a-1
endloop
endif
endloop
call DestroyGroup( inrange)
call TriggerSleepAction(0.5)
endloop
loop
set current= FirstOfGroup(affected)
exitwhen current == null
call GroupRemoveUnit( affected, current)
set a=SnowStormBonusAbilityId(0)
loop
exitwhen a==0
call UnitRemoveAbility( current,SnowStormBonusAbilityId(a))
set a=a-1
endloop
endloop
set caster=null
call RemoveLocation( loc)
set loc=null
call RemoveRect( efa)
call RemoveWeatherEffect( snow)
set efa=null
set snow=null
call DestroyTrigger( end)
set end=null
call DestroyGroup(inrange)
call DestroyGroup(affected)
call DestroyGroup(aux)
set inrange=null
set affected=null
set aux=null
endfunction
//===================================================================================================
function InitTrig_Snowstorm takes nothing returns nothing
set gg_trg_Snowstorm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Snowstorm, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Snowstorm, Condition( function Trig_Snowstorm_Conditions ) )
call TriggerAddAction( gg_trg_Snowstorm, function Trig_Snowstorm_Actions )
endfunction
//***************************************************************************************************
//*
//* Ice Wave
//*
//* Requires:
//* -The Ice Wave Ability
//* -The Caster System *
//* -Ice Wave Damage And Freezing ability ,
//* must have the same number of levels as Ice wave
//* -This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//*
//* Art: To change the effect art use change the art of the Freezing and damage abilities
//*
//***************************************************************************************************
//===================================================================================================
// Ice Wave Spell Configuration:
//
function IceWave_SpellId takes nothing returns integer
return 'A044' //* Ice Wave Ability Rawcode
endfunction
function IceWave_AuxAbility takes nothing returns integer
return 'A048' //* Freezing and Damage Ability Rawcode
endfunction
function IceWave_WavesPerLevel takes integer level returns integer
return 8 + level*2 //* Number of Ice Strikes per level forumula
endfunction
//===================================================================================================
function Trig_IceWave_Conditions takes nothing returns boolean
return GetSpellAbilityId() == IceWave_SpellId()
endfunction
function Trig_IceWave_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local location loc=GetSpellTargetLoc()
local real facing=Atan2(GetLocationY(loc) - y, GetLocationX(loc) - x) //The angle between the hero and the target by any chance?
local integer a=1
local unit ice=GetACaster()
local integer l=GetUnitAbilityLevel( GetTriggerUnit(), IceWave_SpellId() )
call RemoveLocation(loc)
call SetUnitPosition(ice,x,y)
call SetUnitOwner( ice, GetOwningPlayer(u), false)
call UnitAddAbility( ice, IceWave_AuxAbility())
call SetUnitAbilityLevel( ice, IceWave_AuxAbility(),l)
call UnitRemoveAbility( ice, 'Aloc')
call SetUnitInvulnerable( ice, true)
loop
exitwhen a >= IceWave_WavesPerLevel( l )
call SetUnitPosition( ice, x+a*100*Cos(facing)+GetRandomReal(0, 100 ), y+a*100*Sin(facing)+GetRandomReal(0, 100))
call IssueTargetOrder( ice, "frostnova", ice )
call TriggerSleepAction( 0)
set a=a+1
endloop
call SetUnitInvulnerable( ice, false)
call UnitAddAbility( ice, 'Aloc')
call RecicleCaster(ice)
set u=null
set loc=null
set ice=null
endfunction
//===================================================================================================
function InitTrig_IceWave takes nothing returns nothing
local integer a=0
call PreloadAbility( IceWave_AuxAbility())
set gg_trg_IceWave = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_IceWave, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_IceWave, Condition( function Trig_IceWave_Conditions ) )
call TriggerAddAction( gg_trg_IceWave, function Trig_IceWave_Actions )
endfunction
//***************************************************************************************************
//*
//* Nuke
//*
//* Requires:
//* - The Caster System *
//* - The Nuke Ability
//* - This Trigger (Make sure the Configuration section has your map's rawcodes)
//*
//* Optional:
//* - The war3mapimported\Btnnuke.blp icon (give credit to Mc! in that case)
//*
//* Note: To Change the art, use the Object editor an edit these fields of the ability:
//* - Special Art = The missile or whatever you think it is.
//* - Target Art = The explosion (will directly play its death animation)
//*
//***************************************************************************************************
//===================================================================================================
// Nuke Spell Configuration:
//
constant function Nuke_SpellId takes nothing returns integer
return 'A008' //// The spell id for the nuke ability (its rawcode after copying to your map)
////(Custom Abilities\Neutral hostile\heroes\nuke)
endfunction
constant function Nuke_MainDamageArea takes integer level returns integer
return 90+50*level //// The area for the bigger damage
endfunction
constant function Nuke_HalfDamageArea takes integer level returns integer
return 100+100*level //// The area for the smaller damage
endfunction
constant function Nuke_Damage takes integer level returns integer
return 120+100*level
endfunction
constant function Nuke_Warning takes nothing returns string
return "
Nuclear Launch Detected
"
endfunction
function Nuke_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_CHAOS,DAMAGE_TYPE_FORCE)+DamageTrees()
// See the caster system readme for more info
endfunction
//===================================================================================================
function Trig_Nuke_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Nuke_SpellId()
endfunction
function Trig_Nuke_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer l=GetUnitAbilityLevel(u, GetSpellAbilityId() )
local integer a=1
local trigger fin=CreateTrigger()
local trigger stp=CreateTrigger()
local texttag lasser=CreateTextTag()
local location loc=GetSpellTargetLoc()
local unit array m
local effect fx
call DisplayTimedTextToPlayer( GetLocalPlayer(),0,0,60,Nuke_Warning())
call SetTextTagPos( lasser, GetLocationX(loc), GetLocationY(loc), 0)
call SetTextTagColor( lasser, 255,0,0,255)
call SetTextTagText( lasser, ".", 0.075)
call SetTextTagVisibility(lasser,true)
call TriggerRegisterUnitEvent( fin, u, EVENT_UNIT_SPELL_FINISH)
call TriggerRegisterUnitEvent( stp, u, EVENT_UNIT_SPELL_ENDCAST)
loop
exitwhen GetTriggerEvalCount(stp) > 0
call SetTextTagColor( lasser, 255,0,0,0)
call TriggerSleepAction(0)
exitwhen GetTriggerEvalCount(stp) > 0
call SetTextTagColor( lasser, 255,0,0,255)
call TriggerSleepAction(0)
endloop
call DestroyTextTag( lasser )
if GetTriggerEvalCount(fin) > 0 then
set m[0]=GetACaster()
call SetUnitPositionLoc(m[0], loc)
call SetUnitFlyHeight(m[0], 900, 0)
call SetUnitFlyHeight(m[0], 0, 460)
set fx= AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_SPECIAL, m[0], "origin" )
call PolledWait(1.9)
call DestroyEffect(fx)
set udg_delayhack=5
call SetUnitScale( m[0], 0,0,0)
call RecicleCasterAfterCast(m[0],0)
set udg_delayhack=0
set m[0]=GetACaster()
call SetUnitPositionLoc(m[0], loc)
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET, m[0], "origin" ) )
call DamageUnitsInAOEExLoc( u, Nuke_Damage(l)/2 ,loc,Nuke_MainDamageArea(l),true,Nuke_DamageOptions(l))
call PolledWait(0.5)
loop
exitwhen a>12
set m[a]=GetACaster()
if a>=11 then
call SetUnitPosition(m[a], GetLocationX(loc), GetLocationY(loc))
else
call SetUnitPosition(m[a], GetLocationX(loc) + 250*CosBJ(a*36), GetLocationY(loc) + 250*SinBJ(a*36))
endif
call SetUnitFlyHeight(m[a], IntegerTertiaryOp( a==12,250,500), 0)
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET, m[a], "origin" ) )
set a=a+1
endloop
call DamageUnitsInAOEExLoc( u, Nuke_Damage(l)/2 ,loc,Nuke_HalfDamageArea(l),true,Nuke_DamageOptions(l))
call TriggerSleepAction(10)
loop
set a=a-1
call RecicleCaster(m[a])
set m[a]=null
exitwhen a==0
endloop
endif
set u=null
call DestroyTrigger(fin)
call DestroyTrigger(stp)
call RemoveLocation(loc)
set fin=null
set stp=null
set lasser=null
set loc=null
set fx=null
endfunction
//===========================================================================
function InitTrig_Nuke takes nothing returns nothing
set gg_trg_Nuke = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuke, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Nuke, Condition( function Trig_Nuke_Conditions ) )
call TriggerAddAction( gg_trg_Nuke, function Trig_Nuke_Actions )
endfunction
//***************************************************************************************************
//*
//* Charged Bolt
//*
//* Requires:
//* - The Charged Bolt Ability
//* - The Charged Bolt Damage Ability
//* - The Caster System *
//* - This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/units)
//*
//* Art:
//* - The Ability's Special Art determines the missile.
//*
//***************************************************************************************************
//===================================================================================================
// Charged Bolt Spell Configuration:
//
constant function Charged_Bolt_Message takes nothing returns string
//* The message that would be showed to the player
return "
|cff0000ffCharged Bolt|r : Keep Pressing Escape until the charged bolt casting finnishes, the more times you press escape, the more damage that will be dealt to the enemy
"
endfunction
constant function Charged_Bolt_AbilityId takes nothing returns integer
return 'A00N' //* Replace A005 with Charged Bolt Ability Rawcode (It is different betwen maps)
endfunction
constant function Charged_Bolt_Damage takes nothing returns real
return 10.00 //* Replace 10.00 with the damage per level/charge you want
endfunction
function ChargedBolt_DamageOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_SIEGE,DAMAGE_TYPE_LIGHTNING)
// Will do siege lightning damage, see caster system readme for more info.
endfunction
//===================================================================================================
function Trig_Charged_Bolt_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Charged_Bolt_AbilityId()
endfunction
function Trig_Charged_Bolt_Actions takes nothing returns nothing
local trigger charge=CreateTrigger()
local trigger end=CreateTrigger()
local trigger wellend=CreateTrigger()
local unit caster=GetTriggerUnit()
local unit target=GetSpellTargetUnit()
local unit bolt=GetACaster()
local integer l=GetUnitAbilityLevel(caster, Charged_Bolt_AbilityId())
local boolean terminate=false
local real x=0
local effect fx
call SetUnitPosition( bolt, GetUnitX(caster) + 100 * CosBJ(GetUnitFacing(caster)), GetUnitY(caster) + 100 * SinBJ(GetUnitFacing(caster)) )
call SetUnitFlyHeight( bolt, 200,0)
call SetUnitFacing( bolt, GetUnitFacing(caster))
call SetUnitOwner( bolt, GetOwningPlayer(caster), true)
set fx=AddSpellEffectTargetById( GetSpellAbilityId(),EFFECT_TYPE_SPECIAL, bolt, "origin" )
call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, Charged_Bolt_Message() )
call TriggerRegisterPlayerEventEndCinematic( charge, GetOwningPlayer(caster) )
call TriggerRegisterUnitEvent( wellend, caster, EVENT_UNIT_SPELL_FINISH )
call TriggerRegisterUnitEvent( end, caster, EVENT_UNIT_SPELL_ENDCAST )
call TriggerRegisterUnitEvent( end, caster, EVENT_UNIT_DEATH )
loop
exitwhen GetTriggerEvalCount( wellend) > 0
if GetTriggerEvalCount( end) > 0 or IsUnitDeadBJ(target) then
set terminate=true
endif
exitwhen terminate
set x= 1+(GetTriggerEvalCount( charge) / 20)
call SetUnitScale( bolt, x,x,x)
call TriggerSleepAction(0)
endloop
if not terminate then
loop
exitwhen RAbsBJ(GetUnitX(target) - GetUnitX(bolt)) <= 50 and RAbsBJ(GetUnitY(target) - GetUnitY(bolt)) <= 50
call IssuePointOrder( bolt, "move", GetUnitX(target), GetUnitY(target) )
call TriggerSleepAction(0)
endloop
set x=Charged_Bolt_Damage() * GetTriggerEvalCount(charge) * l
call DamageUnitByOptions(caster,target, x,ChargedBolt_DamageOptions(l))
endif
call DestroyEffect( fx)
set udg_delayhack=2
call RecicleCasterAfterCast( bolt, 0)
set udg_delayhack=0
call DestroyTrigger(charge)
call DestroyTrigger(end)
call DestroyTrigger(wellend)
set charge=null
set end=null
set wellend=null
set bolt=null
set caster=null
set target=null
endfunction
//===================================================================================================
function InitTrig_Charged_Bolt takes nothing returns nothing
set gg_trg_Charged_Bolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Charged_Bolt, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Charged_Bolt, Condition( function Trig_Charged_Bolt_Conditions ) )
call TriggerAddAction( gg_trg_Charged_Bolt, function Trig_Charged_Bolt_Actions )
endfunction
//***************************************************************************************************
//*
//* Cloaking Field
//*
//* Requires:
//* -The Cloaking Field Ability
//* -The Cloaking Field Buff (Make sure the ability uses that buff)
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/buff Rawcodes)
//*
//* Art:
//* - The Ability's Caster Art randomly appears at the position of the caster during cloak.
//* - The Ability's Special Art appears at the position of the caster at the end of cloak
//* - Other stuff can be changed through the buff.
//*
//***************************************************************************************************
//===================================================================================================
// Cloaking Field Spell Configuration:
//
function CloakingField_AbilityId takes nothing returns integer
return 'A00P' //// The Rawcode for the Cloaking Field Ability in your map
endfunction
function CloakingField_BuffId takes nothing returns integer
return 'B004' //// The Rawcode for the Cloaking Field Buff in your map
endfunction
//===================================================================================================
function Trig_Cloaking_Field_Start_Conditions takes nothing returns boolean
return GetSpellAbilityId() == CloakingField_AbilityId()
endfunction
function Trig_Cloaking_Field_Start_Actions takes nothing returns nothing
local unit caster=GetTriggerUnit()
local integer a=0
call UnitAddAbility( caster, 'Apiv')
call UnitAddAbility( caster, 'Agho')
loop
exitwhen UnitHasBuffBJ(GetTriggerUnit(), CloakingField_BuffId())
call TriggerSleepAction( 0 )
endloop
loop
exitwhen not( UnitHasBuffBJ(GetTriggerUnit(), CloakingField_BuffId()) )
call TriggerSleepAction( 0 )
if ModuloInteger(a,10) == 0 then
call DestroyEffect( AddSpellEffectById(GetSpellAbilityId(), EFFECT_TYPE_CASTER, GetUnitX(caster), GetUnitY(caster) ) )
endif
set a=a+1
endloop
call DestroyEffect( AddSpellEffectTargetById(GetSpellAbilityId(),EFFECT_TYPE_SPECIAL,caster,"origin") )
call UnitRemoveAbility( caster,'Apiv')
call UnitRemoveAbility( caster,'Agho')
endfunction
//===================================================================================================
function InitTrig_Cloaking_Field takes nothing returns nothing
set gg_trg_Cloaking_Field = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cloaking_Field, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Cloaking_Field, Condition( function Trig_Cloaking_Field_Start_Conditions ) )
call TriggerAddAction( gg_trg_Cloaking_Field, function Trig_Cloaking_Field_Start_Actions )
endfunction
//***************************************************************************************************
//*
//* Death Missiles
//*
//* Requires:
//* -The Death Missiles Ability
//* -The Caster System *
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/units Rawcodes)
//*
//* Art:
//* - The Ability's Special Art determines the missile effect
//* - The Ability's Target Art determines the missile launch effect
//*
//***************************************************************************************************
//===================================================================================================
// Death Missiles Spell Configuration:
//
constant function GoblinMissiles_AbilityId takes nothing returns integer
return 'A01O' //* Goblin Missiles ability rawcode (changes between maps)
endfunction
constant function GoblinMissiles_Damage takes integer level returns real
return 25.0+25*level //// AOE damage per missile
endfunction
constant function GoblinMissiles_Area takes integer level returns real
return 100+50.0*level //// Missile Explosion area
endfunction
constant function GoblinMissiles_MissileDuration takes integer level returns real
return 0.8+level*0.2 //// Determines the Time a missile will take to explode
endfunction
constant function GoblinMissiles_ActivationRadius takes integer level returns real
return 50.00 //// The distance between an enemy and the missile to make the missile explode
endfunction
function GoblinMissiles_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_SIEGE,DAMAGE_TYPE_FORCE)+DamageTrees()+DamageException(UNIT_TYPE_STRUCTURE,2)
// See the caster system readme for more info
endfunction
//===================================================================================================
function Trig_Create_Missiles_Conditions takes nothing returns boolean
return GetSpellAbilityId() == GoblinMissiles_AbilityId()
endfunction
function GoblinMissile_AI takes nothing returns nothing
local unit o=udg_currenthurter
local unit m=bj_lastCreatedUnit
local effect fx=bj_lastCreatedEffect
local group enem=CreateGroup()
local boolexpr fil=Condition(function CasterAOE_IsFilterEnemy)
local timer t=CreateTimer()
local integer l=bj_forLoopAIndex
local real grad=GetUnitFacing(m)
local real x1=0
local real y1=0
local real x2=GetUnitX(m)
local real y2=GetUnitY(m)
call TimerStart(t, GoblinMissiles_MissileDuration(l), false, null)
call IssuePointOrder( m, "move", GetUnitX(m)+1900.00* CosBJ(grad),GetUnitY(m)+1900.00* SinBJ(grad))
loop
set bj_groupEnumOwningPlayer=GetOwningPlayer(m)
call GroupEnumUnitsInRangeCounted(enem,GetUnitX(m),GetUnitY(m),GoblinMissiles_ActivationRadius(l),fil, 1)
exitwhen TimerGetRemaining(t) <= 0 or FirstOfGroup(enem)!=null
call TriggerSleepAction(0)
set x1=x2
set y1=y2
set x2=GetUnitX(m)
set y2=GetUnitY(m)
exitwhen x1==x2 and y1==y2
endloop
set x1=GoblinMissiles_Area(l)/100
call SetUnitScale(m,x1,x1,x1)
call IssueImmediateOrder( m, "stop")
call DestroyEffect(fx)
call UnitApplyTimedLife( m, 0, 4)
call DamageUnitsInAOEEx( o, GoblinMissiles_Damage(l), GetUnitX(m), GetUnitY(m), GoblinMissiles_Area(l), false, GoblinMissiles_DamageOptions(l))
call DestroyGroup(enem)
call DestroyBoolExpr(fil)
set fil=null
set enem=null
set m=null
set o=null
endfunction
function Trig_Create_Missiles_Actions takes nothing returns nothing
local unit mech=GetTriggerUnit()
local trigger end=CreateTrigger()
local trigger missai=CreateTrigger()
local integer a=0
local real face=GetUnitFacing(mech)
local real grad=GetRandomReal( face-45,face+45 )
local integer l=GetUnitAbilityLevel(mech,GoblinMissiles_AbilityId())
call TriggerRegisterUnitEvent( end, mech, EVENT_UNIT_SPELL_ENDCAST )
call TriggerRegisterUnitEvent( end, mech, EVENT_UNIT_DEATH )
call TriggerAddAction( missai, function GoblinMissile_AI )
loop
exitwhen GetTriggerEvalCount(end) > 0
set bj_lastCreatedUnit= AddCasterFacing(grad)
call SetUnitPosition( bj_lastCreatedUnit, GetUnitX(mech)+50*CosBJ(face), GetUnitY(mech)+50*SinBJ(face))
call SetUnitFlyHeight(bj_lastCreatedUnit, 140, 0)
set bj_lastCreatedEffect=AddSpellEffectTargetById( GetSpellAbilityId(),EFFECT_TYPE_SPECIAL, bj_lastCreatedUnit, "origin" )
call DestroyEffect(AddSpellEffectById( GetSpellAbilityId(), EFFECT_TYPE_TARGET,GetUnitX(mech),GetUnitY(mech)))
set bj_forLoopAIndex=l
call SetUnitOwner( bj_lastCreatedUnit, GetOwningPlayer(mech), true)
set udg_currenthurter=mech
call TriggerExecute( missai)
set a=a+1
if ModuloInteger(a,2) == 0 then
set grad=GetRandomReal( face-45,face+45 )
else
set grad=2*face-grad
endif
call TriggerSleepAction(0)
endloop
call DestroyTrigger(end)
set end=null
call DestroyTrigger(missai)
set missai=null
endfunction
//===================================================================================================
function InitTrig_Death_Missiles takes nothing returns nothing
set gg_trg_Death_Missiles = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Death_Missiles, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Death_Missiles, Condition( function Trig_Create_Missiles_Conditions ) )
call TriggerAddAction( gg_trg_Death_Missiles, function Trig_Create_Missiles_Actions )
endfunction
//***************************************************************************************************
//*
//* Shield of Divinity
//*
//* Requires:
//* - The Shield of Divinity Ability
//* - The Caster System *
//* - This Trigger (make sure the Configuration Section is pointing
//* to the right abilities rawcodes)
//* Art:
//* - The Ability's Special art determines the missile effect
//* - The Ability's Target art determines the healing effect
//*
//***************************************************************************************************
//===================================================================================================
// Divinity Shield Spell Configuration:
//
constant function DivinityShield_SpellId takes nothing returns integer
return 'A012' //// DivinityShield Ability Rawcode
endfunction
constant function DivinityShield_HPHeal takes integer level returns real
return 100.0+level*100.0 //// Divinity Shield Heal amount formula
endfunction
constant function DivinityShield_Area takes integer level returns integer
return 300+level*0 //// Divinity Shield Area of effect by level formula
endfunction
constant function DivinityShield_Duration takes integer level returns real
return 45.00+level*7.00
endfunction
constant function DivinityShield_HealDelay takes integer level returns integer
return 1-level*0 // The time the spell will wait after healing somebody, before healing anybody again
endfunction
constant function DivinityShield_LightsNumber takes integer level returns integer
return 4+level*1 //* The number of light balls, high numbers lag the game out
endfunction
function DivinityShield_HealOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL)+DamageException(UNIT_TYPE_UNDEAD,0)
// Will heal with universal damage, it is impossible for it to heal undead units.
// These are actually DamageOptions, see Caster System readme for more info.
endfunction
//===================================================================================================
function Trig_DivinityShield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == DivinityShield_SpellId()
endfunction
function DivinityShield_Filter takes nothing returns boolean
return (GetUnitLifePercent( GetFilterUnit()) < 50) and (GetWidgetLife(GetFilterUnit()) >0) and (IsUnitAlly( GetFilterUnit(), bj_groupEnumOwningPlayer )) and (GetDamageFactorByOptions(GetTriggerUnit(),GetFilterUnit(),bj_forLoopAIndex)!=0 )
endfunction
function DivinityShield_Heal takes nothing returns nothing
local unit u=udg_currentcaster
local unit t=bj_lastCreatedUnit
local integer s=udg_currentabi
local integer l=R2I( udg_castervars[10] )
local effect fx=bj_lastCreatedEffect
local group ignore=bj_groupRemoveGroupDest
call UnitMoveToUnitAsProjectile( u, 0.1, t, 30)
call DestroyEffect( AddSpellEffectTargetById( s, EFFECT_TYPE_TARGET, t, "origin" ) )
call DamageUnitByOptions( u,t,-DivinityShield_HPHeal(l),DivinityShield_HealOptions(l) )
call GroupRemoveUnit(ignore, t)
call DestroyEffect(fx)
set udg_delayhack=5
call RecicleCasterAfterCast(u,0)
set udg_delayhack=0
set u=null
set t=null
set fx=null
set ignore=null
endfunction
function Trig_DivinityShield_Actions takes nothing returns nothing
local unit caster=GetTriggerUnit()
local unit array elec
local effect array fx
local timer t=CreateTimer()
local real grad=0
local integer s=GetSpellAbilityId()
local integer a=0
local integer l=GetUnitAbilityLevel(caster, s)
local integer n=DivinityShield_LightsNumber(l)
local real hpheal=DivinityShield_HPHeal(a)
local real waitt=0
local group ignore=CreateGroup()
local group tolight=CreateGroup()
local boolexpr fil=Condition(function DivinityShield_Filter)
local unit picked
call TimerStart( t, DivinityShield_Duration(a), false, null)
set a=0
loop
exitwhen a>=n
set elec[a]=GetACaster()
set fx[a]= AddSpellEffectTargetById( s, EFFECT_TYPE_SPECIAL,elec[a],"overhead")
call SetUnitOwner( elec[a], GetOwningPlayer(caster), true)
call SetUnitPosition( elec[a], GetUnitX(caster), GetUnitY(caster) )
call SetUnitMoveSpeed( elec[a],400)
set a=a+1
endloop
loop
exitwhen (TimerGetRemaining(t)<=0) or (IsUnitDeadBJ(caster)) or n <= 0
call TriggerSleepAction(0)
set a=0
set bj_groupEnumOwningPlayer=GetOwningPlayer(caster)
call GroupClear(tolight)
set bj_forLoopAIndex=DivinityShield_HealOptions(l)
call GroupEnumUnitsInRange( tolight, GetUnitX(caster), GetUnitY(caster), DivinityShield_Area(l), fil )
loop
exitwhen a>=n
set picked=FirstOfGroup(tolight)
if picked !=null and TimerGetElapsed(t) >= waitt then
if not IsUnitInGroup(picked, ignore) then
set bj_lastCreatedEffect=fx[a]
set bj_lastCreatedUnit=picked
set udg_currentcaster=elec[a]
call GroupRemoveUnit( tolight, picked)
call GroupAddUnit( ignore, picked)
set udg_currentabi=s
set udg_castervars[10]=l
set bj_groupRemoveGroupDest=ignore
call ExecuteFunc("DivinityShield_Heal")
set waitt=TimerGetElapsed(t)+DivinityShield_HealDelay(l)
set elec[a]=elec[n-1]
set elec[n-1]=null
set fx[a]=fx[n-1]
set fx[n-1]=null
set n=n-1
else
call GroupRemoveUnit( tolight, picked)
endif
else
call IssuePointOrder(elec[a],"smart", GetUnitX(caster)+150*CosBJ(grad+a*360/n), GetUnitY(caster)+150*SinBJ(grad+a*360/n))
set a=a+1
endif
endloop
set grad = ModuloReal(grad+30,360)
endloop
call DestroyTimer(t)
call DestroyGroup(tolight)
call DestroyGroup(ignore)
call DestroyBoolExpr(fil)
set t=null
set tolight=null
set fil=null
set a=0
loop
exitwhen a>=n
call DestroyEffect( fx[a] )
call RecicleCaster(elec[a])
set fx[a]=null
set elec[a]=null
set a=a+1
endloop
set ignore=null
endfunction
//===========================================================================
function InitTrig_Shield_of_divinity takes nothing returns nothing
set gg_trg_Shield_of_divinity = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shield_of_divinity, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shield_of_divinity, Condition( function Trig_DivinityShield_Conditions ) )
call TriggerAddAction( gg_trg_Shield_of_divinity, function Trig_DivinityShield_Actions )
endfunction
//**************************************************************************************************
//*
//* Charge
//*
//* Requires:
//* -The Charge Ability
//* -The Caster System
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/units)
//*
//* Art:
//* - The Ability's Caster Art model is attached to the caster during charge.
//*
//**************************************************************************************************
//==================================================================================================
// Charge Spell Configuration:
//
constant function ChargeAbilityId takes nothing returns integer
return 'A01M' //* Charge's Ability RawCode (It changes betwen maps)
endfunction
constant function Charge_PassiveBonus takes nothing returns integer
return 'A00Q' //* Charge's Speed Improvement Ability RawCode (It changes betwen maps)
endfunction
constant function Charge_Damage takes real level returns real
return 50+level*20
endfunction
constant function Charge_Area takes real level returns real
return 200+20*level
endfunction
function Charge_DamageOptions takes real level returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FORCE) + DamageException(UNIT_TYPE_STRUCTURE,0)
// Will Do Force (phisical) damage, that won't affect structures
// See the caster system readme for more info
endfunction
//==================================================================================================
function Trig_Charge_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ChargeAbilityId()
endfunction
function Trig_Charge_Actions takes nothing returns nothing
local location target=GetSpellTargetLoc()
local integer t=0
local trigger end=CreateTrigger()
local unit horseman=GetTriggerUnit()
local location loc=GetUnitLoc(horseman)
local integer l=GetUnitAbilityLevel( horseman, ChargeAbilityId())
local effect shock=AddSpellEffectTargetById(ChargeAbilityId(), EFFECT_TYPE_CASTER,horseman,"origin")
local timer dur=CreateTimer()
local real next=0
local unit da=null
local unit db=null
local integer h=GetTerrainCliffLevelBJ(loc)
call TimerStart( dur, 1000000, false, null)
call UnitRemoveBuffs(horseman, true, true)
call UnitAddAbility(horseman, Charge_PassiveBonus() )
call SetUnitPathing( horseman, false )
call SetUnitAcquireRangeBJ( horseman, 0.01 )
call TriggerRegisterUnitEvent( end, horseman, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterUnitEvent( end, horseman, EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterUnitEvent( end, horseman, EVENT_UNIT_ISSUED_ORDER )
call TriggerRegisterUnitEvent( end, horseman, EVENT_UNIT_DEATH )
loop
if GetTerrainCliffLevel( GetUnitX(horseman), GetUnitY(horseman) ) != h then
call SetUnitPositionLoc( horseman, loc)
endif
call MoveLocation( loc , GetUnitX(horseman), GetUnitY(horseman) )
exitwhen GetTriggerEvalCount(end) > t
exitwhen DistanceBetweenPoints(loc, target) < 50.00
call IssuePointOrderLoc( horseman, "move", target )
set t=t+1
if TimerGetElapsed(dur) >= next then
call DamageUnitsInAOEEx(horseman, Charge_Damage(l), GetUnitX(horseman), GetUnitY(horseman), Charge_Area(l), false, Charge_DamageOptions(l))
call RemoveUnit(db)
set db=da
set da=CreateUnit( Player(15), GetUnitTypeId(horseman), 0,0, GetUnitFacing(horseman))
call UnitAddAbility( da, 'Aloc' )
call SetUnitColor( da, GetPlayerColor( GetOwningPlayer(horseman) ) )
call SetUnitPosition(da, GetUnitX(horseman), GetUnitY(horseman) )
call SetUnitVertexColor(da, 255,255,255,127)
call SetUnitVertexColor(db, 255,255,255,63)
call SetUnitTimeScale( da,0)
set next=next+0.25
endif
call TriggerSleepAction(0)
endloop
call RemoveLocation(loc)
call UnitRemoveAbility(horseman, Charge_PassiveBonus() )
call TriggerSleepAction(0)
call SetUnitPathing( horseman, true )
call SetUnitAcquireRangeBJ( horseman, 500.00 )
call RemoveUnit(db)
call TriggerSleepAction(0)
call RemoveUnit(da)
call DestroyTimer(dur)
call DestroyEffect(shock)
call RemoveLocation(target)
call DestroyTrigger(end)
set shock=null
set target=null
set loc=null
set horseman=null
set end=null
set dur=null
set da=null
set db=null
endfunction
//==================================================================================================
function InitTrig_Charge takes nothing returns nothing
set gg_trg_Charge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Charge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Charge, Condition( function Trig_Charge_Conditions ) )
call TriggerAddAction( gg_trg_Charge, function Trig_Charge_Actions )
endfunction
//************************************************************************************************
//*
//* Exorcism
//*
//* Requires:
//* - The Caster System
//* -The Exorcism Ability
//* -This Trigger (make sure the Configuration Section is pointing to
//* the right abilities/units)
//*
//* Optional:
//* - war3mapImported\BTNExorcism.blp icon
//* - ReplaceableTextures\CommandButtonsDisabled\DISBTNExorcism.blp icon
//*
//* Art:
//* - The Effect Art is shown on the target area
//* - The Target Art is attached to the affected units
//* - The Special Art appears if the affected unit dies.
//*
//************************************************************************************************
//================================================================================================
// Exorcism Spell Configuration:
//
constant function Exorcism_AbilityId takes nothing returns integer
return 'A00U'
endfunction
constant function Exorcism_Damage takes integer level returns real
return 2.00 * level + 3
endfunction
constant function Exorcism_AffectedClass takes nothing returns unittype
return UNIT_TYPE_UNDEAD
endfunction
function Exorcism_DamageOptions takes integer level returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_DIVINE) + DamageException(UNIT_TYPE_FLYING,0.5)
// Will Do Divine spell damage, and will do half damage over flying units.
// See caster system readme for more info
endfunction
//================================================================================================
function Trig_Exorcism_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Exorcism_AbilityId()
endfunction
function Trig_Exorcism_IsUnitUndead takes nothing returns boolean
return IsUnitType(GetFilterUnit(),Exorcism_AffectedClass())
endfunction
function Trig_Exorcism_Actions takes nothing returns nothing
local location target=GetSpellTargetLoc()
local group victims=GetUnitsInRangeOfLocMatching(100.00, target, Condition(function Trig_Exorcism_IsUnitUndead))
local unit caster=GetTriggerUnit()
local unit pickedunit
local integer l=GetUnitAbilityLevel( caster, Exorcism_AbilityId() )
local real X=Exorcism_Damage(l)
local real Y
local integer do=Exorcism_DamageOptions(l)
call RemoveLocation( target)
loop
set pickedunit=FirstOfGroup(victims)
exitwhen pickedunit==null
call GroupRemoveUnit( victims, pickedunit)
set Y = RMinBJ(( GetUnitState( caster, UNIT_STATE_MANA) * X ), GetWidgetLife( pickedunit))
if Y > 0 then
call SetUnitManaBJ( caster, GetUnitState( caster, UNIT_STATE_MANA) - Y/X )
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_TARGET , pickedunit, "origin"))
call DamageUnitByOptions(caster, pickedunit,Y,do)
if IsUnitDeadBJ(pickedunit ) then
call DestroyEffect( AddSpellEffectTargetById( GetSpellAbilityId(), EFFECT_TYPE_SPECIAL , pickedunit, "origin"))
endif
endif
endloop
call DestroyGroup(victims)
set caster = null
set pickedunit=null
set victims=null
set target=null
endfunction
//===========================================================================
function InitTrig_Exorcism takes nothing returns nothing
set gg_trg_Exorcism = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Exorcism, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Exorcism, Condition( function Trig_Exorcism_Conditions ) )
call TriggerAddAction( gg_trg_Exorcism, function Trig_Exorcism_Actions )
endfunction