- Joined
- Jul 28, 2008
- Messages
- 211
I've wanted to make a spell so here it is
The problem is, when i cast the spell, it doesn't effect the units in the aoe. When i cast it near the caster, the effect is created above his head, but it doesn't damage him. Can someone tell me why does this happen?
Oh, and i have another problem. I based my ability on channel. I set it to unit target, and later i changed it to point target and set the area of effect. But it doesn't show the area when i cast the spell. Like its just point target without aoe.
So can someone help me?
JASS:
scope MindBlast initializer Init
//========================================SETUP========================================
globals
constant integer SPELL_ID = 'A000'
constant integer DUMMY_ID = 'h000'
constant string ATTACHMENT_POINT = "overhead"
constant string DAMAGE_EFFECT = "Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl"
constant string AOE_EFFECT = "Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl"
constant attacktype ATTACK_TYPE = ATTACK_TYPE_MAGIC
constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MIND
endglobals
private function Damage takes integer level returns real
return I2R(75 + 25 * level)
endfunction
private function Area takes integer level returns real
return I2R(175 + level * 75)
endfunction
private function Targets takes unit target returns boolean
return (GetWidgetLife(target) > 0.405) and (IsUnitType(target, UNIT_TYPE_STRUCTURE) == false ) and (IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(target, UNIT_TYPE_MECHANICAL) == false)
endfunction
//=====================================END OF SETUP=====================================
globals
group all
boolexpr b
endglobals
private function Pick takes nothing returns boolean
return Targets( GetFilterUnit() )
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Actions takes nothing returns nothing
local unit temp
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, SPELL_ID )
local location spellTarget = GetSpellTargetLoc()
local real spellX = GetLocationX(spellTarget)
local real spellY = GetLocationY(spellTarget)
call DestroyEffect( AddSpecialEffect( AOE_EFFECT, spellX, spellY ) )
call GroupEnumUnitsInRange(all, spellX, spellY, Area(lvl), b )
loop
set temp = FirstOfGroup(all)
exitwhen temp == null
if IsUnitAlly(temp, GetOwningPlayer(caster)) then
call DestroyEffect( AddSpecialEffectTarget( DAMAGE_EFFECT, temp, ATTACHMENT_POINT ) )
call UnitDamageTarget(caster, temp, Damage * lvl, false, true, ATTACK_TYPE, DAMAGE_TYPE, null )
endif
call GroupRemoveUnit(all, temp)
endloop
call RemoveLocation(spellTarget)
set caster = null
set spellTarget = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Actions )
set all = CreateGroup()
set b = Condition( function Pick )
call Preload(DAMAGE_EFFECT)
call Preload(AOE_EFFECT)
call CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0 )
call UnitAddAbility( bj_lastCreatedUnit, SPELL_ID )
call KillUnit(bj_lastCreatedUnit)
endfunction
endscope
The problem is, when i cast the spell, it doesn't effect the units in the aoe. When i cast it near the caster, the effect is created above his head, but it doesn't damage him. Can someone tell me why does this happen?
Oh, and i have another problem. I based my ability on channel. I set it to unit target, and later i changed it to point target and set the area of effect. But it doesn't show the area when i cast the spell. Like its just point target without aoe.
So can someone help me?