//==============================================================================================
// Some standard JASS functions used in JASS spells: Damage System for Tornado Barrier, Power Bash and other spells
//==============================================================================================
function H2I takes handle h returns integer
return GetHandleId(h)
// return 0
endfunction
function H2S takes handle h returns string
return I2S(H2I(h))
endfunction
//==============================================================================================
function LocalVars takes nothing returns gamecache
if udg_hash == null then
call FlushGameCache(InitGameCache("udg_hash"))
set udg_hash = InitGameCache("udg_hash")
endif
return udg_hash
endfunction
function SetHandleTriggerAction takes agent subject, string label, triggeraction value returns nothing
if (value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveTriggerActionHandle(udg_FHV_Table, GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleTextTag takes agent subject, string label, texttag value returns nothing
if (value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveTextTagHandle(udg_FHV_Table, GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleLightning takes agent subject, string label, lightning value returns nothing
if (value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveLightningHandle(udg_FHV_Table, GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleHandle takes agent subject,string label,agent value returns nothing
if ( value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveAgentHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleInt takes agent subject,string label,integer value returns nothing
if value == 0 then
call RemoveSavedInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleBoolean takes agent subject,string label,boolean value returns nothing
if ( value == false ) then
call RemoveSavedBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleReal takes agent subject,string label,real value returns nothing
if ( value == 0.0 ) then
call RemoveSavedReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction
function SetHandleString takes agent subject,string label,string value returns nothing
if ( ( value == "" ) or ( value == null ) ) then
call RemoveSavedString(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveStr(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value) //yay for blizz' consistent naming scheme...
endif
endfunction
function GetHandleHandle takes agent subject,string label returns agent
call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
return null
endfunction
function GetHandleInt takes agent subject,string label returns integer
return LoadInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleBoolean takes agent subject,string label returns boolean
return LoadBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleString takes agent subject,string label returns string
return LoadStr(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleReal takes agent subject,string label returns real
return LoadReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleWidget takes agent subject,string label returns widget
return LoadWidgetHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleUnit takes agent subject,string label returns unit
return LoadUnitHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleTimer takes agent subject,string label returns timer
return LoadTimerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleTrigger takes agent subject,string label returns trigger
return LoadTriggerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleTriggerAction takes agent subject,string label returns triggeraction
return LoadTriggerActionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleGroup takes agent subject,string label returns group
return LoadGroupHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleEffect takes agent subject,string label returns effect
return LoadEffectHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleTextTag takes agent subject,string label returns texttag
return LoadTextTagHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleLightning takes agent subject,string label returns lightning
return LoadLightningHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function GetHandleDestructable takes agent subject,string label returns destructable
return LoadDestructableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction
function FlushHandleVars takes agent subject returns nothing
call FlushChildHashtable(udg_FHV_Table , GetHandleId(subject))
endfunction
function FlushHandleLocals takes agent subject returns nothing
call FlushHandleVars(subject)
endfunction
// new functions above replacing old ones -------------------------------------------------------------------------
//=============================================================================================
// This are some new functions needed for some dota spells - Fissure
//=============================================================================================
// Check if your x location is safe, else return a safe one
function SafeX takes real x returns real
if x < udg_Game_MinX then
return udg_Game_MinX
elseif x > udg_Game_MaxX then
return udg_Game_MaxX
endif
return x
endfunction
// Check if your y location is safe, else return a safe one
function SafeY takes real y returns real
if y < udg_Game_MinY then
return udg_Game_MinY
elseif y > udg_Game_MaxY then
return udg_Game_MaxY
endif
return y
endfunction
// A few simple guys I use all too often
// Angle between units and reals
function ABPXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1))*57.29583
endfunction
//====================================================================================
// Shield System
// By Shadow1500
// HandleVars by KaTTaNa
// configuration
constant function BarColor takes nothing returns string
return "|cFF8000FF"
endfunction
constant function BarChar takes nothing returns string
return "'"
endfunction
constant function BarLength takes nothing returns integer
return 20
endfunction
constant function BarSize takes nothing returns real
return 12.50
endfunction
constant function BarOffset takes nothing returns real
return -32.00
endfunction
constant function BarOffsetY takes nothing returns real
return -42.00
endfunction
constant function DeadFixerAbility takes nothing returns integer
return 'A0CM'
endfunction
constant function AllowDamageSpill takes nothing returns boolean
return true
endfunction //if true then when the shield breaks it will only block some of the damage done depending on its HP
// end configuration
function DamageModify_Child takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
if GetHandleBoolean(t,"fix") then
call UnitRemoveAbility( u, DeadFixerAbility() )
endif
call SetUnitState(u ,UNIT_STATE_LIFE, GetHandleReal(t,"finalhp") )
set u = null
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
endfunction
// This function will "block" a certain amount of damage done to the unit
// Needs to be used in the EVENT_UNIT_DAMAGED event.
function DamageModify takes unit whichUnit, real dmg, real dmgnew returns nothing
local timer t = CreateTimer()
local real life = GetUnitState(whichUnit, UNIT_STATE_LIFE)
local real maxlife = GetUnitState(whichUnit, UNIT_STATE_MAX_LIFE)
local boolean usetimer = false
local real dmgback = dmg-dmgnew
local real finalhp = life-dmgnew
if dmgnew>dmg then
return
endif
if dmg > maxlife then
call UnitAddAbility( whichUnit,DeadFixerAbility())
call SetHandleBoolean(t, "fix", true)
set maxlife = 1000+maxlife
set usetimer = true
endif
if ( life+dmgback > maxlife ) then
call SetUnitState(whichUnit ,UNIT_STATE_LIFE, maxlife )
set usetimer = true
else
call SetUnitState(whichUnit ,UNIT_STATE_LIFE, life+dmgback )
endif
if usetimer then
call SetHandleHandle(t,"u",whichUnit)
call SetHandleReal(t,"finalhp",finalhp)
call TimerStart(t, 0, false, function DamageModify_Child)
else
call DestroyTimer(t)
endif
set t = null
endfunction
function UpdateBar takes unit whichUnit returns nothing
local string bar = GetHandleString(whichUnit,"scolor")
local integer y = 0
local real slife = GetHandleReal(whichUnit,"slife")
local real maxslife = GetHandleReal(whichUnit,"maxslife")
local boolean endc = false
loop
exitwhen y==BarLength()
if (not endc) and (slife < (y * (maxslife/BarLength()))+1) then
set endc = true
set bar = bar+"|r|cFF000000"
else
set bar = bar+BarChar()
endif
set y = y + 1
endloop
set bar = bar+"|r"
call SetTextTagTextBJ(GetHandleTextTag(whichUnit,"lifebar"),bar,BarSize())
endfunction
function DestroyShield takes unit whichUnit returns nothing
local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
local trigger trig = GetHandleTrigger(whichUnit,"shielddmg")
local timer t = GetHandleTimer(whichUnit,"shieldtimer")
call SetHandleBoolean(whichUnit,"sd",false)
// destroy shield
call UnitRemoveAbility(whichUnit,GetHandleInt(t,"buff"))
call SetHandleReal(whichUnit,"slife",0)
call SetHandleReal(whichUnit,"maxslife",0)
call SetHandleReal(whichUnit,"reg",0)
call SetHandleReal(whichUnit,"sarmor",0)
call SetHandleString(whichUnit,"scolor",null)
// destroy tag
call DestroyTextTag(tag)
call SetHandleHandle( whichUnit, "lifebar", null )
set tag = null
// destoy trigger
call SetHandleHandle(whichUnit,"shielddmg",null)
call TriggerRemoveAction(trig,GetHandleTriggerAction(trig,"action"))
call FlushHandleLocals(trig)
call DestroyTrigger(trig)
set trig = null
// destroy timer
call SetHandleHandle(whichUnit,"shieldtimer",null)
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
endfunction
function ShieldDamage takes nothing returns nothing
local unit u = GetTriggerUnit()
local real dmg = GetEventDamage()
local real slife = GetHandleReal(u,"slife")
local real take = 1-GetHandleReal(u,"sarmor")
if GetTriggerEventId() == EVENT_UNIT_DEATH then
call DestroyShield(u)
set u = null
return
endif
if (slife<(dmg*take)) then
if GetHandleBoolean(u,"sd") then
call DestroyShield(u)
else
call SetHandleReal(u,"slife",0)
endif
if AllowDamageSpill() then
call DamageModify(u,dmg,dmg-(slife*(1/take))) // use the remaining power of the shield to block some of the damage
else
call DamageModify(u,dmg,0)
endif
else
call DamageModify(u,dmg,0) // block all damage
call SetHandleReal(u,"slife",slife-(dmg*take))
call UpdateBar(u)
endif
set u = null
endfunction
function CreateShield_Child takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit whichUnit = GetHandleUnit(t,"u")
local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
local real x = GetUnitX(whichUnit)+BarOffset()
local real y = GetUnitY(whichUnit)+BarOffsetY()
local integer pulse = GetHandleInt(t,"pulse")
local real upcheck = GetHandleReal(t,"check")
local real reg = GetHandleReal(whichUnit,"reg")
local real slife = GetHandleReal(whichUnit,"slife")
local real maxslife = GetHandleReal(whichUnit,"maxslife")
local integer buffId = GetHandleInt(t,"buff")
if (GetHandleBoolean(whichUnit,"sd") and pulse==0) or ((GetUnitAbilityLevel(whichUnit,buffId)==0) and buffId!=0) then
call DestroyShield(whichUnit)
set t = null
return
endif
if reg!=0 then
if (slife+reg)>=maxslife then
call SetHandleReal(whichUnit,"slife",maxslife)
else
call SetHandleReal(whichUnit,"slife",slife+reg)
endif
call UpdateBar(whichUnit)
elseif upcheck!=GetHandleReal(whichUnit,"slife") then
call SetHandleReal(t,"check",GetHandleReal(whichUnit,"slife"))
call UpdateBar(whichUnit)
endif
// countdown on how many times did timer ran
if pulse>0 then
call SetHandleInt(t,"pulse",pulse-1)
endif
call SetTextTagPos(tag,x,y,140)
call SetTextTagVisibility(tag,IsUnitVisible(whichUnit,GetLocalPlayer()))
set whichUnit = null
set tag = null
set t = null
endfunction
function CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill returns nothing
// duration of -1 = shield remains on unit when depleted
// duration of 0 = shield stays on unit until depleted
// duration of 1 or higher = shield stays until depleted or until duration ends
// buffId is optional
// regenerate is the amount of points regenerated every second
// armor must be between 0 and 1, with 1 making the shield take no damage
// color must in blizzard's color code format
// when dmgspill is off the shield will block all damage when depleted
local texttag tag = GetHandleTextTag( target, "lifebar")
local trigger whenDamaged = GetHandleTrigger(target,"shielddmg")
local timer t = GetHandleTimer(target,"shieldtimer")
local boolean useOld = false
local real x = GetUnitX(target)+BarOffset()
local real y = GetUnitY(target)+BarOffsetY()
if GetHandleReal(target,"slife")!=0 then
if GetHandleInt(t,"buff")!=buffId then
call UnitRemoveAbility(target,GetHandleInt(t,"buff"))
endif
call PauseTimer(t)
call SetHandleReal(target,"reg",0)
call SetHandleReal(target,"sarmor",0)
call SetHandleString( target, "scolor", null)
call DestroyTextTag(tag)
set useOld = true
else
set t = CreateTimer()
set whenDamaged = CreateTrigger()
endif
set tag = CreateTextTag()
call SetHandleReal( target, "slife", shieldhp)
call SetHandleReal( target, "maxslife", shieldhp)
call SetHandleString( target, "scolor", color)
// take care of the texttag
call SetTextTagTextBJ(tag,"tag",BarSize())
call SetTextTagPos(tag,x,y,140)
call SetTextTagPermanent(tag,true)
call SetTextTagColor(tag,255,255,255,255)
call SetTextTagVisibility(tag,IsUnitVisible(target,GetLocalPlayer()))
call SetHandleTextTag( target, "lifebar", tag )
call UpdateBar(target)
// take care of the trigger
if not useOld then
call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DAMAGED)
call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DEATH)
call SetHandleTriggerAction(whenDamaged,"action",TriggerAddAction(whenDamaged,function ShieldDamage))
call SetHandleHandle(target,"shielddmg",whenDamaged)
endif
call SetHandleBoolean( whenDamaged, "dmgspill", dmgspill)
// take care of the timer
call SetHandleHandle( target, "shieldtimer", t)
call SetHandleHandle( t,"u",target)
call SetHandleReal( t, "check", shieldhp)
if regenerate!=0 then
call SetHandleReal(target,"reg",(regenerate)/(1/0.04))
endif
if armor!=0 then
call SetHandleReal(target,"sarmor",armor)
endif
call SetHandleInt(t,"pulse",-1)
if duration>=0 then
call SetHandleBoolean( target, "sd", true)
if duration>0 then
call SetHandleInt(t,"pulse",R2I(duration/0.04))
endif
endif
call SetHandleInt(t,"buff",buffId)
call TimerStart(t,0.04,true,function CreateShield_Child)
set whenDamaged = null
set t = null
set tag = null
endfunction
function CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor returns nothing
call CreateShieldEx( target, shieldhp, duration, buffId, regenerate, armor, BarColor(), AllowDamageSpill())
endfunction
function CreateShieldSimple takes unit target, real shieldhp, real duration, integer buffId returns nothing
call CreateShieldEx( target, shieldhp, duration, buffId, 0, 0, BarColor(), AllowDamageSpill())
endfunction
//===================================================================================================
// The next is for Barrier spells or Plasma shield
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction
function RoundR2I takes real r returns integer
return R2I(r+0.5)
endfunction
function IsIntDivisible takes integer int, integer divisor returns boolean
local integer i = int/divisor
local real r = I2R(int)/I2R(divisor)
if i == r then
return true
endif
return false
endfunction
function FadingText takes string msg, integer red, integer green, integer blue, real x, real y, real spd, real fadetime, real life returns nothing
local texttag t=CreateTextTag()
call SetTextTagText(t,msg,0.024)
call SetTextTagPos(t,x,y, 0.00)
call SetTextTagColor(t,red,green,blue,255)
call SetTextTagVelocity(t,0,spd)
call SetTextTagVisibility(t, true)
call SetTextTagFadepoint(t, fadetime)
call SetTextTagLifespan(t, life)
call SetTextTagPermanent(t, false)
set t=null
endfunction
function Chance takes integer chance returns boolean
return chance>=GetRandomInt(1, 100)
endfunction
function Msg takes string msg returns nothing
call DisplayTextToPlayer(Player(0), 0, 0, msg)
endfunction
//===========================================================================
//===========================================================================
//new functions for the boomerang
constant function Caster_UnitId takes nothing returns integer
return 'e018'
endfunction
constant function Caster_DefaultAttackType takes nothing returns attacktype
return ATTACK_TYPE_NORMAL
endfunction
constant function Caster_DefaultDamageType takes nothing returns damagetype
return DAMAGE_TYPE_NORMAL
endfunction
function DamageTreeDetectorId takes nothing returns integer
return 'Aeat'
endfunction
function CS_H2I takes handle h returns integer
return GetHandleId(h)
endfunction
function CS_Rawcode2Real takes integer i returns real
return i
endfunction
function CS_LoadRawcodeFromReal takes integer n returns integer
return udg_castervars[n]
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 CasterCastAbilityEx takes player owner, real x, real y, real z, integer abilid, integer level, string order, widget target, real delay returns unit
local unit caster=GetACaster()
local boolean done=false
call SetUnitOwner(caster,owner,false)
call UnitAddAbility(caster,abilid)
call SetUnitAbilityLevel(caster,abilid,level)
call SetUnitPosition(caster,x,y)
call SetUnitFlyHeight(caster,z,0)
if S2I(order) != 0 then
set done=IssueTargetOrderById(caster,S2I(order),target)
else
set done=IssueTargetOrder(caster,order,target)
endif
if (delay<=0) or not (done) then
call UnitRemoveAbility(caster,abilid)
call RecicleCaster(caster)
else
call RecicleCasterAfterCastEx(caster,delay,abilid,true)
endif
set udg_currentcaster=caster
set caster=null
return udg_currentcaster
endfunction
function CasterCastAbilityExLoc takes player owner, location loc, real z, integer abilid, integer level, string order, widget target, real delay returns unit
return CasterCastAbilityEx(owner,GetLocationX(loc),GetLocationY(loc),z,abilid,level,order,target,delay)
endfunction
function CasterCastAbilityLevel takes player owner, integer abilid, integer level, string order, widget target, boolean instant returns unit
local real x
local real y
local real d
if udg_sourcehack!=null then
set x=GetLocationX(udg_sourcehack)
set y=GetLocationY(udg_sourcehack)
else
set x=GetWidgetX(target)
set y=GetWidgetY(target)
endif
if instant then
set d=udg_delayhack+0.01
else
set d=0
endif
return CasterCastAbilityEx(owner,x,y,0,abilid,level,order,target,d)
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 CasterCastAbilityPointEx takes player owner, real x1, real y1, real z1, integer abilid, integer level, string order, real x2, real y2, real delay returns unit
local unit caster=GetACaster()
call SetUnitOwner(caster,owner,false)
call UnitAddAbility(caster,abilid)
call SetUnitAbilityLevel(caster,abilid,level)
call SetUnitPosition(caster,x1,y1)
call SetUnitFlyHeight(caster,z1,0)
if S2I(order) != 0 then
if not IssuePointOrderById(caster,S2I(order),x2,y2) then
call IssueImmediateOrderById(caster,S2I(order))
endif
else
if not IssuePointOrder(caster,order,x2,y2) then
call IssueImmediateOrder(caster,order)
endif
endif
if (delay<=0) then
call UnitRemoveAbility(caster,abilid)
call RecicleCaster(caster)
else
call RecicleCasterAfterCastEx(caster,delay,abilid,true)
endif
set udg_currentcaster=caster
set caster=null
return udg_currentcaster
endfunction
function CasterCastAbilityPointExLoc takes player owner, location loc1, real z1, integer abilid, integer level, string order, location loc2, real delay returns unit
return CasterCastAbilityPointEx(owner,GetLocationX(loc1),GetLocationY(loc1),z1,abilid,level,order,GetLocationX(loc2),GetLocationY(loc2),delay)
endfunction
function CasterCastAbilityLevelPoint takes player owner, integer abilid, integer level, string order, real x, real y, boolean instant returns unit
local real sx
local real sy
local real d
if udg_sourcehack!=null then
set sx=GetLocationX(udg_sourcehack)
set sy=GetLocationY(udg_sourcehack)
else
set sx=x
set sy=y
endif
if instant then
set d=0
else
set d=udg_delayhack+0.01
endif
return CasterCastAbilityPointEx(owner,sx,sy,0,abilid,level,order,x,y,d)
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]=CS_H2I(attT)
set udg_castervars[101]=CS_H2I(dmgT)
return 1
endfunction
function DamageException takes unittype Exception, real ExceptionFactor returns integer
set udg_castervars[102]=CS_H2I(Exception)
set udg_castervars[103]=ExceptionFactor
return 2
endfunction
function DamageOnlyTo takes unittype ThisUnitType returns integer
set udg_castervars[104]=CS_H2I(ThisUnitType)
return 4
endfunction
constant function DontDamageSelf takes nothing returns integer
return 8
endfunction
constant function DamageTrees takes nothing returns integer
return 16
endfunction
constant function DamageOnlyVisibles takes nothing returns integer
return 32
endfunction
function DamageOnlyEnemies takes nothing returns integer
set udg_castervars[105]=0
return 64
endfunction
function ForceDamageAllies takes nothing returns integer
set udg_castervars[105]=1
return 64
endfunction
function DamageFactorAbility1 takes integer spellid, real factor returns integer
set udg_castervars[106]=CS_Rawcode2Real(spellid)
set udg_castervars[107]=factor
return 128
endfunction
function DamageFactorAbility2 takes integer spellid, real factor returns integer
set udg_castervars[108]=CS_Rawcode2Real(spellid)
set udg_castervars[109]=factor
return 256
endfunction
function DamageFactorAbility3 takes integer spellid, real factor returns integer
set udg_castervars[110]=CS_Rawcode2Real(spellid)
set udg_castervars[111]=factor
return 512
endfunction
function CS_IsUnitVisible takes unit u, player p returns boolean
return IsUnitVisible(u,Player(bj_PLAYER_NEUTRAL_VICTIM)) or IsUnitVisible(u,p)
endfunction
function GetDamageFactor takes unit u,attacktype a, damagetype d returns real
local real hp=GetWidgetLife(u)
local real r
local unit caster=GetACaster()
call UnitRemoveAbility(caster,'Aloc')
call SetUnitPosition(caster,GetUnitX(u),GetUnitY(u))
call SetUnitOwner(caster,GetOwningPlayer(u),false)
call UnitDamagePoint(caster,0,1,GetUnitX(u),GetUnitY(u),0.01,true,false,a,d,null)
call RecicleCaster(caster)
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
local integer d=DamageOptions
if d>=512 then
if GetUnitAbilityLevel(target,CS_LoadRawcodeFromReal(110))>0 then
set r=r*udg_castervars[111]
endif
set d=d-512
endif
if d>=256 then
if GetUnitAbilityLevel(target,CS_LoadRawcodeFromReal(108))>0 then
set r=r*udg_castervars[109]
endif
set d=d-256
endif
if d>=128 then
if GetUnitAbilityLevel(target,CS_LoadRawcodeFromReal(106))>0 then
set r=r*udg_castervars[107]
endif
set d=d-128
endif
if d>=64 then
if (udg_castervars[105]==0) and IsUnitAlly(target,GetOwningPlayer(hurter)) then
return 0.0
endif
set d=d-64
endif
if d>=32 then
set d=d-32
if not CS_IsUnitVisible(target,GetOwningPlayer(hurter)) then
return 0.0
endif
endif
if d>=16 then
set d=d-16
endif
if d>=8 then
set d=d-8
if hurter==target then
return 0.0
endif
endif
if d>=4 then
set d=d-4
if not IsUnitType(target,ConvertUnitType(R2I(udg_castervars[104]))) then
return 0.0
endif
endif
if d>=2 then
set d=d-2
if IsUnitType(target,ConvertUnitType(R2I(udg_castervars[102]))) then
set r=r*udg_castervars[103]
endif
endif
if d>=1 then
set d=d-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 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]=CS_H2I(attT)
set udg_castervars[4]=CS_H2I(dmgT)
set udg_currenthurter=hurter
call ExecuteFunc("UnitDamageUnitTimed_Child")
set udg_currentcaster=c
set c=null
endfunction
function SetDamageOptions_i takes gamecache g, integer n, integer DamageOptions returns nothing
local string key="DOPT"+I2S(n)
local integer d=DamageOptions
call StoreInteger(g,key,"value",d)
if d>=512 then
call StoreInteger(g,key,"ab3",CS_LoadRawcodeFromReal(110))
call StoreReal(g,key,"fc3",udg_castervars[111])
set d=d-512
endif
if d>=256 then
call StoreInteger(g,key,"ab2",CS_LoadRawcodeFromReal(108))
call StoreReal(g,key,"fc2",udg_castervars[109])
set d=d-256
endif
if d>=128 then
call StoreInteger(g,key,"ab1",CS_LoadRawcodeFromReal(106))
call StoreReal(g,key,"fc1",udg_castervars[107])
set d=d-128
endif
if d >= 64 then
set d=d-64
call StoreBoolean(g,key,"allied",(udg_castervars[105]==1))
endif
if d >= 32 then
set d=d-32
endif
if d >= 16 then
set d=d-16
endif
if d >= 8 then
set d=d-8
endif
if d >= 4 then
call StoreInteger(g,key,"only",R2I(udg_castervars[104]))
set d=d-4
endif
if d >= 2 then
call StoreInteger(g,key,"excp",R2I(udg_castervars[102]))
call StoreReal(g,key,"excf",udg_castervars[103])
set d=d-2
endif
if d >= 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(LocalVars(),id,DamageOptions)
endfunction
function CreateDamageOptions takes integer DamageOptions returns integer
local gamecache g=LocalVars()
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(LocalVars(),"DOPT"+I2S(id))
endfunction
function LoadDamageOptions takes integer id returns integer
local gamecache g=LocalVars()
local string key="DOPT"+I2S(id)
local integer opt=GetStoredInteger(g,key,"value")
local integer v=opt
if v>=512 then
set udg_castervars[110]=CS_Rawcode2Real(GetStoredInteger(g,key,"ab3"))
set udg_castervars[111]=GetStoredReal(g,key,"fc3")
set v=v-512
endif
if v>=256 then
set udg_castervars[108]=CS_Rawcode2Real(GetStoredInteger(g,key,"ab2"))
set udg_castervars[109]=GetStoredReal(g,key,"fc2")
set v=v-256
endif
if v>=128 then
set udg_castervars[106]=CS_Rawcode2Real(GetStoredInteger(g,key,"ab1"))
set udg_castervars[107]=GetStoredReal(g,key,"fc1")
set v=v-128
endif
if v >= 64 then
set v=v-64
set udg_castervars[105]=IntegerTertiaryOp(GetStoredBoolean(g,key,"allied"),1,0)
endif
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 group affected
local unit p
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
call DamageUnitByOptions(hurter,p,damage,DamageOptions)
call GroupRemoveUnit(affected,p)
endloop
call DestroyGroup(affected)
set affected=null
set p=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()
local integer d=DamageOptions
set bj_groupEnumOwningPlayer=GetOwningPlayer(hurter)
if d>=512 then
set d=d-512
endif
if d>=256 then
set d=d-256
endif
if d>=128 then
set d=d-128
endif
if d>=64 then
set affectallied=(udg_castervars[105]==1)
set d=d-64
endif
if d>=32 then
set d=d-32
endif
if d>=16 then
call DamageTreesInCircle(x,y,radius)
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 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)
local integer a1=0
local integer a2=0
local integer a3=0
local real f1=udg_castervars[107]
local real f2=udg_castervars[109]
local real f3=udg_castervars[111]
if f1!=1 then
set a1=CS_LoadRawcodeFromReal(106)
endif
if f2!=1 then
set a2=CS_LoadRawcodeFromReal(108)
endif
if f3!=1 then
set a3=CS_LoadRawcodeFromReal(110)
endif
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 CS_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 (a1!=0) and (GetUnitAbilityLevel(picked,a1)>0) then
set D=D*f1
endif
if (a2!=0) and (GetUnitAbilityLevel(picked,a2)>0) then
set D=D*f2
endif
if (a3!=0) and (GetUnitAbilityLevel(picked,a3)>0) then
set D=D*f3
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
local integer v=DamageOptions
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
if v >= 512 then
set v=v-512
else
set udg_castervars[111]=0
endif
if v >= 256 then
set v=v-256
else
set udg_castervars[109]=0
endif
if v >= 128 then
set v=v-128
else
set udg_castervars[107]=0
endif
if v >= 64 then
set v=v-64
set udg_castervars[4]=udg_castervars[105]
else
set udg_castervars[4]=IntegerTertiaryOp(affectallies,1,0)
endif
if v >= 32 then
set udg_castervars[12]=1
set v=v-32
else
set udg_castervars[12]=0
endif
if v >= 16 then
set udg_castervars[11]=1
set v=v-16
else
set udg_castervars[11]=0
endif
if v >= 8 then
set udg_castervars[5]=0
set v=v-8
else
set udg_castervars[5]=1
endif
if v >= 4 then
set udg_castervars[6]=udg_castervars[104]
set v=v-4
else
set udg_castervars[6]=-1
endif
if v >= 2 then
set udg_castervars[7]=udg_castervars[102]
set udg_castervars[8]=damage*udg_castervars[103]
set v=v-2
else
set udg_castervars[7]=-1
set udg_castervars[8]=-1
endif
if v >= 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 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 V=CreateDamageOptions(R2I(udg_castervars[5]))
local unit hurter=udg_currenthurter
call UnitMoveToAsProjectile(m,bj_meleeNearestMineDist,udg_castervars[0],udg_castervars[1],udg_castervars[2])
call DestroyEffect(fx)
call DamageUnitsInAOEEx(hurter,damage,x2,y2,aoeradius,affectallied,LoadDamageOptions(V))
call DestroyDamageOptions(V)
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
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 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]=CS_H2I(attT)
set udg_castervars[6]=CS_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
Name | Type | is_array | initial_value |
A_ActiveSpells | integer | No | |
A_AllBirdsGroup | group | No | |
A_AttackedUnits | group | No | |
A_Birds | unit | Yes | |
A_FinalTarget | unit | No | |
A_GeneralInteger | integervar | Yes | |
A_Hero | unit | Yes | |
A_HeroesGroup | group | No | |
A_Level | integer | Yes | |
A_MUIInteger | integer | No | |
A_RadReal | real | No | |
A_TargetGroups | group | Yes | |
A_TempPoint | location | Yes | |
A_TravelingBirds | group | No | |
AbilityAtribute | abilcode | Yes | |
AbilityFragFire1 | abilcode | No | |
AbilityFragFire2 | abilcode | No | |
AbilityLaserCannon1 | abilcode | No | |
AbilityLaserCannon2 | abilcode | No | |
AbilityMachineGun1 | abilcode | No | |
AbilityMachineGun2 | abilcode | No | |
AbilityOvergrowth | abilcode | No | |
AbilitySleep | abilcode | No | |
ActivateLevelsBusy | boolean | No | |
AddedGoldAndLumber | boolean | No | |
All_Shields | group | Yes | |
AllHeroes1 | integer | No | |
AllHeroes2 | integer | No | |
AngleToBlinkTarget | real | Yes | |
AngleToDiveTarget | real | Yes | |
AngleToLeapTarget | real | Yes | |
Ankh | itemcode | No | |
Assassin | unit | Yes | |
AssassinFacing | real | No | |
AvailableDropouts | integer | Yes | |
AverageKillsVoted | real | No | |
Base | unit | Yes | |
BeingPushed | group | Yes | |
Ber_Caster_1 | unit | No | |
Ber_Caster_2 | unit | No | |
BlinkStrikeTimer1 | timer | No | |
BlinkStrikeTimer2 | timer | No | |
BlinkStrikeVictim | unit | Yes | |
BlnCannotPick | boolean | Yes | |
BonusLife | real | No | |
BristlebackPos | location | Yes | |
Butcher | unit | Yes | |
CanMove | boolean | Yes | |
Cast_Effect1 | effect | Yes | |
Cast_Effect2 | effect | Yes | |
casters | group | No | |
castervars | real | Yes | |
CastingRange | real | No | |
Chance | integer | No | |
ChanceToKill | integer | Yes | |
ChanceToWin | integer | No | |
ChanterRange | real | No | |
Clouds_Group | group | Yes | |
CloudsCountAlive | integer | Yes | |
Count | integer | Yes | |
currentabi | integer | No | |
currentcaster | unit | No | |
currenthurter | unit | No | |
DamageImpetus | real | Yes | |
DamageMultiplier | real | No | |
DamageRock | real | Yes | |
DarkConfusionCaster | unit | Yes | |
Deaths | integer | Yes | |
DebugEnabled | boolean | No | |
DeductibleLife | real | Yes | |
delayhack | real | No | |
DistanceBlink | real | Yes | |
DistanceDive | real | Yes | |
DistanceLeap | real | Yes | |
DistanceToVictims | real | Yes | |
Diver | unit | Yes | |
DivingSpot | location | Yes | |
Dropouts1InTeam2 | integer | No | |
Dropouts2InTeam1 | integer | No | |
DummyFearLong | unit | Yes | |
DummyFearMedium | unit | Yes | |
DummyFearShort | unit | Yes | |
Dying_Shield_Group_Int | integer | No | |
DyingUnitAngle | real | No | |
EarthCaster | unit | Yes | |
EarthShaker | unit | Yes | |
EarthTar | unit | Yes | |
Empath | unit | Yes | |
EmpathLifePenalty | real | No | |
EmptySpaces | string | No | |
EmptyUnitGroup | group | No | |
Enchantress | unit | Yes | |
Enchent_Bouns | abilcode | Yes | |
Enchented | unit | Yes | |
EnemiesPercentLife1 | real | No | |
EnemiesPercentLife2 | real | No | |
Exploder | unit | No | |
FearedUnit | unit | Yes | |
FHV_Table | hashtable | No | |
FlashCaster1 | unit | No | |
FlashCaster2 | unit | No | |
FlashPointArray1 | location | Yes | |
FlashPointArray2 | location | Yes | |
FlashRealArray1 | real | Yes | |
FlashRealArray2 | real | Yes | |
FlyingHight | real | No | |
Found | boolean | Yes | |
Found1 | boolean | No | |
Found2 | boolean | No | |
FrozenThroneLife | integer | Yes | |
Gambler | unit | No | |
GamblerKill | boolean | Yes | |
GamblerPlayerName | string | Yes | |
GamblerPlayerNumber | integer | Yes | |
GamblersVictim | unit | Yes | |
Game_MaxX | real | No | |
Game_MaxY | real | No | |
Game_MinX | real | No | |
Game_MinY | real | No | |
GameLength_Int | integer | No | |
GameLengthButton | integer | Yes | |
GameQuery_Dlg | dialog | No | |
GamLenVote | integer | No | |
GamQuer_DlgBtn | button | Yes | |
Gargoyle | unit | Yes | |
GargoyleFacing | real | Yes | |
gc_DTAX_Cache | gamecache | No | |
hash | gamecache | No | |
HasPicked_Bln | boolean | Yes | true |
HelixAffected | group | Yes | |
HellTank | unit | Yes | |
HeroLevel | integer | No | |
Hexed | group | Yes | |
HexMoonbeam | unit | Yes | |
HolyKnight | unit | No | |
IceFortress | unit | No | |
ImpetusTarget | unit | Yes | |
int_cycle_A | integer | No | |
int_cycle_B | integer | No | |
int_cycle_BB | integer | No | |
int_cycle_C | integer | No | |
int_cycle_choose | integer | Yes | |
int_cycle_click | integer | No | |
int_cycle_Clouds1 | integer | No | |
int_cycle_Clouds2 | integer | No | |
int_cycle_D | integer | No | |
int_cycle_D1 | integer | No | |
int_cycle_Die | integer | No | |
int_cycle_E | integer | No | |
int_cycle_E1 | integer | No | |
int_cycle_F | integer | No | |
int_cycle_G | integer | No | |
int_cycle_H | integer | No | |
int_cycle_I | integer | No | |
int_cycle_J | integer | No | |
int_cycle_K | integer | No | |
int_cycle_L | integer | No | |
int_cycle_M | integer | No | |
int_cycle_N | integer | No | |
int_cycle_O | integer | No | |
int_cycle_P | integer | No | |
int_cycle_People1 | integer | No | |
int_cycle_People2 | integer | No | |
int_cycle_Preload | integer | No | |
int_cycle_Q | integer | No | |
int_cycle_R | integer | No | |
int_cycle_S | integer | No | |
int_cycle_Shields1 | integer | No | |
int_cycle_Shields2 | integer | No | |
int_cycle_Sonic | integer | No | |
int_cycle_T | integer | No | |
int_cycle_Taste1 | integer | No | |
int_cycle_Taste2 | integer | No | |
int_cycle_Teeth | integer | No | |
int_cycle_Test | integer | No | |
int_cycle_U | integer | No | |
int_cycle_V | integer | No | |
int_cycle_W | integer | No | |
int_cycle_Webs1 | integer | No | |
int_cycle_Webs2 | integer | No | |
int_cycle_X | integer | No | |
int_cycle_Y | integer | No | |
int_cycle_Z | integer | No | |
Int_HeroLevel | integer | No | |
Interest_Loop | integervar | No | |
InvisibilityLevel | integer | Yes | |
InvisibleUnit | unit | Yes | |
InvulnerableUnit | unit | Yes | |
Justadded1 | unit | No | |
Justadded2 | unit | No | |
Killing_Shield_Group_Int | integer | No | |
KillingPlayer | integer | No | |
KillMoney | integer | No | 300 |
Kills | integer | Yes | |
KnightCreated | boolean | Yes | |
KnightHeroPlaying | boolean | Yes | |
L_EFFECT | effect | No | |
L_TEXT | texttag | No | |
Leaper | unit | Yes | |
LeapingSpot | location | Yes | |
Marine | unit | Yes | |
MarineFling | unit | No | |
MaxNumberHeroes | integer | No | |
MoveVictim | real | Yes | |
Multia | multiboard | No | |
Multib | multiboard | No | |
MultishotCaster | unit | Yes | |
MultishotGroup | group | Yes | |
MyHero | unit | Yes | UnitNull |
Necrolyte | unit | No | |
NeedAnotherHero | trigger | Yes | |
NerubianVictims | group | Yes | |
NerubianWeaver | unit | Yes | |
NetPointArray1 | location | Yes | |
NetPointArray2 | location | Yes | |
NetRealArray1 | real | Yes | |
NetRealArray2 | real | Yes | |
NetUnitArray1 | unit | Yes | |
NetUnitArray2 | unit | Yes | |
NewBornGargoyle | boolean | Yes | |
NewBornHolyKnight | boolean | Yes | |
Nightblade | unit | No | |
NightTimeCheck | boolean | No | |
NumberEnemies1 | integer | No | |
NumberEnemies2 | integer | No | |
PenaltyEnrage | real | No | |
PercentLife | real | No | |
PercentMana | real | No | |
PerditionDamage | real | Yes | |
Perditioner | unit | Yes | |
PerditionOn | boolean | Yes | |
PerditionOrder | ordercode | Yes | |
PerditionOrderNull | ordercode | No | |
PerditionTarget | unit | Yes | |
PerditionTimerAuto1 | timer | Yes | |
PerditionTimerAuto2 | timer | Yes | |
Players1InTeam2 | integer | No | |
Players2InTeam1 | integer | No | |
PlayingClouds1 | unit | Yes | |
PlayingClouds2 | unit | Yes | |
PlayingDropouts | group | Yes | |
PlayingHeroes | group | Yes | |
PlayingShields1 | unit | Yes | |
PlayingShields2 | unit | Yes | |
PlayingWebs1 | unit | Yes | |
PlayingWebs2 | unit | Yes | |
Queen | unit | Yes | |
Queue | integer | Yes | |
QuitterClosed | boolean | Yes | |
QuitterRemoved1 | boolean | No | |
QuitterRemoved2 | boolean | No | |
QuitterTeam1 | boolean | No | |
QuitterTeam2 | boolean | No | |
Random_Item_Alchemy | itemcode | Yes | |
RandomInteger | integer | No | |
RandomInteger1 | integer | No | |
RandomInteger2 | integer | No | |
RandomNumberTo100 | integer | No | |
RandomNumberToKill | integer | Yes | |
Range | real | No | |
Reaper | unit | No | |
RedLightning1 | lightning | Yes | |
RedLightning2 | lightning | Yes | |
Rockinhand | effect | Yes | |
RockTarget | unit | Yes | |
RockTosser | unit | Yes | |
Row | integer | No | |
RushChance | integer | Yes | |
RushPercent | integer | No | |
SamuraiFacing | real | Yes | |
ShieldProtected | group | Yes | |
Shields_Group | group | Yes | |
ShieldsCountAlive | integer | Yes | |
SiegeEngine | unit | Yes | |
Silenced_Group | group | Yes | |
SilenceDummy | unit | Yes | |
SilencedUnit | unit | Yes | |
Siren | unit | No | |
SlotClosed | boolean | Yes | |
SlotRemoved | boolean | No | |
SlowCloud | unit | Yes | |
SmokeRange | real | Yes | |
Sonic_Ability_Level | integer | No | |
Sonic_AoE | real | No | |
Sonic_Base_Damage | real | No | |
Sonic_Caster | unit | No | |
Sonic_Damage_Group | group | No | |
Sonic_Distance | real | No | |
Sonic_Location | location | No | |
Sonic_Loop_Location | location | No | |
Sonic_Loop_Number | integer | No | |
Sonic_Target_Point | location | No | |
Sonic_Total_Damage | real | No | |
sourcehack | location | No | |
Spell_ThunderStorm | abilcode | Yes | |
SpinningGroup | group | No | |
StaticRange | real | No | |
StoneFormGargoyle | boolean | Yes | |
StrDropout | string | No | Dropout |
StrGameLenght | string | No | |
StrGameType | string | No | |
StrKills | string | No | |
StrShooting | string | No | Shooting |
Suicide | integer | Yes | |
SuicideCommand | boolean | No | |
TableName | string | No | |
Tank | unit | Yes | |
TargetConfused | unit | Yes | |
TargetFacing | real | No | |
TargetPosition | location | Yes | |
TeamKills_Int | integer | Yes | |
TeamMoney | integer | Yes | |
TeamOfComputersOnly | boolean | No | |
temp_AllHeroes1 | integer | No | |
temp_AllHeroes2 | integer | No | |
temp_Angle1 | real | No | |
temp_Angle2 | real | No | |
temp_Choose | integer | No | |
temp_Dead | integer | No | |
Temp_Group | group | No | |
Temp_Group_Attackers | group | No | |
Temp_Group_Fortresses | group | No | |
Temp_Group_Invisibles | group | No | |
Temp_Group_Overgrowth | group | No | |
Temp_Group_Paeldryth | group | No | |
Temp_Group_Pick | group | Yes | |
Temp_Group_Protected | group | No | |
Temp_Group_Pulse | group | No | |
Temp_Group_Raise | group | No | |
Temp_Group_Reverse | group | No | |
Temp_Group_Silenced | group | No | |
Temp_Group_Static | group | No | |
Temp_Group_Venom | group | No | |
Temp_Group_Warlocks | group | No | |
Temp_Group_Web | group | No | |
temp_HaveVoted | integer | No | |
temp_InsideCloud1 | boolean | No | |
temp_InsideCloud2 | boolean | No | |
temp_InsideShield1 | boolean | No | |
temp_InsideShield2 | boolean | No | |
temp_InsideWeb1 | boolean | No | |
temp_InsideWeb2 | boolean | No | |
temp_Leaver1 | integer | No | |
temp_Leaver2 | integer | No | |
temp_Mana_Gambler | real | No | |
temp_Mana_Victim | real | No | |
temp_Max | integer | No | |
temp_NmbPlaying | integer | No | |
temp_People1 | integer | No | |
temp_People2 | integer | No | |
temp_Players1 | integer | No | |
temp_Players2 | integer | No | |
Temp_Point | location | No | |
Temp_Point_Aftershock | location | Yes | |
Temp_Point_Assassin | location | No | |
Temp_Point_Detonate | location | No | |
Temp_Point_Facing | location | No | |
Temp_Point_Kill | location | No | |
Temp_Point_Mana | location | No | |
Temp_Point_Necrolyte | location | No | |
Temp_Point_Original | location | No | |
Temp_Point_Paeldryth | location | No | |
Temp_Point_Random | location | No | |
Temp_Point_Repick | location | No | |
Temp_Point_Replica | location | No | |
Temp_Point_Rescue | location | No | |
Temp_Point_Reverse | location | No | |
Temp_Point_Run | location | No | |
Temp_Point_Treant | location | No | |
Temp_Point_Venom | location | No | |
temp_RaiseLevelTime | real | No | |
temp_Random | integer | No | |
temp_Repick | integer | No | |
temp_teamsize | integer | No | |
temp_VictimAngle | real | No | |
temp_VineWallUnit | unit | Yes | |
temp_WaitTime | real | No | |
TempInterger_Agil | integer | No | |
TempInterger_Int | integer | No | |
TempInterger_Str | integer | No | |
TempLoc11 | location | No | |
TempLoc11_Cast | location | No | |
TempLoc12 | location | No | |
TempLoc12_Cast | location | No | |
TempLoc2 | location | No | |
TempLoc4 | location | No | |
TempLoc_Cast2 | location | No | |
TempPoint | location | No | |
test_real | real | No | |
TheChoiceGroup1 | unitcode | Yes | |
TheChoiceGroup2 | unitcode | Yes | |
TheDropoutsGroup | unitcode | Yes | |
TimeImpetus1 | real | No | |
TimeImpetus2 | real | No | |
TimeLapseAngle1 | real | Yes | |
TimeLapseAngle2 | real | Yes | |
TimeLapseLife1 | real | Yes | |
TimeLapseLife2 | real | Yes | |
TimeLapseMana1 | real | Yes | |
TimeLapseMana2 | real | Yes | |
TimeLapsePoint1 | location | Yes | |
TimeLapsePoint2 | location | Yes | |
TimeLapseSec1 | integer | No | |
TimeLapseSec2 | integer | No | |
TimeLapsMaxSec | integer | No | |
TimePaused | real | No | |
Timer11 | timer | No | |
Timer12 | timer | No | |
TimerDarkConfusion1 | timer | No | |
TimerDarkConfusion2 | timer | No | |
TimerEight | timer | No | |
TimerEleven | timer | No | |
TimerEnchant1 | timer | No | |
TimerEnchant2 | timer | No | |
TimerFive | timer | No | |
TimerFling | timer | No | |
TimerFragFire1 | timer | No | |
TimerFragFire2 | timer | No | |
TimerImpetus1 | timer | No | |
TimerImpetus2 | timer | No | |
TimerLaserCannon1 | timer | No | |
TimerLaserCannon2 | timer | No | |
TimerOne | timer | No | |
TimerPerdition1 | timer | No | |
TimerPerdition2 | timer | No | |
TimerPlasmaShield1 | timer | No | |
TimerPlasmaShield2 | timer | No | |
TimerShukuchi1 | timer | No | |
TimerShukuchi2 | timer | No | |
TimerSix | timer | No | |
TimerSmokeScreen1 | timer | No | |
TimerSmokeScreen2 | timer | No | |
TimerSpiderWeb1 | timer | No | |
TimerSpiderWeb2 | timer | No | |
TimerTasteDeath1 | timer | No | |
TimerTasteDeath2 | timer | No | |
TimerTen | timer | No | |
TimerThree | timer | No | |
TimerThrowRock1 | timer | No | |
TimerThrowRock2 | timer | No | |
TimeStopGroup | group | No | |
TimeStopper | unit | No | |
TimeTasteDeath1 | real | No | |
TimeTasteDeath2 | real | No | |
TimeThrowRock1 | real | No | |
TimeThrowRock2 | real | No | |
TopGunDamage | real | Yes | |
TopGunDistance | real | Yes | |
TopGunVictim | unit | Yes | |
TransmuteMoney | integer | No | |
Treant | unit | No | |
Trem_Hit_Group | group | Yes | |
UNIT_Moonbeam | unit | Yes | |
UNITGROUP_Xyx | group | Yes | |
Ursa | unit | No | |
Victim | unit | No | |
Victim2 | unit | No | |
Victim3 | unit | No | |
Victim4 | unit | No | |
Victim5 | unit | No | |
VineCasterPos | location | No | |
VineOrigin | location | No | |
VineWallUnits | group | Yes | |
VineWallVictims | group | Yes | |
WaitPerdition | real | Yes | |
WaitTimeDive | real | Yes | |
WaitTimeLeap | real | Yes | |
WarlocksCount | integer | No | |
WebInvisibles | group | Yes | |
WebsCountAlive | integer | Yes | |
WinPoint | integer | No | |
Y_Map_Point | location | No |
function InitTrig_Load_Game_Cache takes nothing returns nothing
call FlushGameCache(InitGameCache("udg_hash"))
set udg_hash = InitGameCache("udg_hash")
set udg_FHV_Table = InitHashtable()
endfunction
function Core_Init takes nothing returns nothing
call CameraSetSmoothingFactor(5.)
endfunction
function InitTrig_Camera_Initialization takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterTimerEvent(trig,.01,false)
call TriggerAddAction(trig,function Core_Init)
set trig = null
endfunction
//===========================================================================================
//Hydro Pump
//by Paskovich
//
//Needed objects:
// - an AoE targetted spell (like Blizzard)
// - a dummy unit with the 'ziggurat missile' model
// o be sure that its movement type is set to hover, and fly height to 50
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other functions,
//so copy the whole script from the custom script window.
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Trig_Hydro_Pump_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0C6' //Your ability raw code.
endfunction
function Hydro_Pump_BlueDummyRC takes nothing returns integer
return 'e014' //Blue dummy raw code. (the swirl unit)
endfunction
constant function Hydro_Pump_Radius takes nothing returns real
return 400.0 //Radius of the spell.
endfunction
constant function Hydro_Pump_SwirlDurSeconds takes nothing returns real
return 1.0 //Duration before the Hydro Pump comes up. (duration of the swirl)
endfunction
constant function Hydro_Pump_DistanceModifier takes nothing returns real
return 1.0 //How far the unit flyies (!from where it is!), related to the distance from the center point.
endfunction
function Hydro_Pump_MaxHeight takes nothing returns integer
local real MaxHeight = 700.0 //A unit exactly in the centerpoint reaches this fly height.
//Units on the border will reach 50.0 height only.
return R2I(MaxHeight) - 50
endfunction
//======================DAMAGE OPTIONS================================
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!Calculation: DamageInitial + (Level * DamageIncrease) = MaxDamage!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
constant function Hydro_Pump_DamageInitial takes nothing returns real
return 150.0
endfunction
constant function Hydro_Pump_DamageIncrease takes nothing returns real
return 100.0
endfunction
constant function Hydro_Pump_MinDamage takes nothing returns real
//Damage ranges from MaxDamage to MinDamage as we are closer to the border.
return 50.0 //Units at the border will take MinDamage damage.
endfunction
function Hydro_Pump_DamageWhenFall takes nothing returns boolean
//If you want the unit to take damage when it falls to the ground, set this to true.
return false //Note: Calculations are the same as above.
endfunction
constant function Hydro_Pump_Fall_DamageInitial takes nothing returns real
return 25.0
endfunction
constant function Hydro_Pump_Fall_DamageIncrease takes nothing returns real
return 25.0
endfunction
constant function Hydro_Pump_Fall_MinDamage takes nothing returns real
return 0.0
endfunction
//====================================================================
//This function calculates a curve, that has its maximum height set. (reqired for the jump)
function GetParabolaHeightPreset takes real dist, real maxdist,real maxheight returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*maxheight
endfunction
//The target unit's jump timer
function Hydro_Pump_PumpUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "PumpUnit")
local real CenterX = GetHandleReal(t, "CenterX")
local real CenterY = GetHandleReal(t, "CenterY")
local real maxDist = GetHandleReal(t, "maxDist")
local real maxHeight = GetHandleReal(t, "maxHeight")
local real distChange = maxDist/50
local real dmg
local real dis = DistanceBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
local real ang = AngleBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
//Calculate the unit's position
local real ppx = PolarProjectionX(CenterX, dis + distChange, ang)
local real ppy = PolarProjectionY(CenterY, dis + distChange, ang)
local real UnitX = GetHandleReal(t, "UnitX")
local real UnitY = GetHandleReal(t, "UnitY")
local real curDist = DistanceBetweenPointsXY(UnitX, UnitY, GetUnitX(u), GetUnitY(u))
local real hgt = GetParabolaHeightPreset(curDist, maxDist, maxHeight)
//Create effect every three 0.02 seconds.
if IsIntDivisible(GetHandleInt(t, "counter"), 3) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl", u, "chest"))
endif
//Set the unit's position and facing.
call SetUnitPosition(u, ppx, ppy)
call SetUnitFlyHeight(u, hgt, 0)
call SetUnitFacing(u, ang)
//Chacks is the jump is over. (The timer is shot 50 times)
if GetHandleInt(t, "counter") == 50 then
call PauseTimer(t)
call SetUnitPathing(u, true)
call SetUnitFlyHeight(u, GetUnitDefaultFlyHeight(u), 0)
if Hydro_Pump_DamageWhenFall() then
if IsUnitEnemy(u, GetOwningPlayer(GetHandleUnit(t, "Caster"))) then
set dmg = GetHandleInt(t, "Level") * Hydro_Pump_Fall_DamageIncrease()
set dmg = Hydro_Pump_Fall_DamageInitial() + dmg
set dmg = PercentToInt(GetHandleInt(t, "Percent"), R2I(dmg - Hydro_Pump_Fall_MinDamage()))
set dmg = Hydro_Pump_Fall_MinDamage() + dmg
call UnitDamageTargetBJ(GetHandleUnit(t, "Caster"), u, dmg, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endif
endif
// call UnitRemoveAbility(u, 'Avul')
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
call SetHandleInt(t, "counter", GetHandleInt(t, "counter") + 1)
set t = null
set u = null
endfunction
//The initial swirl movement timer
function Hydro_Pump_Swirl takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = null
local real CenterX = GetHandleReal(t, "CenterX")
local real CenterY = GetHandleReal(t, "CenterY")
local real ang
local real dist
local real mindist
local real ppx
local real ppy
local integer a = 1
loop
exitwhen a > 12
set u = GetHandleUnit(t, "SwUnit"+I2S(a))
set ang = AngleBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
set dist = DistanceBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
set mindist = Hydro_Pump_Radius() / (40* Hydro_Pump_SwirlDurSeconds())
set ppx = PolarProjectionX(CenterX, dist - mindist, ang + 10)
set ppy = PolarProjectionY(CenterY, dist - mindist, ang + 10)
call SetUnitPosition(u, ppx, ppy)
call SetUnitFacing(u, ang+90)
set a = a + 1
endloop
//Checks is the swirl is small enough - destroy timer/swirl
if GetHandleInt(t, "times") >= (Hydro_Pump_Radius() / mindist) then
call PauseTimer(t)
set a = 1
loop
exitwhen a > 12
call KillUnit(GetHandleUnit(t, "SwUnit"+I2S(a)))
set a = a + 1
endloop
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
call SetHandleInt(t, "times", GetHandleInt(t, "times") + 1)
set u = null
set t = null
endfunction
function Trig_Hydro_Pump_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local location tl = GetSpellTargetLoc()
local timer t = CreateTimer()
local timer p
local real tx = GetLocationX(tl)
local real ty = GetLocationY(tl)
local group g
local unit u = null
local destructable d = null
local real dist
local real percent
local real ppx
local real ppy
local integer a = 1
local real dmg
call SetHandleReal(t, "CenterX", tx)
call SetHandleReal(t, "CenterY", ty)
//Create the initial swirl effect at the center of the target area.
call TerrainDeformCrater( tx, ty, Hydro_Pump_Radius(), -96, R2I((Hydro_Pump_SwirlDurSeconds()+0.3)*1000), false)
loop
exitwhen a > 12
set ppx = PolarProjectionX(tx, Hydro_Pump_Radius(), (a-1)*30)
set ppy = PolarProjectionY(ty, Hydro_Pump_Radius(), (a-1)*30)
call SetHandleHandle(t, "SwUnit"+I2S(a), CreateUnit(GetOwningPlayer(c), Hydro_Pump_BlueDummyRC(), ppx, ppy, (a-1)*30))
set a = a + 1
endloop
call TimerStart(t, 0.02, true, function Hydro_Pump_Swirl)
call TriggerSleepAction(Hydro_Pump_SwirlDurSeconds())
//Create the pump effects.
set d = CreateDestructableZ('OTip', tx, ty, 150, 0, 2, 0)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", tx, ty))
call RemoveDestructable(d)
set d = null
set a = 0
loop
exitwhen a > 7
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", PolarProjectionX(tx, Hydro_Pump_Radius()/2, a*45), PolarProjectionY(ty, Hydro_Pump_Radius()/2, a*45)))
set a = a + 1
endloop
//Picks enemy, non-building, not magic immune units in the target area -> start jumping timer.
set g = GetUnitsInRangeOfLocAll( Hydro_Pump_Radius(), tl)
loop
set u = FirstOfGroup(g)
call GroupRemoveUnit(g,u)
exitwhen u == null
if u != c and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false then
set p = CreateTimer()
//Calculate the unit's distance from the center / max height in the jump. (tricky heh? :))
//This makes the units fly at different heights.
set dist = DistanceBetweenPointsXY(tx, ty, GetUnitX(u), GetUnitY(u))
set percent = 100 - ((dist / Hydro_Pump_Radius()) * 100)
call SetHandleReal( p, "maxHeight" , 50 + PercentToInt(percent, Hydro_Pump_MaxHeight()) )
//Calculate and deal damage
if IsUnitEnemy(u, GetOwningPlayer(c)) then
call SetHandleInt(p, "Level", GetUnitAbilityLevel(c, GetSpellAbilityId()))
call SetHandleInt(p, "Percent", RoundR2I(percent))
set dmg = GetHandleInt(p, "Level") * Hydro_Pump_DamageIncrease()
set dmg = Hydro_Pump_DamageInitial() + dmg
set dmg = PercentToInt(percent, R2I(dmg - Hydro_Pump_MinDamage()))
set dmg = Hydro_Pump_MinDamage() + dmg
call UnitDamageTargetBJ(c, u, dmg, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endif
//Set the parameters for the timer.
call SetHandleHandle(p, "PumpUnit", u)
call SetHandleHandle(p, "Caster", c)
call SetHandleReal( p, "CenterX" , tx)
call SetHandleReal( p, "CenterY" , ty)
call SetHandleReal( p, "UnitX", GetUnitX(u))
call SetHandleReal( p, "UnitY", GetUnitY(u))
call SetHandleInt( p, "counter" , 1)
call SetHandleReal( p, "maxDist" , dist * Hydro_Pump_DistanceModifier())
//Add Storm Crow Form - start timer.
call SetUnitPathing(u, false)
call UnitAddAbility(u, 'Arav')
// call UnitAddAbility(u, 'Avul')
call UnitRemoveAbility(u, 'Arav')
call TimerStart(p, 0.02, true, function Hydro_Pump_PumpUnit)
endif
endloop
//Null variables
call RemoveLocation(tl)
set p = null
set g = null
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Hydro_Pump takes nothing returns nothing
set gg_trg_Hydro_Pump = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hydro_Pump, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Hydro_Pump, Condition( function Trig_Hydro_Pump_Conditions ) )
call TriggerAddAction( gg_trg_Hydro_Pump, function Trig_Hydro_Pump_Actions )
endfunction
//===========================================================================================
//Liquid Ooze
//by Paskovich
//
//Needed objects: (copy these to your map)
// - the ability called 'Liquid Ooze'
//
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other scripts,
//so copy the script from the custom script window.
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Liquid_Ooze_AbilityRawCode takes nothing returns integer
return 'A0C5' //Ability raw code.
endfunction
constant function Liquid_Ooze_MaxDamage takes nothing returns real
return 150.0 //Max damage stored.
endfunction
constant function Liquid_Ooze_ChanceInitial takes nothing returns integer
return 10 //Initial chance.
endfunction
constant function Liquid_Ooze_ChanceBonus takes nothing returns integer
//Chance increases with every level (incuding level 1) by this value.
return 10 //ChanceInitial + Level * ChanceBonus = Chance
endfunction
constant function Liquid_Ooze_DamageRadius takes nothing returns real
return 800.0 //AoE of damage.
endfunction
function Liquid_Ooze_SpecialEffect takes nothing returns string
return "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" //Effect when absorbs the damage. (caster)
endfunction
function Liquid_Ooze_SpecialEffectTarget takes nothing returns string
return "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl" //Effect when deals the AoE damage. (target)
endfunction
constant function Liquid_Ooze_DamageMultiplier takes nothing returns real
return 2.0 //Multiples the stored damage with this number. The result divided with the number of enemies gives the damage.
endfunction
function Liquid_Ooze_TakeDamage takes nothing returns boolean
return false //The "caster" takes the absorbed damage or not.
endfunction
function Trig_Liquid_Ooze_Conditions takes nothing returns boolean
return GetLearnedSkillLevel() == 1 and GetLearnedSkill() == Liquid_Ooze_AbilityRawCode()
endfunction
function Liquid_Ooze_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitDeadBJ(GetFilterUnit())==false
endfunction
function Trig_Liquid_Ooze_Damage takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = null
local location uloc = null
local unit a = null
local boolexpr filter = null
local integer n = 0
local integer chc = Liquid_Ooze_ChanceInitial() + GetUnitAbilityLevel(u,Liquid_Ooze_AbilityRawCode()) * Liquid_Ooze_ChanceBonus()
if Chance(chc) then
if not Liquid_Ooze_TakeDamage() then
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + GetEventDamage())
endif
call DestroyEffect(AddSpecialEffect(Liquid_Ooze_SpecialEffect(), GetUnitX(u), GetUnitY(u)))
call SetHandleReal(u, "DamageCounter", GetHandleReal(u, "DamageCounter") + GetEventDamage())
//call Msg(R2S(GetHandleReal(u, "DamageCounter")))
if GetHandleReal(u, "DamageCounter") >= Liquid_Ooze_MaxDamage() then
set uloc = GetUnitLoc(u)
set filter = Condition(function Liquid_Ooze_Filter)
set g = GetUnitsInRangeOfLocMatching(Liquid_Ooze_DamageRadius(), uloc, filter)
set n = CountUnitsInGroup(g)
loop
set a = FirstOfGroup(g)
call GroupRemoveUnit(g, a)
exitwhen a == null
call UnitDamageTargetBJ(u, a, GetHandleReal(u, "DamageCounter")/n*Liquid_Ooze_DamageMultiplier(), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
call DestroyEffect(AddSpecialEffect(Liquid_Ooze_SpecialEffectTarget(), GetUnitX(a), GetUnitY(a)))
endloop
call DestroyGroup(g)
call RemoveLocation(uloc)
call DestroyBoolExpr(filter)
call FlushHandleLocals(u)
set filter = null
set g = null
set a = null
endif
endif
set u = null
endfunction
function Trig_Liquid_Ooze_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(t, function Trig_Liquid_Ooze_Damage)
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_Absorb_Damage takes nothing returns nothing
set gg_trg_Absorb_Damage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Absorb_Damage, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Absorb_Damage, Condition( function Trig_Liquid_Ooze_Conditions ) )
call TriggerAddAction( gg_trg_Absorb_Damage, function Trig_Liquid_Ooze_Actions )
endfunction
function Trig_Meteor_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0C0' ) ) then
return false
endif
return true
endfunction
function Trig_Meteor_Actions takes nothing returns nothing
local player tempplay = GetOwningPlayer(GetSpellAbilityUnit())
local location temploc = GetSpellTargetLoc()
local unit tempunit = null
call PlaySoundAtPointBJ( gg_snd_CycloneLoop1, 100, temploc, 0 )
call CreateNUnitsAtLoc( 1, 'e012', tempplay, temploc, bj_UNIT_FACING )
set tempunit = GetLastCreatedUnit()
call TriggerSleepAction( ( GetSoundDurationBJ(gg_snd_MarkOfChaos) - 2.20 ) )
call AddSpecialEffectLocBJ( temploc, "Units\\Demon\\Infernal\\InfernalBirth.mdl" )
call TriggerSleepAction( 0.70 )
// call PlaySoundAtPointBJ( gg_snd_MarkOfChaos, 100, temploc, 0 )
call IssueImmediateOrderBJ( tempunit, "fanofknives" )
call AddSpecialEffectLocBJ( temploc, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, 'e013', tempplay, temploc, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, 'e013', tempplay, PolarProjectionBJ(temploc, GetRandomReal(76.00, 150.00), GetRandomReal(1.00, 360.00)), bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, 'e013', tempplay, PolarProjectionBJ(temploc, GetRandomReal(151.00, 250.00), GetRandomReal(1.00, 360.00)), bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveUnit( tempunit )
call RemoveLocation(temploc)
endfunction
//===========================================================================
function InitTrig_Meteor takes nothing returns nothing
set gg_trg_Meteor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Meteor, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Meteor, Condition( function Trig_Meteor_Conditions ) )
call TriggerAddAction( gg_trg_Meteor, function Trig_Meteor_Actions )
endfunction
function Trig_Omnislash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0AN'
endfunction
function Unit_Group takes nothing returns boolean
return GetBooleanAnd( IsUnitAliveBJ(GetFilterUnit()) == true, IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Trig_Omnislash_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local integer i = 0
local group UnitGroup
local unit TargetRandom
local unit Target = GetSpellTargetUnit()
local effect Phoenix
local location R
local real Damage = 70
local integer Amount = 1 + ( GetUnitAbilityLevelSwapped('A0AN', Caster) * 2 )
call TriggerSleepAction( 0.20 )
call SelectUnitRemove( Caster )
call SetUnitVertexColor( Caster, 150, 150, 150, 150 )
call SetUnitInvulnerable( Caster, true )
set Phoenix = AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl",Caster,"weapon" )
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(GetUnitLoc(Target), 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(Target)) )
call UnitDamageTarget( Caster, Target, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
call SetUnitAnimation( Caster, "attack" )
call TriggerSleepAction( 0.25 )
call SelectUnitRemove( Caster )
loop
set i = i + 1
exitwhen i > Amount
set UnitGroup = GetUnitsInRangeOfLocMatching(600.00, GetUnitLoc(Caster), Condition(function Unit_Group))
if ( IsUnitGroupEmptyBJ(UnitGroup) == false ) then
set TargetRandom = GroupPickRandomUnit(UnitGroup)
set R = GetUnitLoc(TargetRandom)
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(R, 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(TargetRandom)) )
call UnitDamageTarget( Caster, TargetRandom, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
call SetUnitAnimation( Caster, "attack" )
call RemoveLocation ( R )
call TriggerSleepAction( 0.25 )
call SelectUnitRemove( Caster )
else
endif
call DestroyGroup(UnitGroup)
endloop
call SelectUnitForPlayerSingle( Caster, GetTriggerPlayer() )
call SetUnitInvulnerable( Caster, false )
call SetUnitVertexColor( Caster, 255, 255, 255, 255 )
call DestroyEffect( Phoenix )
set Phoenix = null
set Caster = null
set UnitGroup = null
set TargetRandom = null
set Target = null
set Amount = 0
set R = null
set Damage = 0
endfunction
//===========================================================================
function InitTrig_Omnislash takes nothing returns nothing
set gg_trg_Omnislash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Omnislash, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Omnislash, Condition( function Trig_Omnislash_Conditions ) )
call TriggerAddAction( gg_trg_Omnislash, function Trig_Omnislash_Actions )
endfunction
function Trig_Diabolic_Edict_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01B'
endfunction
function Diabolic_Edict_Group takes nothing returns boolean
return GetBooleanAnd( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true, IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Diabolic_Edict_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetUnitAbilityLevelSwapped('A01B', u)
local location l
local timer t = CreateTimer()
local unit v
call StartTimerBJ(t,false, 8)
loop
exitwhen TimerGetRemaining(t) <= 0.00
set l = GetUnitLoc(u)
set v = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(500.00, l, Condition(function Diabolic_Edict_Group)))
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl", v, "chest" ))
call UnitDamageTarget( u, v, 12.5*i, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
call RemoveLocation(l)
call TriggerSleepAction(.2)
endloop
call DestroyTimer(t)
set t = null
set u = null
set l = null
set v = null
endfunction
//===========================================================================
function InitTrig_Diabolic_Edict takes nothing returns nothing
set gg_trg_Diabolic_Edict = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Diabolic_Edict, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Diabolic_Edict, Condition( function Trig_Diabolic_Edict_Conditions ) )
call TriggerAddAction( gg_trg_Diabolic_Edict, function Trig_Diabolic_Edict_Actions )
endfunction
function Black_Hole_Conditions takes nothing returns boolean
return GetUnitTypeId(GetSummonedUnit()) == 'u004'
endfunction
function Black_Hole_Effects takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")
local unit v = GetHandleUnit(t, "v")
local unit w
local location l = GetUnitLoc(v)
local location m
local group g = GetUnitsInRangeOfLocAll(400.00, l)
loop
set w = FirstOfGroup(g)
exitwhen w == null
call GroupRemoveUnit(g,w)
if GetBooleanAnd( IsUnitEnemy(w, GetOwningPlayer(v)) == true, IsUnitType(w,UNIT_TYPE_STRUCTURE) == false) then
set m = GetUnitLoc(w)
call SetUnitPositionLoc( w, PolarProjectionBJ(l, ( DistanceBetweenPoints(l, m) - 3.00 ), AngleBetweenPoints(l, m)) )
call RemoveLocation(m)
endif
endloop
set u = null
set v = null
set m = null
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
endfunction
function Black_Hole_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit v = GetSummonedUnit()
call SetHandleHandle(t, "u", u)
call SetHandleHandle(t, "v", v)
call TimerStart(t, 0.05, true, function Black_Hole_Effects)
call TriggerSleepAction(4)
call FlushHandleLocals(t)
call DestroyTimer(t)
set u = null
set v = null
endfunction
//===========================================================================
function InitTrig_Black_Hole_Level_1 takes nothing returns nothing
set gg_trg_Black_Hole_Level_1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Black_Hole_Level_1, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( gg_trg_Black_Hole_Level_1, Condition( function Black_Hole_Conditions ) )
call TriggerAddAction( gg_trg_Black_Hole_Level_1, function Black_Hole_Actions )
endfunction
function Black_Hole_Conditions_2 takes nothing returns boolean
return GetUnitTypeId(GetSummonedUnit()) == 'u00C'
endfunction
function Black_Hole_Effects_2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")
local unit v = GetHandleUnit(t, "v")
local unit w
local location l = GetUnitLoc(v)
local location m
local group g = GetUnitsInRangeOfLocAll(400.00, l)
loop
set w = FirstOfGroup(g)
exitwhen w == null
call GroupRemoveUnit(g,w)
// if IsUnitEnemy(w, GetOwningPlayer(v)) == true then
if GetBooleanAnd( IsUnitEnemy(w, GetOwningPlayer(v)) == true, IsUnitType(w,UNIT_TYPE_STRUCTURE) == false) then
set m = GetUnitLoc(w)
call SetUnitPositionLoc( w, PolarProjectionBJ(l, ( DistanceBetweenPoints(l, m) - 3.00 ), AngleBetweenPoints(l, m)) )
call RemoveLocation(m)
endif
endloop
set u = null
set v = null
set m = null
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
endfunction
function Black_Hole_Actions_2 takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit v = GetSummonedUnit()
call SetHandleHandle(t, "u", u)
call SetHandleHandle(t, "v", v)
call TimerStart(t, 0.05, true, function Black_Hole_Effects_2)
call TriggerSleepAction(4)
call FlushHandleLocals(t)
call DestroyTimer(t)
set u = null
set v = null
endfunction
//===========================================================================
function InitTrig_Black_Hole_Level_2 takes nothing returns nothing
set gg_trg_Black_Hole_Level_2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Black_Hole_Level_2, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( gg_trg_Black_Hole_Level_2, Condition( function Black_Hole_Conditions_2 ) )
call TriggerAddAction( gg_trg_Black_Hole_Level_2, function Black_Hole_Actions_2 )
endfunction
//===========================================================================================
//Vine Whip
//by Paskovich
//
//Needed objects:
// - a unit targetted spell (like Storm Bolt), but better base it on Channel. (Or simply copy
// my spell from the object editor.)
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other functions(!!!),
//so copy the script from the custom script window!
//Please give me a credit if you use this spell on your map!
//
//*UPDATE*
// - New header: Vine_Whip_LightningEffect to set the lightning easily
// - New header: Vine_Whip_DamageDisplay if you don't want the damage to be displayed
//============================================================================================
function Trig_Vine_Whip_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0BP' //Raw code of your ability.
endfunction
function Vine_Whip_Speed takes nothing returns real
local real speed = 1.0 //Speed of the throwing. (default 1.0)
return 24.0 * speed
endfunction
function Vine_Whip_PlusRange takes nothing returns real
return 150.0 //This is the offset from the caster where the target lands. (default 150.0)
endfunction
function Vine_Whip_LightningEffect takes nothing returns string
//============================================================================================
//Lightning effects: LEAS - Aerial Shackles
// CLBP - Chain Lightning Primary
// CLSB - Chain Lightning Secondary
// DRAL - Drain Life (default)
// DRAB - Drain Life and Mana
// DRAM - Drain Mana
// AFOD - Finger Of Death
// FORK - Forked Lightning
// HWPB - Healing Wave Primary
// HWSB - Healing Wave Secondary
// CHIM - Lightning Attack
// MBUR - Mana Burn
// MFBP - Mana Flare
// SPLK - Spirit Link
//============================================================================================
return "DRAL"
endfunction
function Vine_Whip_DamageDependOnHeight takes nothing returns boolean
//============================================================================================
//If this is set to true, the damage will also depend on the unit's reached maximum height
//while in the air.
//
//Important: the maximum height that can be reached is ~440, the minimum is ~160!
//Note: The height depends on the initial distance between the caster and target.
//============================================================================================
return true
endfunction
function Vine_Whip_DamageModifier takes nothing returns real
//============================================================================================
//A little math required to understand:
//
//If Vine_Whip_DamageDependOnHeight is set to false:
//Vine_Whip_InitialDamage + Vine_Whip_BonusDamagePerLevel * Abilitylevel ==> Normal Damage
//
//But if Vine_Whip_DamageDependOnHeight is set to true:
//Damage = (Normal Damage * reached height) / Vine_Whip_DamageModifier
//
//If we count with a level 3 ability, then
//Maximum damage reachable = 325 * 440 / 330.0 ~ 433
// | |
// -> the damage normally -> maximum reachable height
//Minimum damage is 213.
//I recommend to leave this value at its default, and experiment with Vine_Whip_InitialDamage
//and Vine_Whip_BonusDamagePerLevel.
//============================================================================================
return 330.0
endfunction
constant function Vine_Whip_InitialDamage takes nothing returns real
return 100.0 //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
constant function Vine_Whip_BonusDamagePerLevel takes nothing returns real
return 75.0 //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
function Vine_Whip_DamageDisplay takes nothing returns boolean
return false //Set this to false if you don't want the damage to be displayed on the screen.
endfunction
function Vine_Whip_ThrowUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit ctr = GetHandleUnit(t, "caster")
local unit trg = GetHandleUnit(t, "target")
local real maxD = GetHandleReal(t, "maxDist")
local real curD = GetHandleReal(t, "curDist")
local real ang = GetHandleReal(t, "angle")
local real hgt = GetParabolaHeight(maxD-curD, maxD, 1.8)
local lightning l = GetHandleLightning(t, "light")
local integer c = GetHandleInt(t, "times")
local texttag tt
local real dmg
//Set the unit's position
call SetUnitPosition(trg, PolarProjectionX(GetUnitX(trg), Vine_Whip_Speed(), ang), PolarProjectionY(GetUnitY(trg), Vine_Whip_Speed(), ang))
call SetUnitFlyHeight(trg, hgt, 0)
//Get the max height reached
if hgt > GetHandleReal(t, "maxH") then
call SetHandleReal(t, "maxH", hgt)
endif
//Create the next lightning
call DestroyLightning(l)
call SetHandleLightning(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
//Set the next distance, +1 to the counter
call SetHandleReal(t, "curDist", curD - Vine_Whip_Speed())
call SetHandleInt(t, "times", c + 1)
//Check if the counter reached the required value - destroy timer
if c > (maxD/Vine_Whip_Speed()) then
call PauseTimer(t)
// call DisplayTextToPlayer(Player(0), 0, 0, R2S(GetHandleReal(t, "maxH"))) //Displays the maximum height.
call DestroyLightning(GetHandleLightning(t, "light"))
set dmg = Vine_Whip_InitialDamage() + Vine_Whip_BonusDamagePerLevel() * GetHandleInt(t, "level")
if Vine_Whip_DamageDependOnHeight() then
set dmg = (dmg*GetHandleReal(t, "maxH"))/Vine_Whip_DamageModifier()
if Vine_Whip_DamageDisplay() then
set tt = CreateTextTagUnitBJ(R2S(R2I(dmg)*1), trg, 20, 10, 0, 255, 0, 0)
call SetTextTagVelocityBJ(tt, 64, 90)
call SetTextTagPermanent( tt, false )
call SetTextTagLifespan( tt, 1.00 )
call SetTextTagFadepoint( tt, 0.50 )
endif
endif
call UnitDamageTarget(ctr, trg, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", GetUnitX(trg), GetUnitY(trg)))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", GetUnitX(trg), GetUnitY(trg)))
call TerrainDeformCrater( GetUnitX(trg), GetUnitY(trg), 256.00, 34.00, R2I(0.05*1000), false)
call SetUnitPathing(trg, true)
call FlushHandleLocals(t)
set trg = null
set ctr = null
set t = null
call DestroyTimer(t)
endif
set trg = null
set ctr = null
set t = null
endfunction
function Trig_Vine_Whip_Actions takes nothing returns nothing
local unit ctr = GetTriggerUnit()
local unit trg = GetSpellTargetUnit()
local timer t = CreateTimer()
local real dist = DistanceBetweenUnits(ctr, trg)
local real ang = AngleBetweenUnits(trg, ctr)
//Store th caster and the target, create the first lightning
call SetHandleHandle(t, "caster", ctr)
call SetHandleHandle(t, "target", trg)
call SetHandleLightning(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
//Throwning the unit
call SetUnitPathing(trg, false)
call SetHandleReal(t, "maxDist", dist + Vine_Whip_PlusRange())
call SetHandleReal(t, "curDist", dist + Vine_Whip_PlusRange())
call SetHandleReal(t, "angle", ang)
call SetHandleReal(t, "maxH", 0)
call SetHandleInt(t, "level", GetUnitAbilityLevel(ctr, GetSpellAbilityId()))
call SetHandleInt(t, "times", 0)
call UnitAddAbility(trg, 'Arav')
call UnitRemoveAbility(trg, 'Arav')
call TimerStart(t, 0.02, true, function Vine_Whip_ThrowUnit)
set ctr = null
set trg = null
set t = null
endfunction
//===========================================================================
function InitTrig_Marine_Fling takes nothing returns nothing
set gg_trg_Marine_Fling = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Marine_Fling, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Marine_Fling, Condition( function Trig_Vine_Whip_Conditions ) )
call TriggerAddAction( gg_trg_Marine_Fling, function Trig_Vine_Whip_Actions )
endfunction
function Trig_Purity_Aura_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetAttackedUnitBJ(), 'B030') == true ) ) then
return false
endif
return true
endfunction
function Trig_Purity_Aura_Func005C takes nothing returns boolean
local integer i = GetRandomInt(1, 10) //chance 1 of 10, or 10%
local integer r = 1
if ( not ( i == r ) ) then
return false
endif
return true
endfunction
function Trig_Purity_Aura_Actions takes nothing returns nothing
local unit a = GetAttackedUnitBJ()
call TriggerSleepAction( 0.70 )
if ( Trig_Purity_Aura_Func005C() ) then
call SetUnitLifeBJ( a, ( GetUnitStateSwap(UNIT_STATE_LIFE, a) + ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, a) / 10.00 ) ) ) //for life 10%
call AddSpecialEffectLocBJ( GetUnitLoc(a), "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
else
set a = null
endif
endfunction
//===========================================================================
function InitTrig_Holy_Shield takes nothing returns nothing
set gg_trg_Holy_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Shield, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Holy_Shield, Condition( function Trig_Purity_Aura_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Shield, function Trig_Purity_Aura_Actions )
endfunction
//===========================================================================================
//Barrier
//by Paskovich
//
//Needed objects:
// - an instant, non-targetted spell (like Thunder Clap)
// - a barrier unit
// o with the ability: Locust
// o with the model: Spirit Touch (special),
// o with unit scale: 3.5,
// o with movement type: flying
// o and fly height: 200
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars, so copy the script from the custom script window!
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Trig_Barrier_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0B0' //Raw code of your ability.
endfunction
function Barrier_InitDuration takes nothing returns real
return 4.0 //Duration of the Barrier, WITHOUT levelstats.
endfunction
function Barrier_DurationIncrease takes nothing returns real
//Each level icreases duration by this value.
//Duration = InitDuration + (Level * DurationIncrease)
//Example: Level 1 -> 4.0 + (1 * 3.0) = 7 seconds
return 3.0 // Level 3 -> 4.0 + (3 * 3.0) = 13 seconds
endfunction
function Barrier_UnitRawCode takes nothing returns integer
return 'e010' //Raw code of your Barrier dummy.
endfunction
function Barrier_Radius takes nothing returns real
return 450.0 //Push units that are inside this range.
endfunction
function Barrier_DamagePerSec takes nothing returns real
local real DamagePerSec = 100.0 //Damage dealt per one second while the unit is being
//pushed out of the Barrier.
//Note: a unit beside the center is pushed out in 1.6 second,
return DamagePerSec/100 //that means 160 damage.
endfunction
function Barrier_PushUnits takes nothing returns nothing
local timer p1 = GetExpiredTimer()
local unit u1 = GetHandleUnit(p1, "PushUnit")
local unit b1 = GetHandleUnit(p1, "PushBarrier")
local real a1 = AngleBetweenUnits(b1, u1)
//This timer slides the unit out of the barrier.
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl", PolarProjectionX(GetUnitX(u1), 5, a1), PolarProjectionY(GetUnitY(u1), 5, a1)))
call SetUnitPosition(u1, PolarProjectionX(GetUnitX(u1), 5, a1), PolarProjectionY(GetUnitY(u1), 5, a1))
call SetUnitFacing(u1, a1+180)
call UnitDamageTarget(b1, u1, Barrier_DamagePerSec(), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
//Checks if the unit is out of the barrier - destroys the timer.
if DistanceBetweenUnits(b1, u1) >= Barrier_Radius() then
set u1 = null
set b1 = null
call FlushHandleLocals(p1)
call PauseTimer(p1)
call DestroyTimer(p1)
set p1 = null
endif
set u1 = null
set b1 = null
set p1 = null
endfunction
function Barrier_PickUnits takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local unit b1 = GetHandleUnit(t1, "barrier")
local location Bloc1 = GetUnitLoc(b1)
local group g1 = GetUnitsInRangeOfLocMatching(Barrier_Radius(), Bloc1, null)
local unit u1 = null
local timer p1 = null
call RemoveLocation(Bloc1)
//This timer picks enemies inside the barrier. (shoots every second)
loop
set u1 = FirstOfGroup(g1)
call GroupRemoveUnit(g1, u1)
exitwhen u1 == null
if IsUnitEnemy(u1, GetOwningPlayer(b1)) and IsUnitType(u1, UNIT_TYPE_STRUCTURE) == false and IsUnitDeadBJ(u1) == false then
set p1 = CreateTimer()
call SetHandleHandle(p1, "PushUnit", u1)
call SetHandleHandle(p1, "PushBarrier", b1)
call SetHandleReal(p1, "PushAngle", AngleBetweenUnits(b1, u1))
call SetHandleReal(p1, "PushDist", DistanceBetweenUnits(b1, u1))
//Starts the sliding timer.
call TimerStart(p1, 0.02, true, function Barrier_PushUnits)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl", u1, "chest"))
set p1 = null
endif
endloop
call DestroyGroup(g1)
set u1 = null
set g1 = null
set Bloc1 = null
//Checks the duration - destroys the timer, kills the barrier
if GetHandleInt(t1, "times") >= GetHandleInt(t1, "maxTimes") then
call PauseTimer(t1)
call SetUnitTimeScale(b1, 1)
call KillUnit(b1)
call DestroyTimer(t1)
endif
call SetHandleInt(t1, "times", GetHandleInt(t1, "times")+1)
set b1 = null
set t1 = null
endfunction
function Trig_Barrier_Actions takes nothing returns nothing
local unit u1 = GetTriggerUnit()
local unit b1 = CreateUnit(GetOwningPlayer(u1), Barrier_UnitRawCode(), GetUnitX(u1), GetUnitY(u1), 270.0)
local timer t1 = CreateTimer()
local integer n1 = GetUnitAbilityLevel(u1, GetSpellAbilityId())
local real dur1 = Barrier_InitDuration() + n1*Barrier_DurationIncrease()
call SetHandleHandle(t1, "barrier", b1)
call SetHandleInt(t1, "times", 1)
call SetHandleInt(t1, "maxTimes", R2I(dur1))
call TimerStart(t1, 1.0, true, function Barrier_PickUnits)
call TriggerSleepAction(0.7)
call SetUnitTimeScale(b1, 0)
endfunction
//==== Init Trigger Barrier ====
function InitTrig_Plasma_Shield takes nothing returns nothing
set gg_trg_Plasma_Shield = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Plasma_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Plasma_Shield, Condition(function Trig_Barrier_Conditions))
call TriggerAddAction(gg_trg_Plasma_Shield, function Trig_Barrier_Actions)
endfunction
function Trig_Ravage_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0D2'
endfunction
function Trig_Ravage_Actions takes nothing returns nothing
local location l = GetUnitLoc(GetTriggerUnit())
local integer i = 1
local unit u
local player p = GetOwningPlayer(GetTriggerUnit())
loop
exitwhen i > 16
set u = CreateUnit( p, 'n00M', GetLocationX(l), GetLocationY(l), bj_UNIT_FACING )
call SetUnitAbilityLevelSwapped( 'A0D1', u, GetUnitAbilityLevelSwapped('A0D2', GetTriggerUnit()) )
call IssuePointOrderLoc( u, "impale", PolarProjectionBJ(l, 100.00, ( 22.50 * i )) )
call UnitApplyTimedLife( u, 'BTLF', 1.00 )
set i = i + 1
endloop
call RemoveLocation(l)
set l = null
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Ravage takes nothing returns nothing
set gg_trg_Ravage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ravage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ravage, Condition( function Trig_Ravage_Conditions ) )
call TriggerAddAction( gg_trg_Ravage, function Trig_Ravage_Actions )
endfunction
function Trig_Fissure_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A03H' // Fissure ability rawcode
endfunction
function Trig_Fissure_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local destructable array d
local location l = GetSpellTargetLoc()
local real xu = GetUnitX(u)
local real yu = GetUnitY(u)
local real xl = GetLocationX(l)
local real yl = GetLocationY(l)
local real ang = ABPXY(xu,yu,xl,yl)
local real distance = 60.
local real dist = distance
local integer i = 1
local real max_dist = 1200. // Total distance
local real duration = 8. // Duration of doodads
local string sfx = "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl" // Created effect at each doodad
local integer dummy_id = 'B000' // Fissure destructible rawcode
loop
exitwhen dist>max_dist
set d[i] = CreateDestructable(dummy_id,SafeX(xu+dist*Cos(ang*bj_DEGTORAD)),SafeY(yu+dist*Sin(ang*bj_DEGTORAD)),GetRandomReal(0,360),.5,GetRandomInt(0,2))
call DestroyEffect(AddSpecialEffect(sfx,xu+dist*Cos(ang*bj_DEGTORAD),yu+dist*Sin(ang*bj_DEGTORAD)))
set dist = dist+ distance
set i = i + 1
endloop
call PolledWait(duration)
loop
exitwhen i==0
call RemoveDestructable(d[i])
set d[i] = null
set i = i - 1
endloop
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
function InitTrig_Fissure takes nothing returns nothing
set gg_trg_Fissure = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_Fissure,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Fissure,Condition(function Trig_Fissure_Conditions))
call TriggerAddAction(gg_trg_Fissure, function Trig_Fissure_Actions )
endfunction
function Trig_Echo_Slam_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0DI'
endfunction
function Echo_Group takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Trig_Echo_Slam_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location l = GetUnitLoc(GetTriggerUnit())
local group g
local unit u
local unit v
call TriggerSleepAction(1.50)
call SetUnitAnimation( Caster, "Attack Slam" )
call TriggerSleepAction(0.25)
set g = GetUnitsInRangeOfLocMatching(500, l, Condition(function Echo_Group))
loop
set u = FirstOfGroup(g)
exitwhen u ==null
call GroupRemoveUnit(g,u)
set v = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'n00N',GetUnitX(u), GetUnitY(u), bj_UNIT_FACING)
call SetUnitAbilityLevelSwapped( 'A0DF', v, GetUnitAbilityLevelSwapped('A0DI', GetTriggerUnit()) )
call IssueImmediateOrder(v,"fanofknives")
call UnitApplyTimedLife(v,'BTLF',1.00)
endloop
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
set v = null
set Caster = null
endfunction
//===========================================================================
function InitTrig_Echo_Slam takes nothing returns nothing
set gg_trg_Echo_Slam = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Echo_Slam, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Echo_Slam, Condition( function Trig_Echo_Slam_Conditions ) )
call TriggerAddAction( gg_trg_Echo_Slam, function Trig_Echo_Slam_Actions )
endfunction
function Trig_Requim_of_Souls_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0DR'
endfunction
function Req_Group takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Req_Group2 takes nothing returns boolean
return GetBooleanAnd( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true,UnitHasBuffBJ(GetFilterUnit(), 'B039') == false )
endfunction
function Trig_Requim_of_Souls_Actions takes nothing returns nothing
local unit u
local unit v
local integer i = 1
local location m = GetUnitLoc(GetTriggerUnit())
local location l
local group g
// call TriggerSleepAction (.6)
loop
exitwhen i > 15
set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'n00O',GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()), bj_UNIT_FACING)
set l = PolarProjectionBJ(m,50.00,(I2R(i)*24))
call SetUnitAbilityLevelSwapped('A0DS',u,GetUnitAbilityLevelSwapped('A0DR',GetTriggerUnit()))
call UnitApplyTimedLife(u,'BTLF',1.00)
call IssuePointOrder(u,"carrionswarm",GetLocationX(l), GetLocationY(l))
call RemoveLocation(l)
set i = i + 1
endloop
set g = GetUnitsInRangeOfLocMatching(300, m, Condition(function Req_Group))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
set v = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'n00O',GetUnitX(u),GetUnitY(u), bj_UNIT_FACING)
call UnitAddAbility(v,'A0DT')
call SetUnitAbilityLevelSwapped( 'A0DT', v, GetUnitAbilityLevelSwapped('A0DR', GetTriggerUnit()) )
call UnitApplyTimedLife(v,'BTLF',1.00)
call IssueTargetOrder( v, "cripple", u )
endloop
call DestroyGroup(g)
call TriggerSleepAction (.1)
set g = GetUnitsInRangeOfLocMatching(500, m, Condition(function Req_Group2))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
set v = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'n00O',GetUnitX(u),GetUnitY(u), bj_UNIT_FACING)
call UnitAddAbility(v,'A0DV')
call SetUnitAbilityLevelSwapped( 'A0DV', v, GetUnitAbilityLevelSwapped('A0DR', GetTriggerUnit()) )
call UnitApplyTimedLife(v,'BTLF',1.00)
call IssueTargetOrder( v, "cripple", u )
endloop
call DestroyGroup(g)
call TriggerSleepAction (.1)
set g = GetUnitsInRangeOfLocMatching(700, m, Condition(function Req_Group2))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
set v = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'n00O',GetUnitX(u),GetUnitY(u), bj_UNIT_FACING)
call UnitAddAbility(v,'A0DU')
call SetUnitAbilityLevelSwapped( 'A0DU', v, GetUnitAbilityLevelSwapped('A0DR', GetTriggerUnit()) )
call UnitApplyTimedLife(v,'BTLF',1.00)
call IssueTargetOrder( v, "cripple", u )
endloop
call DestroyGroup(g)
set g = null
set u = null
set l = null
call RemoveLocation(m)
set m = null
set v = null
endfunction
//===========================================================================
function InitTrig_Requiem_of_Souls takes nothing returns nothing
set gg_trg_Requiem_of_Souls = CreateTrigger( )
// call TriggerRegisterAnyUnitEventBJ( gg_trg_Requiem_of_Souls, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Requiem_of_Souls, EVENT_PLAYER_UNIT_SPELL_FINISH )
// call TriggerRegisterAnyUnitEventBJ( gg_trg_Requiem_of_Souls, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( gg_trg_Requiem_of_Souls, Condition( function Trig_Requim_of_Souls_Conditions ) )
call TriggerAddAction( gg_trg_Requiem_of_Souls, function Trig_Requim_of_Souls_Actions )
endfunction
constant function KnockBack_SpellId takes nothing returns integer
return 'A0D5'
endfunction
constant function KnockBack_PushSpeed takes real level returns real
return 800.0
endfunction
constant function KnockBack_PushDuration takes real level returns real
return 0.1+level*0.1
endfunction
constant function KnockBack_InitDamage takes real level returns real
return 25+level*25
endfunction
constant function KnockBack_ImpactDamage takes real level returns real
return 25+level*25
endfunction
constant function KnockBack_MaxHigh takes nothing returns real
return 200.0
endfunction
constant function KnockBack_AnimTimer takes nothing returns real
return 0.01
endfunction
function KnockBack_Conditions takes nothing returns boolean
return GetSpellAbilityId() == KnockBack_SpellId()
endfunction
function KnockBack_Push takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u=GetHandleUnit(t,"u")
local integer h=GetHandleInt(t,"h")
local real a=GetHandleReal(t,"a")
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real d=KnockBack_AnimTimer()*KnockBack_PushSpeed(GetHandleInt(t,"l"))
local real nx=x+d*CosBJ(a)
local real ny=y+d*SinBJ(a)
call SetUnitFacing(u,GetRandomReal(0,360))
if GetTerrainCliffLevel(nx,ny) > h then
set a=180-a
set nx=x+d*CosBJ(a)
set ny=y+d*SinBJ(a)
if GetTerrainCliffLevel(nx,ny) > h then
set a=a+180
set nx=x+d*CosBJ(a)
set ny=y+d*SinBJ(a)
endif
call SetHandleReal(t,"a",a)
elseif GetTerrainCliffLevel(nx,ny) < h then
call SetUnitFlyHeight(u,GetHandleReal(t,"f"),0)
set nx=x
set ny=y
endif
call SetUnitPosition(u,nx,ny)
set t=null
set u=null
endfunction
function KnockBack_Actions takes nothing returns nothing
local unit c=GetTriggerUnit()
local unit u=GetSpellTargetUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local integer l=GetUnitAbilityLevel(c,GetSpellAbilityId())
local integer h=GetTerrainCliffLevel(x,y)
local real a=Atan2BJ(y-GetUnitY(c),x-GetUnitX(c))
local real f=GetUnitFlyHeight(u)
local real d=KnockBack_PushDuration(l)
local timer t=CreateTimer()
call SetUnitAnimation( c, "attack - 3" )
call TriggerSleepAction( 0.4 )
call SetHandleHandle(t,"u",u)
call SetHandleReal(t,"a",a)
call SetHandleReal(t,"f",f)
call SetHandleInt(t,"h",h)
call SetHandleInt(t,"l",l)
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
call SetUnitPathing(u,false)
call SetUnitFlyHeight(u,f+0.01,0)
call DamageUnitByTypes(c,u,KnockBack_InitDamage(l),ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
call TimerStart(t,KnockBack_AnimTimer(),true,function KnockBack_Push)
call SetUnitFlyHeight(u,1000000,KnockBack_MaxHigh()/(d/2))
call PolledWait(d/2)
call SetUnitFlyHeight(u,f,KnockBack_MaxHigh()/(d/2))
call PolledWait(d/2)
call DamageUnitByTypes(c,u,KnockBack_ImpactDamage(l),ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
call FlushHandleLocals(t)
call DestroyTimer(t)
call SetUnitPathing(u,true)
set t=null
set c=null
set u=null
endfunction
function InitTrig_Knock_Back takes nothing returns nothing
set gg_trg_Knock_Back = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Knock_Back,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Knock_Back,Condition(function KnockBack_Conditions))
call TriggerAddAction(gg_trg_Knock_Back,function KnockBack_Actions)
endfunction
//===========================================================================
//
// Author: frEAk49
// Homepage: www.dragon-productions.de
// Effect: The mage shots guided Missiles to random Enemies in the target area
//
//===========================================================================
//===========================================================================
function Trig_Magic_Missile_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0CX' )
endfunction
//===========================================================================
//===========================================================================
function Trig_Magic_Missile_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local unit missile1 = null
local unit missile2 = null
local unit missile3 = null
local group targets = null
local location targetPos = GetSpellTargetLoc()
local integer level = 0
local integer loopIndex = 0
call GroupAddUnitSimple( GetSpellTargetUnit(), targets)
set level = GetUnitAbilityLevelSwapped('A0CX', caster)
if level == 1 and true then
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 50.00, 0), bj_UNIT_FACING )
set missile1 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 00.00, 0), bj_UNIT_FACING )
set missile2 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), -50.00, 0), bj_UNIT_FACING )
set missile3 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call KillUnit (missile1)
call KillUnit (missile2)
call KillUnit (missile3)
endif
if level == 2 and true then
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 50.00, 0), bj_UNIT_FACING )
set missile1 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 00.00, 0), bj_UNIT_FACING )
set missile2 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), -50.00, 0), bj_UNIT_FACING )
set missile3 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call TriggerSleepAction (1.5)
call KillUnit (missile1)
call KillUnit (missile2)
call KillUnit (missile3)
endif
if level == 3 and true then
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 50.00, 0), bj_UNIT_FACING )
set missile1 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), 00.00, 0), bj_UNIT_FACING )
set missile2 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call CreateNUnitsAtLoc( 1, 'h015', p, OffsetLocation(GetUnitLoc(caster), -50.00, 0), bj_UNIT_FACING )
set missile3 = GetLastCreatedUnit()
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", GroupPickRandomUnit(targets) )
call TriggerSleepAction (2.5)
call KillUnit (missile1)
call KillUnit (missile2)
call KillUnit (missile3)
endif
endfunction
//===========================================================================
//===========================================================================
function InitTrig_Magic_Missile takes nothing returns nothing
set gg_trg_Magic_Missile = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magic_Missile, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Magic_Missile, Condition( function Trig_Magic_Missile_Conditions ) )
call TriggerAddAction( gg_trg_Magic_Missile, function Trig_Magic_Missile_Actions )
endfunction
//===========================================================================
function Trig_Quill_Spray_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A04X'
endfunction
function Trig_Quill_Spray_Actions takes nothing returns nothing
call UnitAddAbility(GetTriggerUnit(),'A0CB')
call SetUnitAbilityLevelSwapped('A0CB',GetTriggerUnit(),GetUnitAbilityLevelSwapped('A04X',GetTriggerUnit()))
call UnitAddAbility(GetTriggerUnit(),'A0CC')
call SetUnitAbilityLevelSwapped('A0CC',GetTriggerUnit(),GetUnitAbilityLevelSwapped('A04X',GetTriggerUnit()))
call TriggerSleepAction(6.00)
call UnitRemoveAbility(GetTriggerUnit(),'A0CB')
call UnitRemoveAbility(GetTriggerUnit(),'A0CC')
endfunction
//===========================================================================
function InitTrig_Quill_Spray takes nothing returns nothing
set gg_trg_Quill_Spray = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Quill_Spray, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Quill_Spray, Condition( function Trig_Quill_Spray_Conditions ) )
call TriggerAddAction( gg_trg_Quill_Spray, function Trig_Quill_Spray_Actions )
endfunction
function Trig_SmokeScreen_Clouds takes nothing returns boolean
if ( ( GetUnitTypeId(GetSummonedUnit()) == 'e00G' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetSummonedUnit()) == 'e00Y' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetSummonedUnit()) == 'e00Z' ) ) then
return true
endif
return false
endfunction
function Trig_SmokeScreen_Conditions takes nothing returns boolean
if ( not Trig_SmokeScreen_Clouds() ) then
return false
endif
return true
endfunction
function Trig_SmokeScreen_Actions takes nothing returns nothing
local unit smoke = GetSummonedUnit()
local integer lvl = GetUnitAbilityLevel(GetSummoningUnit(),'A07F')
call UnitAddAbility(smoke,'A04Q')
call SetUnitAbilityLevel(smoke,'A04Q',lvl)
call IssuePointOrderById(smoke,OrderId("cloudoffog"),GetUnitX(smoke),GetUnitY(smoke))
set smoke = null
endfunction
//===========================================================================
function InitTrig_SmokeScreen takes nothing returns nothing
set gg_trg_SmokeScreen = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_SmokeScreen,EVENT_PLAYER_UNIT_SUMMON)
call TriggerAddCondition(gg_trg_SmokeScreen,Condition(function Trig_SmokeScreen_Conditions))
call TriggerAddAction(gg_trg_SmokeScreen, function Trig_SmokeScreen_Actions )
// call PreLoadAbil(abil2_id)
endfunction
//+---------------------------------------------------------------------------------------------+\\
//|Spell -> Power Bash |\\
//|Author -> Nantuko Husk [email protected] |\\
//|Credits -> Nantuko Husk ( for the spell ), KaTTaNa ( for the local handle variables) |\\
//|Description -> The hero becomes like a ball and moves with high speed to the target unit to |\\
//| bash him when arrives. |\\
//|Tip -> this spell cannot be used only in the "Storm Panda" model because of the dummy|\\
//| unit, change it to something else,a rock,for example to make it behave |\\
//| like a shapeshift spell |\\
//| |\\
//|Requirements-> The Power Bash Spell,PowerBash unit. |\\
//| |\\
//|Effects -> The 'Area of effect field on the object editor determines the effect |\\
//| attached to the location of the target. |\\
//| |\\
//+---------------------------------------------------------------------------------------------+\\
//
//Power Bash Configuration
//
function PBash_SpellId takes nothing returns integer
return 'A0E0' // the rawcode of the hero spell
endfunction
function PBash_DummyId takes nothing returns integer
return 'e006' // rawcode of the dummy unit
endfunction
function PBash_Distance takes nothing returns real
return 350.0 // distance that the unit will be knockbacked
endfunction
function PBash_Damage takes integer level returns real
local real array Damage
set Damage[1] = 110 //on level 1 deals 110 damage
set Damage[2] = 160 //on level 2 deals 160 damage
set Damage[3] = 210 //on level 3 deals 210 damaage
//set Damage[x] = y //on level x deals y damage.
return Damage[level] // the damage spell does.
endfunction
function PBash_ManaRequirements takes integer lvl returns integer
local integer array mana // Put here the number of mana taken to the unit on each level.
set mana[1] = 45 //level 1 45 mana
set mana[2] = 60 //level 2 60 mana
set mana[3] = 75 //level 3 75 mana
//set mana[x] = y //level x y mana
return mana[lvl]
endfunction
function PBash_MinRange takes nothing returns real
return 300.0
endfunction
function PBash_RangeError takes nothing returns string
return "Unable to perform Power Bash at close range"
endfunction
//
//End Power Bash Configuration
//
//
//Power Bash Spell
//
function Trig_Power_Bash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == PBash_SpellId()
endfunction
function PBash_DoPowerBash_Child takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
local location ul = GetUnitLoc(u)
local location nl = PolarProjectionBJ(ul,25,GetHandleReal(t,"face"))
local real dt = GetHandleReal(t,"dt")
if dt>PBash_Distance() or IsTerrainPathable(GetUnitX(u),GetUnitY(u),PATHING_TYPE_WALKABILITY) then
call SetUnitPathing(u,true)
call FlushHandleLocals(t)
call DestroyTimer(t)
else
call SetUnitPosition(u,GetLocationX(nl),GetLocationY(nl))
set dt = dt + 25
call SetHandleReal(t,"dt",dt)
call DestroyEffect(AddSpellEffectById(PBash_SpellId(),EFFECT_TYPE_AREA_EFFECT,GetUnitX(u),GetUnitY(u)))
endif
set t = null
set u = null
call RemoveLocation(ul)
set ul = null
call RemoveLocation(nl)
set nl = null
endfunction
function PBash_DoPowerBash takes unit u,real f returns nothing
local timer t = CreateTimer()
call SetUnitPathing(u,false)
call SetHandleHandle(t,"u",u)
call SetHandleReal(t,"face",f)
call TimerStart(t,0.04,true,function PBash_DoPowerBash_Child)
set t = null
set u = null
endfunction
function PBash_GO takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit r = GetHandleUnit(t,"r")
local unit tg = GetHandleUnit(t,"tg")
local unit u = GetHandleUnit(t,"u")
local location l1 = GetUnitLoc(r)
local location l2 = GetUnitLoc(tg)
local location nl = PolarProjectionBJ(l1,25,GetUnitFacing(r))
local real dt = GetHandleReal(t,"dt")
local location op = Location(GetHandleReal(t,"opx"),GetHandleReal(t,"opy"))
if DistanceBetweenPoints(l1,l2)<110 or dt>DistanceBetweenPoints(op,l2) then
call SetUnitPositionLoc(u,l1)
call ShowUnit(r,false)
call ShowUnit(u,true)
call SelectUnitForPlayerSingle(u,GetOwningPlayer(u))
call SetUnitPathing(u,true)
call SetUnitExploded(r, true)
call KillUnit(r)
call FlushHandleLocals(t)
call DestroyTimer(t)
call UnitDamageTarget(r,tg,PBash_Damage(GetUnitAbilityLevel(u,PBash_SpellId())),true,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call PBash_DoPowerBash(tg,GetUnitFacing(u))
endif
if GetWidgetLife(tg)<1 then
call SelectUnitForPlayerSingle(u,GetOwningPlayer(u))
call SetUnitPosition(u,GetLocationX(l1),GetLocationY(l1))
call ShowUnit(r,false)
call ShowUnit(u,true)
call SetUnitPathing(u,true)
call KillUnit(r)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
if DistanceBetweenPoints(l1,l2)>110 and GetWidgetLife(tg)>1 then
call SetUnitFacingToFaceUnitTimed(u,tg,0.2)
call SetUnitPositionLocFacingLocBJ(r,nl,l2)
set dt = dt + 25
call SetHandleReal(t,"dt",dt)
endif
set t = null
set r = null
set tg= null
set u = null
call RemoveLocation(l1)
set l1 = null
call RemoveLocation(l2)
set l2 = null
call RemoveLocation(nl)
set nl = null
call RemoveLocation(op)
set op = null
endfunction
function Trig_Power_Bash_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit tg = GetSpellTargetUnit()
local unit r
local timer t = CreateTimer()
local location ul = GetUnitLoc(u)
local location tgl = GetUnitLoc(tg)
local force f = GetForceOfPlayer(GetOwningPlayer(u))
local integer lvl = GetUnitAbilityLevel(u,PBash_SpellId())
if DistanceBetweenPoints(ul,tgl)>PBash_MinRange() then
call ShowUnit(u,false)
set r = CreateUnit(GetOwningPlayer(u),PBash_DummyId(),GetUnitX(u),GetUnitY(u),GetUnitFacing(u))
call SetUnitPathing(r,false)
call SetUnitPathing(u,false)
call SetHandleHandle(t,"u",u)
call SetHandleHandle(t,"tg",tg)
call SetHandleHandle(t,"r",r)
call SetHandleReal(t,"opx",GetLocationX(ul))
call SetHandleReal(t,"opy",GetLocationY(ul))
call DestroyEffect(AddSpellEffectById(PBash_SpellId(),EFFECT_TYPE_AREA_EFFECT,GetUnitX(u),GetUnitY(u)))
call IssueImmediateOrder(u,"stop")
call SetUnitFacingToFaceUnitTimed(u,tg,0.01)
call TimerStart(t,0.04,true,function PBash_GO)
else
call ClearTextMessagesBJ(f)
call DisplayTimedTextToForce( f, 2.00, " |cffffcc00"+PBash_RangeError()+"|r" )
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+PBash_ManaRequirements(lvl))
call UnitRemoveAbility(u,PBash_SpellId())
call UnitAddAbility(u,PBash_SpellId())
call SetUnitAbilityLevel(u,PBash_SpellId(),lvl)
call IssueImmediateOrder(u,"stop")
call SetUnitAnimation(u,"stand")
endif
set u = null
set tg= null
set r = null
set t = null
call RemoveLocation(ul)
set ul = null
call RemoveLocation(tgl)
set tgl = null
endfunction
//===========================================================================
function InitTrig_PBash takes nothing returns nothing
set gg_trg_PBash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PBash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_PBash, Condition( function Trig_Power_Bash_Conditions ) )
call TriggerAddAction( gg_trg_PBash, function Trig_Power_Bash_Actions )
endfunction
constant function Boomer_SpellId takes nothing returns integer
return 'A0CY'
endfunction
constant function Boomer_Speed takes nothing returns real
return 700.0
endfunction
constant function Boomer_Angle takes nothing returns real
return 18.0
endfunction
constant function Boomer_Range takes nothing returns real
return 600.0
endfunction
constant function Boomer_Radius takes nothing returns real
return 250.0
endfunction
constant function Boomer_Collision takes nothing returns real
return 70.0
endfunction
constant function Boomer_AnimTimer takes nothing returns real
return 0.025
endfunction
constant function Boomer_Damage takes real level returns real
return 50*level
endfunction
function Boomer_DamageOptions takes nothing returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)+DamageOnlyEnemies()
endfunction
function Boomer_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Boomer_SpellId()
endfunction
function BoomerTimer2Loc takes timer t, string s returns location
return Location(GetHandleReal (t,"X"+s), GetHandleReal (t,"Y"+s))
endfunction
function BoomerAbsoluteAngle takes real a returns real
if (a<0) then
return a + 360
endif
return a
endfunction
function Boomer_AxeMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer tx = GetHandleTimer (t,"tx")
local unit c = GetHandleUnit(t,"c")
local unit u = GetHandleUnit(t,"u")
local unit picked
local integer i = GetUnitAbilityLevel(u,Boomer_SpellId())
local integer mode = GetHandleInt(t,"mode")
local integer direction = GetHandleInt(t,"dir")
local group victim = GetHandleGroup(t,"g")
local group inrange = CreateGroup()
local location l
local location lc = GetUnitLoc(c)
local location lu = GetUnitLoc(u)
local location t1 = BoomerTimer2Loc(t,"1")
local location t2 = BoomerTimer2Loc(t,"2")
local location t3 = BoomerTimer2Loc(t,"3")
local location o = PolarProjectionBJ(lu,80,GetUnitFacing(u)+(Boomer_Angle()*-direction))
local real a = GetHandleReal(t,"a")
local real d = (Boomer_Speed()*Boomer_AnimTimer()*(2*a+180))/((Boomer_Radius()*bj_PI)*(a/90+1))
local real dist
local boolean end = false
if mode == 1 then
if (DistanceBetweenPoints(lc,t2) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,t2)
call SetHandleInt(t,"mode",2)
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,t2))
call SetUnitPositionLoc(c,l)
elseif mode == 2 then
if (direction == 1) then
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)+AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)+d+AngleBetweenPoints(t1,t2))
set end = (a >= 0) or ((a < -40) and (a > -360))
else
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)-AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)-d-AngleBetweenPoints(t1,t2))
set end = (a <= 0) or ((a > 40) and (a < 360))
endif
if end then
if (direction == 1) then
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)+d)
else
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)-d)
endif
else
set l = t3
call SetHandleInt(t,"mode",3)
call SetHandleInt(tx,"mode",3)
endif
call SetUnitPositionLoc(c,l)
set end = false
elseif mode == 3 then
if (DistanceBetweenPoints(lc,o) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,o)
set end = true
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,o))
call SetUnitPositionLoc(c,l)
endif
//call DamageTreesInCircleLoc(l,Boomer_Collision())
call GroupEnumUnitsInRangeOfLoc(inrange,l,Boomer_Collision(),null)
loop
set picked = FirstOfGroup(inrange)
exitwhen picked == null
if IsUnitInGroup(picked,victim) == false then
call GroupAddUnit(victim,picked)
set a=GetDamageFactorByOptions(u,picked,Boomer_DamageOptions())
if a!=0 then
call UnitDamageTarget(u,picked,Boomer_Damage(i)*a,true,false,null,null,null)
call DestroyEffect(AddSpellEffectByIdLoc(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,l))
endif
endif
call GroupRemoveUnit(inrange,picked)
endloop
call DestroyGroup(inrange)
call RemoveLocation(o)
call RemoveLocation(l)
call RemoveLocation(lc)
call RemoveLocation(lu)
call RemoveLocation(t1)
call RemoveLocation(t2)
call RemoveLocation(t3)
if end then
call DestroyGroup(victim)
call DestroyEffect(GetHandleEffect(c,"fx"))
call SetHandleHandle(c,"fx",null)
call ExplodeUnitBJ(c)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
endfunction
function Boomer_Init takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit array c
local effect array e
local location array l
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local real a
local integer i = 1
set l[0] = GetUnitLoc(u)
set l[1] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)-Boomer_Angle())
set l[2] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)+Boomer_Angle())
set l[3] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)-Boomer_Angle())
set l[4] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)+Boomer_Angle())
set l[5] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90)
set a = AngleBetweenPoints(l[0],l[3])-AngleBetweenPoints(l[0],l[5])
set l[6] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90-a)
set l[7] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[8] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[9] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)-90-a)
loop
exitwhen i > 2
set c[i]=AddCaster()
call SetUnitOwner(c[i],GetOwningPlayer(u),true)
call SetUnitFlyHeight(c[i],S2R(GetAbilityEffectById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,1)),0)
call SetUnitPositionLoc(c[i],l[i])
call SetHandleHandle(c[i],"fx",AddSpellEffectTargetById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,c[i],"origin"))
set i=i+1
endloop
call SetHandleInt(t1,"dir",1)
call SetHandleInt(t2,"dir",-1)
call SetHandleInt(t1,"mode",1)
call SetHandleInt(t2,"mode",1)
call SetHandleHandle(t1,"c",c[1])
call SetHandleHandle(t2,"c",c[2])
call SetHandleHandle(t1,"u",u)
call SetHandleHandle(t2,"u",u)
call SetHandleHandle(t1,"g",CreateGroup())
call SetHandleHandle(t2,"g",CreateGroup())
call SetHandleHandle(t1,"tx",t2)
call SetHandleHandle(t2,"tx",t1)
call SetHandleReal(t1,"X1",GetLocationX(l[3]))
call SetHandleReal(t2,"X1",GetLocationX(l[4]))
call SetHandleReal(t1,"X2",GetLocationX(l[6]))
call SetHandleReal(t2,"X2",GetLocationX(l[7]))
call SetHandleReal(t1,"X3",GetLocationX(l[8]))
call SetHandleReal(t2,"X3",GetLocationX(l[9]))
call SetHandleReal(t1,"Y1",GetLocationY(l[3]))
call SetHandleReal(t2,"Y1",GetLocationY(l[4]))
call SetHandleReal(t1,"Y2",GetLocationY(l[6]))
call SetHandleReal(t2,"Y2",GetLocationY(l[7]))
call SetHandleReal(t1,"Y3",GetLocationY(l[8]))
call SetHandleReal(t2,"Y3",GetLocationY(l[9]))
call SetHandleReal(t1,"a",a)
call SetHandleReal(t2,"a",a)
call TimerStart(t1,0,false,function Boomer_AxeMove)
call TimerStart(t2,0,false,function Boomer_AxeMove)
call TimerStart(t1,Boomer_AnimTimer(),true,function Boomer_AxeMove)
call TimerStart(t2,Boomer_AnimTimer(),true,function Boomer_AxeMove)
set i = 0
loop
exitwhen i > 9
call RemoveLocation(l[i])
set l[i] = null
set i = i + 1
endloop
endfunction
function InitTrig_Boomer takes nothing returns nothing
set gg_trg_Boomer=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Boomer,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Boomer,Condition(function Boomer_Conditions))
call TriggerAddAction(gg_trg_Boomer,function Boomer_Init)
endfunction
function Trig_Berserkers_Call_1_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0D0' ) ) then
return false
endif
if ( not ( IsPlayerAlly(GetOwningPlayer(GetSpellAbilityUnit()), Player(5)) == true ) ) then
return false
endif
return true
endfunction
function Berserkers_Group_1 takes nothing returns boolean
return GetBooleanAnd( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true, IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Berserkers_Call_1_Actions takes nothing returns nothing
local unit v
local location l = GetUnitLoc(GetTriggerUnit())
set udg_Ber_Caster_1 = GetTriggerUnit()
call TriggerSleepAction( 0.20 )
set v = CreateUnit( GetOwningPlayer(udg_Ber_Caster_1), 'n00O', GetUnitX(udg_Ber_Caster_1), GetUnitY(udg_Ber_Caster_1), bj_UNIT_FACING )
call SetUnitAbilityLevelSwapped( 'A0DX', v, GetUnitAbilityLevelSwapped('A0D0', udg_Ber_Caster_1) )
call IssueTargetOrder( v, "innerfire", udg_Ber_Caster_1 )
call UnitApplyTimedLife( v, 'BTLF', 1.00 )
call TriggerSleepAction( ( 1.00 + ( 0.50 * I2R(GetUnitAbilityLevelSwapped('A0D0', udg_Ber_Caster_1)) ) ) )
call RemoveLocation(l)
set udg_Ber_Caster_1 = null
set l = null
set v = null
endfunction
//===========================================================================
function InitTrig_Berserkers_Call_1 takes nothing returns nothing
set gg_trg_Berserkers_Call_1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Berserkers_Call_1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Berserkers_Call_1, Condition( function Trig_Berserkers_Call_1_Conditions ) )
call TriggerAddAction( gg_trg_Berserkers_Call_1, function Trig_Berserkers_Call_1_Actions )
endfunction
function Trig_Berserkers_Call_2_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0D0' ) ) then
return false
endif
if ( not ( IsPlayerAlly(GetOwningPlayer(GetSpellAbilityUnit()), Player(11)) == true ) ) then
return false
endif
return true
endfunction
function Berserkers_Group_2 takes nothing returns boolean
return GetBooleanAnd( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true, IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Berserkers_Call_2_Actions takes nothing returns nothing
local unit v
local location l = GetUnitLoc(GetTriggerUnit())
set udg_Ber_Caster_2 = GetTriggerUnit()
call TriggerSleepAction( 0.20 )
set v = CreateUnit( GetOwningPlayer(udg_Ber_Caster_2), 'n00O', GetUnitX(udg_Ber_Caster_2), GetUnitY(udg_Ber_Caster_2), bj_UNIT_FACING )
call SetUnitAbilityLevelSwapped( 'A0DX', v, GetUnitAbilityLevelSwapped('A0D0', udg_Ber_Caster_2) )
call IssueTargetOrder( v, "innerfire", udg_Ber_Caster_2 )
call UnitApplyTimedLife( v, 'BTLF', 1.00 )
call TriggerSleepAction( ( 1.00 + ( 0.50 * I2R(GetUnitAbilityLevelSwapped('A0D0', udg_Ber_Caster_2)) ) ) )
call RemoveLocation(l)
set udg_Ber_Caster_2 = null
set l = null
set v = null
endfunction
//===========================================================================
function InitTrig_Berserkers_Call_2 takes nothing returns nothing
set gg_trg_Berserkers_Call_2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Berserkers_Call_2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Berserkers_Call_2, Condition( function Trig_Berserkers_Call_2_Conditions ) )
call TriggerAddAction( gg_trg_Berserkers_Call_2, function Trig_Berserkers_Call_2_Actions )
endfunction
function Trig_BattleHunger_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetKillingUnit(),'B03E')>0 // Battle Hunger buff rawcode
endfunction
function Trig_BattleHunger_Actions takes nothing returns nothing
call UnitRemoveAbility(GetKillingUnit(),'B03E')
endfunction
//===========================================================================
function InitTrig_BattleHunger takes nothing returns nothing
set gg_trg_BattleHunger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_BattleHunger,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( gg_trg_BattleHunger, function Trig_BattleHunger_Actions)
call TriggerAddCondition(gg_trg_BattleHunger,Condition(function Trig_BattleHunger_Conditions))
endfunction
function Trig_CullingBlade_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A03G' // CullingBlade ability rawcode
endfunction
function Life takes integer lvl returns real
if lvl==1 then //Life at which the spell will insta-kill
return 300.
// elseif lvl==2 then
// return 450.
// else
// return 625.
endif
return 0.
endfunction
function Trig_CullingBlade_Actions takes nothing returns nothing
local real life = GetWidgetLife(GetSpellTargetUnit())
if life<Life(GetUnitAbilityLevel(GetTriggerUnit(),'A03G')) then
call UnitDamageTarget(GetTriggerUnit(),GetSpellTargetUnit(),99999.,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
call CreateTextTagUnitBJ( "Culling Blade", GetSpellTargetUnit(), 0, 8.00, 100, 15.00, 15.00, 0 )
call TriggerExecute( gg_trg_Destroy_Text )
endif
endfunction
//===========================================================================
function InitTrig_CullingBlade takes nothing returns nothing
set gg_trg_CullingBlade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_CullingBlade,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_CullingBlade,Condition(function Trig_CullingBlade_Conditions))
call TriggerAddAction(gg_trg_CullingBlade, function Trig_CullingBlade_Actions)
endfunction