Name | Type | is_array | initial_value |
//TESH.scrollpos=35
//TESH.alwaysfold=0
//Made by Destroyer95
scope Saw initializer Initi
globals
private constant integer SPELL_ID = 'A000' //Put the ID of your spell here!
private constant string SAW_LOOK = "Abilities\\Weapons\\SentinelMissile\\SentinelMissile.mdl" //How the saw looks
private constant string SAW_ATTACH = "chest" //Attachment point of the saw and the blood effect
private constant string SAW_EFFECT = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" //How the blood effect look (doesn't have to be blood ofcourse)
private constant string EXPLODE_EFFECT = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" //How the explosion looks when the timer runs out
private constant real PERIOD = 0.2
/////////////////Don't touch this part/////////// //
private integer total = 0 //
private timer TIMER = CreateTimer() // **************************
private effect array saws // **More adjustables down!**
private real array durrations // **************************
private unit array targets //
private unit array casters //
private integer array levels //
/////////////////////////////////////////////////
endglobals
private function SAW_DURRATION takes integer lvl returns real //The time before the saw explodes
return lvl + 4.
endfunction
private function DAMAGE takes integer lvl returns real //The total damage that the saw deals over time
return lvl * 30 + 40.
endfunction
private function EXPLODE_DMG takes integer lvl returns real //The damage that the saw does when it explodes
return lvl * 20 + 40.
endfunction
////////////////////////////////////////////////////////////////////////////////
//////////Don't touch anything below unless you know what you're doing//////////
////////////////////////////////////////////////////////////////////////////////
private function Callback takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= total
if durrations[i] > 0 and GetWidgetLife(targets[i]) > 0.405 then
call DestroyEffect(AddSpecialEffectTarget(SAW_EFFECT, targets[i], SAW_ATTACH))
call UnitDamageTarget(casters[i], targets[i], DAMAGE(levels[i]) / SAW_DURRATION(levels[i]) * PERIOD, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set durrations[i] = durrations[i] - PERIOD
else
call DestroyEffect(AddSpecialEffect(EXPLODE_EFFECT, GetUnitX(targets[i]), GetUnitY(targets[i])))
call DestroyEffect(saws[i])
call UnitDamageTarget(casters[i], targets[i], EXPLODE_DMG(levels[i]), false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set total = total - 1
set casters[i] = casters[total]
set targets[i] = targets[total]
set durrations[i] = durrations[total]
set saws[i] = saws[total]
set levels[i] = levels[total]
set i = i - 1
endif
set i = i + 1
endloop
if total == 0 then
call PauseTimer(TIMER)
endif
endfunction
private function Cond takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Act takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
set casters[total] = caster
set targets[total] = target
set durrations[total] = SAW_DURRATION(GetUnitAbilityLevel(caster, SPELL_ID))
set saws[total] = AddSpecialEffectTarget(SAW_LOOK, target, SAW_ATTACH)
set levels[total] = GetUnitAbilityLevel(caster, SPELL_ID)
if total == 0 then
call TimerStart(TIMER, PERIOD, true, function Callback)
endif
set total = total + 1
set caster = null
set target = null
endfunction
private function Initi 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 Act)
endfunction
endscope
//Made by Destroyer95