BRUTAL
I'm working
- Reaction score
- 118
Ice Pillar
Requires AIDS, Damage, Event, GTrigger, Key Timers 2; all included in the map.
Spell Description: Sub-Zero shoots out ice from underneath the target throwing the target in the air and freezing the target.
Screen Shots:
Sub-Zero's Ice Pillar ability recreated.
Feedback is welcomed, if you see any bugs or mistakes let me know.
DL the map.
Requires AIDS, Damage, Event, GTrigger, Key Timers 2; all included in the map.
Spell Description: Sub-Zero shoots out ice from underneath the target throwing the target in the air and freezing the target.
Screen Shots:
JASS:
// Ice Pillar by BRUTAL.
// Requires AIDS, Damage, Event, GT, and KT2.
// Credits are welcome but not necessary.
// October 12th 2009.
scope icepillar initializer init
globals
private constant integer ID=039;A000039; // ID of the ice pillar spell.
private constant integer ID2=039;A001039; // ID of the freeze-stun spell that DUMMY will cast on the target.
private constant integer DUMMY_ID=039;h000039; // ID of the blizzard unit.
private constant integer DUMMY_ID2=039;h001039; // ID of the ice unit.
private constant integer DUMMY_ID3=039;h002039; // ID of the global DUMMY unit.
private constant integer BUFF=039;B000039; // ID of the freeze-stun buff.
private constant integer PILLARS=8 // The number of pillars shot up.
private constant real PILLAR_DIS=75. // How far pillars are created from the target point.
private constant real PERIOD=.02 // Period of the KT2 timer.
private constant real SPEED=1500. // How fast the unit is pushed back when attacked.
private constant real SCALE_BLIZ=1.5 // Scale size of the blizzard unit.
private constant real SCALE_ICE=.6 // Scale size of the ice unit.
private constant string SOUND="Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTarget1.wav"
// The sound that is played when the target is frozen.
private constant boolean DODGEABLE=false // Setting this to false will stun the target instantly
// when the spell is casted, thus making the spell undodgeable. If left on true, the target unit will be stunned
// if it is within AOE of its original position at spell cast.
private constant real AOE=125. // Applies only if DODGEABLE is set to true, otherwise ignore this.
// This is the AOE that the target unit must be within from the point the target was at spell cast.
private unit DUMMY // The global dummy unit.
private real MapMaxX
private real MapMaxY
private real MapMinX
private real MapMinY
private integer filter
endglobals
private function DAMAGE takes unit u, integer level returns real
return 100.+GetHeroStr(u,true)*level // Damage the target receives when it is shot up.
endfunction
private function LANDDAMAGE takes nothing returns real
return 50. // Damage the target receives from hitting the ground.
endfunction
private function Fly takes unit u, real h, real r returns nothing
call UnitAddAbility(u,039;Amrf039;) // Adds crow form to whatever unit, then sets
call SetUnitFlyHeight(u,h,r) // the height and rate, then remove crow form.
call UnitRemoveAbility(u,039;Amrf039;)
endfunction
private function Text takes unit u, real damage returns nothing
local texttag tt=CreateTextTag() // This creates floating text.
if u!=null then
call SetTextTagText(tt,I2S(R2I(damage)),.023)
call SetTextTagPosUnit(tt,u,-125)
call SetTextTagColor(tt,255,0,0,255)
call SetTextTagPermanent(tt,false)
call SetTextTagVelocity(tt,0,.044)
call SetTextTagLifespan(tt,3)
call SetTextTagFadepoint(tt,2)
endif
set tt=null
endfunction
private struct Data
unit caster
unit target
unit ice
real x
real y
real dx
real dy
real hittimer=0
boolean hit=false
boolean safe=false
integer ticks=157
static method create takes unit u, unit t returns Data
local Data data=Data.allocate()
local integer i=1
local unit d
local real angle
local real x
local real y
local real tx=GetUnitX(t)+150*Cos(90*bj_DEGTORAD)
local real ty=GetUnitY(t)+150*Sin(90*bj_DEGTORAD)
set data.caster=u
set data.target=t
set data.x=GetUnitX(t)
set data.y=GetUnitY(t)
if DODGEABLE==false then
call IssueTargetOrder(DUMMY,"thunderbolt",t)
endif
loop
exitwhen i>PILLARS
set angle=360/PILLARS*i
set x=tx+PILLAR_DIS*Cos(angle*bj_DEGTORAD)
set y=ty+PILLAR_DIS*Sin(angle*bj_DEGTORAD)
set d=CreateUnit(Player(13),DUMMY_ID,x,y,bj_UNIT_FACING)
call SetUnitScale(d,SCALE_BLIZ,SCALE_BLIZ,SCALE_BLIZ)
call UnitApplyTimedLife(d,039;BTLF039;,1)
set i=i+1
endloop
set d=null
return data
endmethod
static method damage takes nothing returns nothing
local real x
local real y
local real cx
local real cy
local real dx
local real dy
if GetEventDamageSource()==Data(filter).caster and GetTriggerUnit()==Data(filter).target and Data(filter).safe==true and Data(filter).ticks<=125 then
set x=GetUnitX(Data(filter).target)
set y=GetUnitY(Data(filter).target)
set cx=GetUnitX(Data(filter).caster)
set cy=GetUnitY(Data(filter).caster)
set dx=x-cx
set dy=y-cy
set Data(filter).dx=(SPEED*PERIOD)*Cos(Atan2(dy,dx))
set Data(filter).dy=(SPEED*PERIOD)*Sin(Atan2(dy,dx))
call SetUnitTimeScale(Data(filter).target,1)
call Fly(Data(filter).ice,0,450)
call Fly(Data(filter).target,0,450)
set Data(filter).hit=true
set Data(filter).safe=false
set Data(filter).ticks=9
call KillUnit(Data(filter).ice)
endif
endmethod
method move takes nothing returns nothing
local real dmg=DAMAGE(.caster,GetUnitAbilityLevel(.caster,ID))
local real dmg2=LANDDAMAGE()
local sound s
local real x=GetUnitX(.target)
local real y=GetUnitY(.target)
set filter=this
if .ticks==136 then
if .x-x*.x-x+.y-y*.y-y<=AOE*AOE then
if DODGEABLE==true then
call IssueTargetOrder(DUMMY,"thunderbolt",.target)
endif
set s=CreateSound(SOUND,false,false,false,10,10,"")
call StartSound(s)
call AttachSoundToUnit(s,.target)
call KillSoundWhenDone(s)
set s=null
call Damage_Spell(.caster,.target,dmg)
call Text(.target,dmg)
if GetWidgetLife(.target)<=.405 then
set .ticks=0
else
set .safe=true
set .ice=CreateUnit(Player(13),DUMMY_ID2,x,y,124)
call SetUnitScale(.ice,SCALE_ICE,SCALE_ICE,SCALE_ICE)
call Fly(.ice,150,450)
call Fly(.target,150,450)
call UnitApplyTimedLife(.ice,039;BTLF039;,3)
call SetUnitTimeScale(.target,0)
endif
else
set .ticks=0
endif
endif
if .hit==true then
set x=x+.dx
set y=y+.dy
if x>MapMaxX or x<MapMinX then
set .dx=-.dx
endif
if y>MapMaxY or y<MapMinY then
set .dy=-.dy
endif
call SetUnitX(.target,x)
call SetUnitY(.target,y)
call SetUnitX(.ice,x)
call SetUnitY(.ice,y)
if .hittimer==.12 then
call Damage_Pure(.caster,.target,dmg2)
call Text(.target,dmg2)
call UnitRemoveAbility(Data(filter).target,BUFF)
endif
set .hittimer=.hittimer+.02
endif
endmethod
method end takes nothing returns nothing
call Fly(.ice,0,450)
call Fly(.target,0,450)
call SetUnitTimeScale(.target,1)
call KillUnit(.ice)
set .hit=false
set .safe=false
endmethod
endstruct
private function PeriodicFunc takes nothing returns boolean
local Data data=KT_GetData()
set data.ticks=data.ticks-1
if data.ticks<=0 then
call data.end()
return true
else
call data.move()
return false
endif
endfunction
private function actions takes nothing returns nothing
call KT_Add(function PeriodicFunc,Data.create(GetTriggerUnit(),GetSpellTargetUnit()),PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddAction(GT_RegisterStartsEffectEvent(CreateTrigger(),ID),function actions)
call Damage_RegisterEvent(t)
call TriggerAddAction(t,function Data.damage)
set DUMMY=CreateUnit(Player(0),DUMMY_ID3,0,0,0)
call UnitAddAbility(DUMMY,ID2)
set MapMaxX=GetRectMaxX(bj_mapInitialPlayableArea)
set MapMaxY=GetRectMaxY(bj_mapInitialPlayableArea)
set MapMinX=GetRectMinX(bj_mapInitialPlayableArea)
set MapMinY=GetRectMinY(bj_mapInitialPlayableArea)
endfunction
endscope
Sub-Zero's Ice Pillar ability recreated.
Feedback is welcomed, if you see any bugs or mistakes let me know.
DL the map.