Name | Type | is_array | initial_value |
B | integer | No | |
Caster | unit | Yes | |
CubeLevel | integer | Yes | |
E1 | effect | Yes | |
E2 | effect | Yes | |
E3 | effect | Yes | |
E4 | effect | Yes | |
E5 | effect | Yes | |
E6 | effect | Yes | |
E7 | effect | Yes | |
E8 | effect | Yes | |
Group | group | Yes | |
L1 | lightning | Yes | |
L10 | lightning | Yes | |
L11 | lightning | Yes | |
L12 | lightning | Yes | |
L2 | lightning | Yes | |
L3 | lightning | Yes | |
L4 | lightning | Yes | |
L5 | lightning | Yes | |
L6 | lightning | Yes | |
L7 | lightning | Yes | |
L8 | lightning | Yes | |
L9 | lightning | Yes | |
N | integer | No | |
P1 | location | Yes | |
P2 | location | Yes | |
P3 | location | Yes | |
P4 | location | Yes | |
PMain | location | Yes | |
SCubeDamage | real | Yes | |
SCubeDuration | integer | Yes | |
SCubeRadius | real | Yes | |
SCubeTypeE | string | Yes | |
SCubeTypeL | lightningtype | Yes | |
StunGroup | group | No | |
T | trigger | Yes | |
Timer | integer | Yes |
//---Conditions for units when we add them to cube (unit must be alive, not building, not in other cube and an enemy of caster)---
function GroupCon takes nothing returns boolean
local unit bu = GetFilterUnit()
local boolean b1 = (GetWidgetLife(bu) >= 0.405)
local boolean b2 = (IsUnitType(bu, UNIT_TYPE_STRUCTURE) == false )
local boolean b3 = (IsUnitInGroup(bu, udg_StunGroup) == false )
local boolean b4 = (IsUnitEnemy(bu, GetOwningPlayer(udg_Caster[udg_N])) == true )
return (b1 and b2 and b3 and b4)
endfunction
//---Actions for all units in area when we cast cube (give them ability to change Z and add them to a special group to not get affected by other cube)---
function StunTarget takes nothing returns nothing
local unit u2 = GetEnumUnit()
local effect e = AddSpecialEffectTarget( "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", u2, "origin" )
call GroupAddUnit( udg_StunGroup, u2 )
call UnitAddAbility( u2, 'Amrf' )
call UnitRemoveAbility( u2, 'Amrf' )
call BlzPauseUnitEx( u2, true)
set u2 = null
call DestroyEffect(e)
endfunction
//--- Those actions happens every 0.04(in Group) seconds inside the cube(changing Z and dealing magic damage)---
function DamageCube takes nothing returns nothing
local unit u = udg_Caster[udg_B]
local unit u2 = GetEnumUnit()
call SetUnitFlyHeight( u2, (GetUnitDefaultFlyHeight(u2) + I2R(udg_Timer[udg_B]*4)), 99999.00 )
call UnitDamageTarget( u, u2, ((udg_SCubeDamage[udg_CubeLevel[udg_B]])/(I2R(udg_SCubeDuration[udg_CubeLevel[udg_B]]) * 25)), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
set u = null
set u2 = null
endfunction
//--- Actions every 0.04 seconds after casting cube. We change locations for effects and lightnings and call actions for Group (see upper)---
function CubeSpin takes nothing returns nothing
//--- first we must detect number of massive (we want separate varibles for each cube to make it MUI)---
local unit gu
local integer a = 1
loop
exitwhen a > 100
if ( GetTriggeringTrigger() == udg_T[a] ) then
set udg_B = a
else
endif
set a = a + 1
endloop
//---Timer helps us to change Z, angle and detect duration of cube---
set udg_Timer[udg_B] = udg_Timer[udg_B] + 1
if udg_Timer[udg_B] < (25 * udg_SCubeDuration[udg_CubeLevel[udg_B]]) then
//---Remove old points and create new ones---
call RemoveLocation(udg_P1[udg_B])
call RemoveLocation(udg_P2[udg_B])
call RemoveLocation(udg_P3[udg_B])
call RemoveLocation(udg_P4[udg_B])
set udg_P1[udg_B] = Location(GetLocationX(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Cos(0.00 + I2R(udg_Timer[udg_B])/10) ),GetLocationY(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Sin(0.00 + I2R(udg_Timer[udg_B])/10) ))
set udg_P2[udg_B] = Location(GetLocationX(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Cos(1.57079 + I2R(udg_Timer[udg_B])/10) ),GetLocationY(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Sin(1.57079 + I2R(udg_Timer[udg_B])/10) ))
set udg_P3[udg_B] = Location(GetLocationX(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Cos(3.14159 + I2R(udg_Timer[udg_B])/10) ),GetLocationY(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Sin(3.14159 + I2R(udg_Timer[udg_B])/10) ))
set udg_P4[udg_B] = Location(GetLocationX(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Cos(4.71238 + I2R(udg_Timer[udg_B])/10) ),GetLocationY(udg_PMain[udg_B]) + ( udg_SCubeRadius[udg_CubeLevel[udg_B]] * Sin(4.71238 + I2R(udg_Timer[udg_B])/10) ))
//---Move effects and lightning to new points and call group (when we damage units and change Z, see upper)---
call BlzSetSpecialEffectPosition( udg_E1[udg_B], GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E2[udg_B], GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E3[udg_B], GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E4[udg_B], GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E5[udg_B], GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E6[udg_B], GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E7[udg_B], GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4) )
call BlzSetSpecialEffectPosition( udg_E8[udg_B], GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4) )
call MoveLightningEx(udg_L1[udg_B], true, GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L2[udg_B], true, GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L3[udg_B], true, GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L4[udg_B], true, GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L5[udg_B], true, GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L6[udg_B], true, GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L7[udg_B], true, GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L8[udg_B], true, GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L9[udg_B], true, GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P1[udg_B]), GetLocationY(udg_P1[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L10[udg_B], true, GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P2[udg_B]), GetLocationY(udg_P2[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L11[udg_B], true, GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P3[udg_B]), GetLocationY(udg_P3[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call MoveLightningEx(udg_L12[udg_B], true, GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), I2R(udg_Timer[udg_B]*4), GetLocationX(udg_P4[udg_B]), GetLocationY(udg_P4[udg_B]), udg_SCubeRadius[udg_CubeLevel[udg_B]] + I2R(udg_Timer[udg_B]*4))
call ForGroup( udg_Group[udg_B], function DamageCube )
else
//---I.f timer*25(this is because every 0.04, 0.04*25 = 1) becomes more then duration then we stop trigger, call group(to return default Z and remove stuns) and destory all variables---
call DisableTrigger(udg_T[udg_B])
loop
set gu = FirstOfGroup(udg_Group[udg_B])
exitwhen ( gu == null)
call GroupRemoveUnit(udg_Group[udg_B],gu)
call GroupRemoveUnit(udg_StunGroup,gu)
call SetUnitFlyHeight( gu, GetUnitDefaultFlyHeight(gu), 2000.00 )
call BlzPauseUnitEx( gu, false)
endloop
call RemoveLocation(udg_P1[udg_B])
call RemoveLocation(udg_P2[udg_B])
call RemoveLocation(udg_P3[udg_B])
call RemoveLocation(udg_P4[udg_B])
call RemoveLocation(udg_PMain[udg_B])
call DestroyEffect(udg_E1[udg_B])
call DestroyEffect(udg_E2[udg_B])
call DestroyEffect(udg_E3[udg_B])
call DestroyEffect(udg_E4[udg_B])
call DestroyEffect(udg_E5[udg_B])
call DestroyEffect(udg_E6[udg_B])
call DestroyEffect(udg_E7[udg_B])
call DestroyEffect(udg_E8[udg_B])
call DestroyLightning(udg_L1[udg_B])
call DestroyLightning(udg_L2[udg_B])
call DestroyLightning(udg_L3[udg_B])
call DestroyLightning(udg_L4[udg_B])
call DestroyLightning(udg_L5[udg_B])
call DestroyLightning(udg_L6[udg_B])
call DestroyLightning(udg_L7[udg_B])
call DestroyLightning(udg_L8[udg_B])
call DestroyLightning(udg_L9[udg_B])
call DestroyLightning(udg_L10[udg_B])
call DestroyLightning(udg_L11[udg_B])
call DestroyLightning(udg_L12[udg_B])
set udg_Caster[udg_B] = null
call DestroyGroup(udg_Group[udg_B])
set udg_Group[udg_B] = CreateGroup()
call DestroyTrigger(udg_T[udg_B])
endif
endfunction
//---Actions when we cast spell---
function CubeCast takes nothing returns nothing
local unit u
//---Check the right ability and create separate massive number for each new cube (to make it MUI)---
if ( GetSpellAbilityId() == 'A000' ) then
if udg_N >= 100 then
set udg_N = 1
else
set udg_N = udg_N + 1
endif
//---Set variables (unit, locations, effects and lightnings)---
set udg_Caster[udg_N] = GetTriggerUnit()
set udg_PMain[udg_N] = GetSpellTargetLoc()
set udg_Timer[udg_N] = 0
set udg_CubeLevel[udg_N] = GetUnitAbilityLevel( udg_Caster[udg_N], 'A000')
set udg_P1[udg_N] = Location(GetLocationX(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Cos(0.00) ),GetLocationY(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Sin(0.00) ))
set udg_P2[udg_N] = Location(GetLocationX(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Cos(1.57079) ),GetLocationY(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Sin(1.57079) ))
set udg_P3[udg_N] = Location(GetLocationX(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Cos(3.14159) ),GetLocationY(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Sin(3.14159) ))
set udg_P4[udg_N] = Location(GetLocationX(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Cos(4.71238) ),GetLocationY(udg_PMain[udg_N]) + ( udg_SCubeRadius[udg_CubeLevel[udg_N]] * Sin(4.71238) ))
set udg_E1[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P1[udg_N] )
set udg_E2[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P2[udg_N] )
set udg_E3[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P3[udg_N] )
set udg_E4[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P4[udg_N] )
set udg_E5[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P1[udg_N] )
set udg_E6[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P2[udg_N] )
set udg_E7[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P3[udg_N] )
set udg_E8[udg_N] = AddSpecialEffectLoc( udg_SCubeTypeE[udg_CubeLevel[udg_N]], udg_P4[udg_N] )
call BlzSetSpecialEffectZ( udg_E5[udg_N], udg_SCubeRadius[udg_CubeLevel[udg_N]] )
call BlzSetSpecialEffectZ( udg_E6[udg_N], udg_SCubeRadius[udg_CubeLevel[udg_N]] )
call BlzSetSpecialEffectZ( udg_E7[udg_N], udg_SCubeRadius[udg_CubeLevel[udg_N]] )
call BlzSetSpecialEffectZ( udg_E8[udg_N], udg_SCubeRadius[udg_CubeLevel[udg_N]] )
set udg_L1[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), 0, GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), 0)
set udg_L2[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), 0, GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), 0)
set udg_L3[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), 0, GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), 0)
set udg_L4[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), 0, GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), 0)
set udg_L5[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]], GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L6[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]], GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L7[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]], GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L8[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]], GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L9[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), 0, GetLocationX(udg_P1[udg_N]), GetLocationY(udg_P1[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L10[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), 0, GetLocationX(udg_P2[udg_N]), GetLocationY(udg_P2[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L11[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), 0, GetLocationX(udg_P3[udg_N]), GetLocationY(udg_P3[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
set udg_L12[udg_N] = AddLightningEx(udg_SCubeTypeL[udg_CubeLevel[udg_N]], true, GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), 0, GetLocationX(udg_P4[udg_N]), GetLocationY(udg_P4[udg_N]), udg_SCubeRadius[udg_CubeLevel[udg_N]])
//---Stun targets in group (see upper) and create new periodic trigger (see upper)---
call GroupEnumUnitsInRangeOfLoc(udg_Group[udg_N], udg_PMain[udg_N], udg_SCubeRadius[udg_CubeLevel[udg_N]], Condition(function GroupCon))
call ForGroup( udg_Group[udg_N], function StunTarget )
set udg_T[udg_N] = CreateTrigger()
call TriggerRegisterTimerEvent( udg_T[udg_N], 0.04, true )
call TriggerAddAction( udg_T[udg_N], function CubeSpin )
set u = null
else
set u = null
endif
endfunction
//---Event of main trigger---
function InitTrig_Stazis_Cube takes nothing returns nothing
local integer i = 0
set gg_trg_Stazis_Cube = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Stazis_Cube, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYERS
endloop
call TriggerAddAction( gg_trg_Stazis_Cube, function CubeCast )
endfunction