This is a spell,Ice block. Its supposed to be similiar like crystal maidens frost cage thing. But it doesnt pause the unit neither does it even create the destructable around the unit. Its the first time I get to do with destructables and pausing so please help!
JASS:
scope IceBlock initializer Init
globals
private constant integer ABI_ID = 'A000'
private constant string EFFECT = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABI_ID
endfunction
private function Actions takes nothing returns nothing
local unit hero = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local player owner = GetTriggerPlayer()
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local integer pid = GetPlayerId(owner) + 1
local integer lvl = GetUnitAbilityLevel(hero, ABI_ID)
local real damage = udg_StatsMentalPower[pid] * 0.75
local destructable d
call UnitDamageTarget(hero, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call DestroyEffect(AddSpecialEffectTarget(EFFECT, target, "origin") )
call ZTS_ApplyHealThreat( GetTriggerUnit(), GetSpellTargetUnit(), 75, true, true)
call PauseUnit(target,true)
set d = CreateDestructable('B00G' , x, y, 360, 1.0, 5)
call TriggerSleepAction(4)
call PauseUnit(target,false)
call RemoveDestructable(d)
set hero = null
set target = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger IceBlockTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( IceBlockTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( IceBlockTrg, Condition( function Conditions ) )
call TriggerAddAction( IceBlockTrg, function Actions )
call Preload(EFFECT)
endfunction
endscope