- Joined
- Apr 16, 2011
- Messages
- 158
[Resolved] Starfall
What I'm trying to do is create the magic starfall customizable.
I am having the following problems:
- there is no damage(the magic does not reach the filter)
- effect in "caster" is in the wrong place.
I no have much knowledge in "vjass" ,so can be a error beast
*i am editing the magic "epicenter" by Mag(s2 you)
What I'm trying to do is create the magic starfall customizable.
I am having the following problems:
- there is no damage(the magic does not reach the filter)
- effect in "caster" is in the wrong place.
I no have much knowledge in "vjass" ,so can be a error beast
*i am editing the magic "epicenter" by Mag(s2 you)
JASS:
library Starfall initializer onInit requires Tt, SpellEffectEvent
globals
private constant integer ABIL_CODE = 'A003'
private constant real RADIUS = 3000.
private constant string EFFECT_PATH = "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl"
private constant string EFFECT_CAST = "Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl"
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
private constant boolean PRELOAD_EFFECT = true
endglobals
private function GetTimeout takes integer level returns real
return 1.
endfunction
private function GetDamage takes integer heroInt returns real
return 100. + heroInt
endfunction
private function TargetFilter takes unit caster, player owner, unit target returns boolean
return not IsUnitType(target, UNIT_TYPE_STRUCTURE) and not IsUnitType(target, UNIT_TYPE_DEAD) and IsUnitEnemy(target, owner)
endfunction
private struct Spell extends array
private static unit array caster
private static player array owner
private static integer array waves
private static real array radius
private static real array damage
private static effect array effectCaster
implement CTM
local real x
local real y
local unit u
implement CTMExpire
set x = GetUnitX(u)
set y = GetUnitY(u)
set bj_lastCreatedGroup = CreateGroup()
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, RADIUS, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen null == u
call GroupRemoveUnit(bj_lastCreatedGroup, u)
if TargetFilter(caster[this], owner[this], u) then
call DestroyEffect(AddSpecialEffectTarget(EFFECT_PATH,u,"origin"))
call UnitDamageTarget(caster[this], u, damage[this], false, false, ATTACK_TYPE, DAMAGE_TYPE, null)
endif
endloop
call DestroyGroup(bj_lastCreatedGroup)
set waves[this] = waves[this] - 1
if waves[this] == 0 then
call DestroyEffect(effectCaster[this])
call this.destroy()
set caster[this] = null
set owner[this] = null
endif
implement CTMEnd
private static method run takes nothing returns nothing
local integer level = GetUnitAbilityLevel(GetTriggerUnit(), ABIL_CODE)
local thistype this = create(GetTimeout(level))
local integer heroInt
local real x
local real y
set caster[this] = GetTriggerUnit()
set x = GetUnitX(caster[this])
set y = GetUnitY(caster[this])
set heroInt = GetHeroInt(caster[this], true)
set effectCaster[this] = AddSpecialEffect(EFFECT_CAST, x, y)
set owner[this] = GetTriggerPlayer()
set damage[this] = GetDamage(heroInt)
set waves[this] = level
endmethod
private static method onInit takes nothing returns nothing
call RegisterSpellEffectEvent(ABIL_CODE, function thistype.run)
static if PRELOAD_EFFECT then
call Preload(EFFECT_PATH)
call Preload(EFFECT_CAST)
endif
endmethod
endstruct
//Family Magtheridon96 ? PROBLEM ?
endlibrary
Last edited: