- Joined
- May 12, 2018
- Messages
- 145
Hi there, I am writing a script after receiving a tutorial.
I want to make the spell that deals damage and occurs debuff to a target unit, and deals damage more over and over (maybe up to 3 times) by casting the spell to the same target while debuff exists.
And when debuff is removed, the stacks becomes zero, debuff can be dispelled. ( I used Unholy Frenzy)
(Ex: Shadow Demon's Shadow Poison in DotA, Shadow Priest's Mind Spike in WoW 4.0.0 Mind Spike - Spells - Cataclysm )
Here is the script I'm writing, I've tested it, but it has problems those I don't know how to connect debuff checker and stack limitation and don't know if this clears memory leakage perfectly, and the damage stacks are never reset even if timer is expired.
I want to make the spell that deals damage and occurs debuff to a target unit, and deals damage more over and over (maybe up to 3 times) by casting the spell to the same target while debuff exists.
And when debuff is removed, the stacks becomes zero, debuff can be dispelled. ( I used Unholy Frenzy)
(Ex: Shadow Demon's Shadow Poison in DotA, Shadow Priest's Mind Spike in WoW 4.0.0 Mind Spike - Spells - Cataclysm )
Here is the script I'm writing, I've tested it, but it has problems those I don't know how to connect debuff checker and stack limitation and don't know if this clears memory leakage perfectly, and the damage stacks are never reset even if timer is expired.
JASS:
// the basic is written by zam
scope MindSpike
globals
private constant integer Abil0Id = 'A03D'
private constant integer Abil1Id = 'A01A'
private constant integer Abil2Id = 'A036'
endglobals
private constant function Damage takes integer AbilLv0, integer AbilLv1 returns real
return ( 55.0 + ( 41.25 * ( AbilLv0 - 1 ) ) ) * ( 1 + ( AbilLv1 * 0.33 ) )
endfunction
private function MindSpikeEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
set udg_MindSpikeStack[GetUnitUserData(LoadUnitHandle(udg_SpellsHash, GetHandleId(t), 0 ) )] = 0
call RemoveSavedHandle( udg_SpellsHash, GetHandleId(t), 0 )
set t = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == Abil0Id
endfunction
private function Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit Targ = GetSpellTargetUnit()
local unit Cast= GetSpellAbilityUnit()
local real dam = Damage(GetUnitAbilityLevelSwapped( Abil1Id, Cast ), GetUnitAbilityLevelSwapped(Abil2Id, Cast ) )
call SaveUnitHandle(udg_SpellsHash, GetHandleId(t), 0, Targ)
set udg_MindSpikeStack[GetUnitUserData(Targ)] = ( udg_MindSpikeStack[GetUnitUserData(Targ)] + 1 )
call UnitDamageTarget( Cast, Targ, dam * udg_MindSpikeStack[GetUnitUserData(Targ)], false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC , WEAPON_TYPE_WHOKNOWS )
if ( IsUnitType(Targ, UNIT_TYPE_RESISTANT) == true ) then
call TimerStart(t, 5, false, function MindSpikeEnd)
else
call TimerStart(t, 10, false, function MindSpikeEnd)
endif
set Targ = null
set Cast = null
set t = null
endfunction
//===========================================================================
function InitTrig_ShadowformMindSpikeC takes nothing returns nothing
set gg_trg_ShadowformMindSpikeC = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ShadowformMindSpikeC, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ShadowformMindSpikeC, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_ShadowformMindSpikeC, function Actions )
endfunction
endscope
Last edited: