- Joined
- Jul 19, 2007
- Messages
- 855
I have imported an ability from a Dota Spellpack again and it seems to work like it should but it seems to damage buildings, magic immune units and dead enemy units and also heal dead units. This is maybe not a big problem but it's still annoying. Could anyone fix pls.
JASS:
//TESH.scrollpos=184
//TESH.alwaysfold=0
scope Nymph2 initializer int
globals
private constant integer ABI_VOLATIVE_POD = 'A0IV'
private constant integer ABI_POWDER = 'A005'
private constant integer ABI_N_ZEAL = 'A002'
private constant integer ABI_TELE = 'A006'
private constant integer SUB_ABI_STUN = 'A004'
private constant integer SUB_ABI_SLEEP = 'A003'
private constant integer SUB_ABI_TELE = 'A007'
private constant integer DUMMY_VOLATIVE_POD = 'h030'
private constant integer DUMMY_N_ZEAL = 'h003'
endglobals
//====================================================================
//====================================================================
private struct FairyVolative
unit caster
unit dummy
real damage
method destroy takes nothing returns nothing
set this.caster = null
set this.dummy = null
endmethod
static method create takes unit u, real x, real y returns FairyVolative
local FairyVolative d = FairyVolative.allocate()
local timer t = NewTimer()
set d.caster = u
set d.dummy = CreateUnit( GetOwningPlayer( u ), DUMMY_VOLATIVE_POD, x, y, 0 )
call SetUnitAnimation( d.dummy, "birth" )
call SetUnitTimeScale( d.dummy, 3 )
call QueueUnitAnimation( d.dummy, "stand" )
set d.damage = 15. + GetUnitAbilityLevel(u, ABI_VOLATIVE_POD)*60
call SetTimerData( t , d )
call TimerStart( t, 2.5, false, function thistype.onDeath )
return d
endmethod
static method onDeath takes nothing returns nothing
local timer t = GetExpiredTimer()
local FairyVolative d = GetTimerData( t )
local real x = GetUnitX( d.dummy )
local real y = GetUnitY( d.dummy )
local group g = NewGroup()
local unit u
local player p = GetOwningPlayer( d.caster )
call GroupUnitsInArea( g, x, y, 300 )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl",x,y ) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitAlly(u, p) then
call SetWidgetLife( u, GetWidgetLife(u) + d.damage )
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl", u, "origin" ) )
else
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl", u, "chest" ) )
call UnitDamageTarget( d.caster, u, d.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null )
endif
call GroupRemoveUnit(g,u)
endloop
call KillUnit( d.dummy )
call SetUnitAnimation( d.dummy, "death spell" )
call ReleaseGroup( g )
call ReleaseTimer( t )
set g = null
set t = null
call d.destroy()
endmethod
endstruct
private function FairyVolativeAct takes nothing returns boolean
local FairyVolative data
if GetSpellAbilityId() == ABI_VOLATIVE_POD then
set data = FairyVolative.create( GetTriggerUnit(),GetSpellTargetX(), GetSpellTargetY() )
endif
return false
endfunction
//====================================================================
//====================================================================
private struct FairyTele
unit caster
static method create takes unit u returns FairyTele
local FairyTele data = FairyTele.allocate()
local timer t = NewTimer()
call SetTimerData( t, data )
set data.caster = u
call UnitAddAbility( u, SUB_ABI_TELE )
call TimerStart( t, 4, false, function FairyTele.timeEnd )
set t = null
return data
endmethod
static method timeEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
local FairyTele data = GetTimerData(t)
call UnitRemoveAbility( data.caster, SUB_ABI_TELE )
set data.caster = null
set t = null
call data.destroy()
endmethod
endstruct
//====================================================================
//====================================================================
private function int takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function FairyVolativeAct ) )
call XE_PreloadAbility(ABI_VOLATIVE_POD)
call XE_PreloadAbility(ABI_POWDER)
call XE_PreloadAbility(ABI_N_ZEAL)
call XE_PreloadAbility(ABI_TELE)
call XE_PreloadAbility(SUB_ABI_STUN)
call XE_PreloadAbility(SUB_ABI_SLEEP)
call XE_PreloadAbility(SUB_ABI_TELE)
set t = null
endfunction
endscope
Last edited: