// ===========================Damage Enemies System
function FilterIsEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer)
endfunction
function DamageEnemiesArea takes unit whichUnit, real radius, real x, real y, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns nothing
local group g = CreateGroup()
local boolexpr b = Condition(function FilterIsEnemy)
local unit t
set bj_groupEnumOwningPlayer = GetOwningPlayer(whichUnit)
call GroupEnumUnitsInRange(g, x, y, radius, b)
call DestroyBoolExpr(b)
loop
set t = FirstOfGroup(g)
exitwhen t == null
call GroupRemoveUnit(g,t)
call UnitDamageTarget(whichUnit,t,amount,attack, ranged,attackType,damageType,weaponType)
endloop
call DestroyGroup(g)
set g = null
set b = null
endfunction
// ===========================
// ===========================Local Handle Vars By: Kattana
function H2I takes handle h returns integer
return h
return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
if udg_Cache == null then
call FlushGameCache(InitGameCache("somename"))
set udg_Cache = InitGameCache("somename")
endif
return udg_Cache
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLocation takes handle subject, string name returns location
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
// ===========================
Name | Type | is_array | initial_value |
Bobo | unit | No | |
Cache | gamecache | No | |
Cannon_Unit | unit | No | |
Forsee_Learner | unit | No | |
Kills | integer | No | |
Owner_of_Chating_Unit | unit | No | |
Owner_Of_Rune | unit | No | |
Rune | unit | No | |
Rune2 | unit | No | |
Rune_Integer | integer | No | |
Temp | unit | No |
function Trig_Toss_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
function Toss_Unit_Group takes nothing returns boolean
if ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_ANCIENT) == true ) then
return false
endif
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
return false
elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) then
return false
elseif GetFilterUnit() == GetSpellAbilityUnit() then
return false
elseif IsUnitDeadBJ(GetFilterUnit()) then
return false
endif
return true
endfunction
function Toss_Destroy_Trees takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
function TossFX takes nothing returns nothing
local effect f= bj_lastCreatedEffect
call TriggerSleepAction(0.4)
call DestroyEffect(f)
set f=null
endfunction
function Toss_Movement takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u=GetHandleUnit(t,"t")
local real b=GetHandleReal(t,"r")
local real n=GetHandleReal(t,"n")
local real d=GetHandleReal(t,"d")
local location l=GetHandleLocation(t,"l")
local real x=-d+(d*(b/50))
local location m=PolarProjectionBJ(l,x,n)
local real y=((b-25)*(b-25))
call SetUnitPositionLoc(u,m)
call SetUnitFlyHeight( u, ( 775-y ) , 10000.00 )
if GetRandomInt(1,4)==2 then
call AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl" )
call TriggerExecute(gg_trg_DestroyFX)
endif
set b=b+1
call SetHandleReal(t,"r",b)
set t=null
set u=null
set b=0
set n=0
set d=0
set l=null
set x=0
call RemoveLocation(m)
set m=null
set y=0
endfunction
function Trig_Toss_Actions takes nothing returns nothing
local group g=CreateGroup()
local unit c=GetTriggerUnit()
local unit a=null
local location l=GetSpellTargetLoc()
local timer t=null
local real b=1
local real d=0
local real n=0
call GroupEnumUnitsInRange(g,GetUnitX(c),GetUnitY(c),275,Condition(function Toss_Unit_Group))
set a=GroupPickRandomUnit(g)
call GroupClear(g)
if a!=null then
call SetUnitAnimationByIndex(c,4)
call PauseUnitBJ( true, a )
call SetUnitPathing( a, false )
call SetUnitFacingToFaceLocTimed( a, l, 0 )
call UnitAddAbilityBJ( 'A002', a )
call UnitRemoveAbilityBJ( 'A002', a )
set t=CreateTimer()
call SetHandleHandle(t,"t",a)
call SetHandleReal(t,"r",b)
set d = DistanceBetweenPoints(GetUnitLoc(c), l)
set n= AngleBetweenPoints(GetUnitLoc(c), l)
call SetHandleReal(t,"d",d)
call SetHandleReal(t,"n",n)
call SetHandleHandle(t,"l",l)
call TimerStart(t,0.02,true,function Toss_Movement)
call TriggerSleepAction(1.0)
call RemoveLocation(l)
set l=GetHandleLocation(t,"l")
call RemoveLocation(l)
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
call SetUnitFlyHeightBJ( a, GetUnitDefaultFlyHeight(a), 10000.00 )
call PauseUnitBJ( false, a )
call SetUnitPathing( a, true )
set l=GetUnitLoc(a)
call DestroyEffect(AddSpellEffectByIdLoc('A0BZ', EFFECT_TYPE_TARGET, l))
call TerrainDeformationRippleBJ( 0.2, true, l, 1.00, 300.00, 96.00, 1, 64.00 )
call UnitDamageTargetBJ( c, a, 38.00 * I2R(GetUnitAbilityLevelSwapped('A004', c)) , ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEMOLITION )
set g = GetUnitsInRangeOfLocAll(300.00, l)
loop
set a = FirstOfGroup(g)
exitwhen a == null
call GroupRemoveUnit(g,a)
call UnitDamageTargetBJ( c, a, 75.00 * I2R(GetUnitAbilityLevelSwapped('A004', c)) , ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEMOLITION )
endloop
call EnumDestructablesInCircleBJ( 300,l , function Toss_Destroy_Trees )
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",GetLocationX(l),GetLocationY(l)))
endif
call DestroyGroup(g)
set g=null
set c=null
set a=null
call RemoveLocation(l)
set l=null
set t=null
set b=0
set n=0
set d=0
endfunction
//===========================================================================
function InitTrig_Toss takes nothing returns nothing
set gg_trg_Toss = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Toss, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Toss, Condition( function Trig_Toss_Conditions ) )
call TriggerAddAction( gg_trg_Toss, function Trig_Toss_Actions )
endfunction
function Trig_DestroyFX_Actions takes nothing returns nothing
local effect f=bj_lastCreatedEffect
call TriggerSleepAction( 1.00 )
call DestroyEffect(f)
set f=null
endfunction
//===========================================================================
function InitTrig_DestroyFX takes nothing returns nothing
set gg_trg_DestroyFX = CreateTrigger( )
call TriggerAddAction( gg_trg_DestroyFX, function Trig_DestroyFX_Actions )
endfunction