Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
The Goblin Shredder hits the target with his saw, leaving the saw in the unit. The saw spin inside the target, dealing 70/100/130 damage over 5/6/7 seconds. When it stops spinning, it will explode, dealing 60/80/100 damage to the target.
I made the spell for a spell pack i intend to do (Goblin Shredder) but I'm too lazy to make the other spells now so I'm uploading this one now and the others will come in a few days.
The spell is MUI, doesn't cause lag and it's leakless (as far as I know).
If you find any bugs, let me know. Oh and if you have any suggestions, post them here and I'll see what I can do.
[JASS="Code"]//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 > 0 and GetWidgetLife(targets) > 0.405 then
call DestroyEffect(AddSpecialEffectTarget(SAW_EFFECT, targets, SAW_ATTACH))
call UnitDamageTarget(casters, targets, DAMAGE(levels) / SAW_DURRATION(levels) * PERIOD, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set durrations = durrations - PERIOD
else
call DestroyEffect(AddSpecialEffect(EXPLODE_EFFECT, GetUnitX(targets), GetUnitY(targets)))
call DestroyEffect(saws)
call UnitDamageTarget(casters, targets, EXPLODE_DMG(levels), false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set total = total - 1
set casters = casters[total]
set targets = targets[total]
set durrations = durrations[total]
set saws = saws[total]
set levels = levels[total]
set i = i - 1
endif
set i = i + 1
endloop
if total == 0 then
call PauseTimer(TIMER)
endif
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[/code]
Removed the DoT Systemr
A few minor fixes
Screenshot changed
Keywords:
Saw, Cutting, Damage over Time, DoT, Goblin
10:48, 7th Jun 2010
The_Reborn_Devil:
It's very simple and a bit short, but the coding looks ok.
You could remove the locals in the function Act though.
Here:
local unit caster = GetTriggerUnit()
local unit target =...
Thanks
Yes it is simple but I'm a bit rusty so I'll make simple things first
And it gave me a chance to try indexing without structs (first time I'm doing it)
I saw his system (and it's a little bit different) and that's why I didn't post mine seperatley. And how else should I name a system which deals damage over time? I mean I saw a lot of Inventory Systems and Camera Systems but they all have the same name (who wants to name a system which improves the inventory Someguy's Owning System) so I think it's ok.
Very clean and concise, though there really isn't any necessity in using your "DoT" library. You already set up a timer with a stack so there is no need to use another one that is specifically for dmg/time.
- I'm not sure how acceptable it is that you use a library that has not been approved by our moderators, talking specifically about your "DoT" library. There don't appear to be any problems with it, though, so I'll ignore that for now.
- Again, (as in your last spell) you can eliminate the use of the "I2R" functions by typecasting the integers. By now I know you have acknowledged this and how to fix it so I won't provide examples.
- There are two leaks in your "Act" function. Both of the unit variables you allocate are not nulled.
- You forget to use a constant variable instead of a hard-coded value:
The name may be fine, but you should have definitely searched the resources section for something similar to use for your spell so that a user doesn't need to have several systems that do the same thing just for a handful of spells.
Yea it is simple. I can't think of good spell ideas. But, I saw a few other spells (enhanced critical, vampiric strike) which were also simple but nobody said they were simple in those posts. So am I a simple-spell-hater (not really hater but I couldn't find a better word) magnet or something?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.