Ice Pillar v1.02 by BlackRose
What?
Creates a pillar of ice that spirals upwards, after reaching a height, the pillar explodes and pushes all nearby units outwards, and freezes them.
Requirements:
- NewGen
- KeyTimers2 by Jesus4Lyf
- KBS by Kenny!
- xefx by Vexorian
Document
JASS:
Ice Pillar by BlackRose
---------------------------
Version: 1.02
Date released: 4th September 2009
Date updated: 6th September 2009
Creates a pillar of ice that spirals upwards, after reaching a height, the pillar explodes
and pushes all nearby units outwards, and freezes them.
This ability IS MUI.
This ability may lower FPS depending on Duration, TIMER_INTERVAL, and how many instances are summoned.
How to import:
--------------
- Make sure you have JassNewGenPack.
1. Copy the Systems folder and Ice Pillar trigger into your map.
2. Copy all objects needed. Copy "Ice Pillar - SFX" and "xe unit (Caster System?", and the abilities and buff.
3. Make sure to update rawcode (of Ice Pillar trigger and xebasic)
4. Make sure to import the imported files, FrostWyrmMissile(New) and Dummy.
5. Done!
Version history:
----------------
v1.00: 4th September 2009 Friday
- Initial release.
v1.01: 5th September 2009 Saturday
- Code update.
v1.02: 6th September 2009 Sunday
- SFX UPDATE!
- MYFLASH is configurable now!
Credits:
--------
- Jesus4Lyf for KeyTimers2.
- Vexorian for xe.
- JassNewGenPack team.
- Made for TheHelper.net AND hiveworkshop.com Resources forum, DO NOT REDISTRUBUTE at all.
Contact can be made by PMing me at TheHelper forums, Username: BlackRose
Coding:
(We all know no one checks the actual spell, only the coding)
JASS:
// Version 1.02.
scope IcePillar initializer Init //requires KT, KBS, xefx
globals
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// OBJECT RAWCODE
// UPDATE HERE! CTRL + D
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private constant integer SPELL_ID = 039;A000039;
private constant integer DUMMY_ID = 039;e000039;
private constant integer BUFF_ID = 039;B000039;
private constant integer LICH_SFX_ID = 039;A001039;
private constant integer WYRM_SFX_ID = 039;A002039;
private constant integer STUN_ID = 039;A003039;
private constant string STUN_STRING = "thunderbolt"
private constant boolean IS_ULTIMATE = false // - Is this ability ultimate? Target immune.
private constant real TIMER_INTERVAL = 0.03125
private constant real ROTATE_SPEED = 10.
private constant attacktype ATK_TYPE = ATTACK_TYPE_NORMAL
private constant damagetype DMG_TYPE = DAMAGE_TYPE_MAGIC
private constant weapontype WPN_TYPE = null
private constant real MAX_HEIGHT = 1000// - Height the pillar will reach.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// COSMETICS
// If you want to edit the model of the pillar, go to Object Editor Abilities and modify the SFX.
// To disable FLASH_SFX or TRIAL_SFX just put " ".
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private constant real PILLAR_SCALE = 1.00 // SCALE of the parts of the pillar
private constant real TRAIL_SCALE = 1.00 // Scale of the trail.
private constant string FLASH_SFX = " "//"Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdx"
private constant string TRAIL_SFX = "Abilities\\Spells\\NightElf\\SpiritOfVengeance\\SpiritOfVengeanceBirthMissile.mdx"
private constant boolean FREEZE_ANIMATION = true// Enemy units freeze animation when frozen?
private constant real HEIGHT_VISIBILITY = 1100 // Cannot see usually above here.
// Units won't be created if height > this.
endglobals
private function SPELL_AOE takes integer level returns real
return 350. + ( level * 0. )
endfunction
private function SPELL_DURATION takes integer level returns real
return 2. + ( level * 0. )
endfunction
// Distance of the knockback? Add levels as necessary, level being in [x]
private function SPELL_KB_DISTANCE takes integer level returns real
return 150. * level
endfunction
private function SPELL_DAMAGE takes integer level returns real
return 50. * level
endfunction
/*------------------------------------------------------------
!!! <>< FISHY TRIAL ><> !!! Fish Pillar begins here.
-------------------------------------------------------------*/
globals
private constant group Group = CreateGroup() // For instant enum. NO DYNAMIC-STABILITY! ??? lolwut.
private unit DUMMY_CASTER // Have 1 dummy unit cast all Storm Bolts.
// Unit Filtering.
private boolexpr G_UFilter = null // Save 1 call.
private unit TempUnit = null // Save a fe calls.
private player TempPlayer = null // Passing.
private integer TempInt = 0
private unit TempCaster = null
private real KBDist
private real Damage
private real TempX
private real TempY
endglobals
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ANIMATION FREEZING
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private struct BFData
unit Target
static method create takes unit u returns BFData
local BFData d = BFData.allocate()
set d.Target = u
return d
endmethod
method onDestroy takes nothing returns nothing
call SetUnitTimeScale( .Target, 1.00 )
endmethod
static method Update takes nothing returns boolean
local BFData d = KT_GetData()
call SetUnitTimeScale( d.Target, 0 )
// If they somehow lose the bugg, or they become magic immune and the spell is not an ultimate, or they die.
if (GetUnitAbilityLevel( d.Target, BUFF_ID ) == 0) or (IsUnitType( d.Target, UNIT_TYPE_MAGIC_IMMUNE ) and not IS_ULTIMATE ) /*
*/ or ( IsUnitType( d.Target, UNIT_TYPE_DEAD )) then
call d.destroy()
return true
endif
return false
endmethod
endstruct
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I C E P I L L A R
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private struct IPData
unit Caster
player Owner
real TX
real TY
real Height = 0.00
integer Counter = 0
integer LevelX
real AoE
real angle = 0
real SECONDS = 0.00
real Damage
real HeightModifier
real Duration
real a2n = 0
group IcePillar = CreateGroup()
xefx fx
static method UFilter takes nothing returns boolean
local real angle = 0.00
local boolean b
set TempUnit = GetFilterUnit()
if IsUnitEnemy( TempUnit, TempPlayer ) and not IsUnitType( TempUnit, UNIT_TYPE_DEAD ) then
call SetUnitAbilityLevel( DUMMY_CASTER, STUN_ID, TempInt )
call SetUnitPosition( DUMMY_CASTER, TempX , TempX )
call SetUnitOwner( DUMMY_CASTER, TempPlayer, false )
// If this spell is not an ultimate, and the target is a magic immune, yes, let them be hurt.
if IsUnitType( TempUnit, UNIT_TYPE_MAGIC_IMMUNE ) and not IS_ULTIMATE then
debug call BJDebugMsg ("THIS SPELL IS NOT AN ULTIMATE, DOES NOT HURT " + GetUnitName( TempUnit ) )
return false
endif
set angle = Atan2( GetUnitY( TempUnit ) - TempY, GetUnitX( TempUnit ) - TempX ) * bj_RADTODEG
call UnitDamageTarget( TempCaster, TempUnit, Damage, true, false, ATK_TYPE, DMG_TYPE, WPN_TYPE )
set b = IssueTargetOrder( DUMMY_CASTER, STUN_STRING, TempUnit )
call KBS_BeginCommon( TempUnit, KBDist,.8,angle)
if FREEZE_ANIMATION then
call KT_Add( function BFData.Update, BFData.create( TempUnit ), TIMER_INTERVAL )
endif
if not b then
debug call BJDebugMsg( "Target cannot be stunned <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" loading="lazy" data-shortname=":(" />")
endif
endif
return false
endmethod
method onDestroy takes nothing returns nothing
local unit u
local real angle
local BFData d
// Initial dummy death.
loop
set u = FirstOfGroup( .IcePillar )
exitwhen u == null
call GroupRemoveUnit( .IcePillar, u )
call UnitRemoveAbility( u, LICH_SFX_ID )
call UnitAddAbility( u, WYRM_SFX_ID )
call UnitRemoveAbility( u, WYRM_SFX_ID )
call KillUnit( u )
set u = null
endloop
set TempX = .TX
set TempY = .TY
set TempPlayer = .Owner
set TempInt = .LevelX
set TempCaster = .Caster
set Damage = SPELL_DAMAGE( .LevelX )
debug call BJDebugMsg( "Damage: " + R2S( Damage ) )
set KBDist = SPELL_KB_DISTANCE( .LevelX )
call GroupEnumUnitsInRange( Group, .TX, .TY, .AoE, G_UFilter )
call GroupClear( .IcePillar )
call .fx.destroy()
endmethod
static method create takes nothing returns IPData
local IPData d = IPData.allocate()
set d.Caster = GetTriggerUnit()
set d.Owner = GetOwningPlayer( d.Caster )
set d.TX = GetSpellTargetX()
set d.TY = GetSpellTargetY()
set d.LevelX = GetUnitAbilityLevel( d.Caster, SPELL_ID )
set d.AoE = SPELL_AOE( d.LevelX )
set d.Duration = SPELL_DURATION( d.LevelX )
set d.HeightModifier = MAX_HEIGHT / ( d.Duration / TIMER_INTERVAL )
set d.a2n = 90
debug call BJDebugMsg( "LevelX: " + R2S( d.LevelX ) )
debug call BJDebugMsg( "AoE: " + R2S( d.AoE ) )
debug call BJDebugMsg( "Duration: " + R2S( d.Duration ) )
set d.fx = xefx.create( d.TX, d.TY, bj_UNIT_FACING )
set d.fx.fxpath = TRAIL_SFX
set d.fx.scale = TRAIL_SCALE
return d
endmethod
endstruct
private function Callback takes nothing returns boolean
local IPData d = KT_GetData()
local integer i = 0
local real x
local real y
local real angle = 0
local unit u = null
set d.SECONDS = d.SECONDS + TIMER_INTERVAL
set d.angle = d.angle + ROTATE_SPEED
set d.Height = d.Counter * d.HeightModifier
//set d.ZANGLE = d.ZANGLE - 7
//if d.ZANGLE < -360 then
//set d.ZANGLE = d.ZANGLE + 360
//endif
set x = d.TX + d.AoE * Cos( d.angle * bj_DEGTORAD )
set y = d.TY + d.AoE * Sin( d.angle * bj_DEGTORAD )
call d.fx.flash( FLASH_SFX )
set d.a2n = d.a2n + ROTATE_SPEED
if d.Height < HEIGHT_VISIBILITY then
set u = CreateUnit( d.Owner, DUMMY_ID, x, y, d.a2n )
call SetUnitFlyHeight( u, d.Height, 0 )
call GroupAddUnit( d.IcePillar, u )
call SetUnitScale( u, PILLAR_SCALE,PILLAR_SCALE,PILLAR_SCALE)
set d.fx.x=x
set d.fx.y=y
set d.fx.z=d.Height
// NORMAL PILLAR
set u = CreateUnit( d.Owner, DUMMY_ID, d.TX, d.TY, bj_UNIT_FACING )
call SetUnitFlyHeight( u, d.Height, 0 )
call GroupAddUnit( d.IcePillar, u )
endif
set d.Counter = d.Counter + 1
set u = null
if d.SECONDS >= d.Duration then
call d.destroy()
return true
endif
return false
endfunction
private function Cond takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Actions takes nothing returns nothing
call KT_Add( function Callback, IPData.create(), TIMER_INTERVAL )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Cond ) )
call TriggerAddAction( t, function Actions )
set G_UFilter = Condition( function IPData.UFilter )
set DUMMY_CASTER = CreateUnit( Player(12), DUMMY_ID, 0, 0, bj_UNIT_FACING )
call UnitRemoveAbility( DUMMY_CASTER, 039;Amov039; )
call UnitRemoveAbility( DUMMY_CASTER, LICH_SFX_ID )
call UnitAddAbility( DUMMY_CASTER, STUN_ID )
endfunction
endscope