Problem with spell

jubjn209

New Member
Reaction score
0
I use xemissile to create my own spell but when i test, nothing happend. How can i fix it???
Code:
library IceArrow initializer Init requires xedamage, xemissile
 
 
 
globals
 
private constant integer SPELLID = 'A003'
 
private constant string MISSILE = "Abilities\\Weapons\\LichMissile\\LichMissile.mdl"
 
private constant real SCALE = 2.
 
private constant real OFFSET = 60.
 
private constant real SPEED = 550.
 
private constant real ARC = 0.25
 
endglobals
 
 
 
private function Damage takes unit caster returns real
 
return I2R(GetUnitAbilityLevel(caster, SPELLID)/2)+I2R(GetHeroInt(caster, true))
 
endfunction
 
 
 
private function setupDamageOptions takes xedamage d returns nothing
 
set d.dtype = DAMAGE_TYPE_MAGIC
 
set d.atype = ATTACK_TYPE_HERO
 
 
 
set d.exception = UNIT_TYPE_STRUCTURE
 
endfunction
 
 
 
globals
 
private xedamage damageOptions
 
endglobals
 
 
 
struct IceArrowAct extends xemissile
 
private unit caster
 
private integer level
 
static method create takes unit caster, integer level, real tx, real ty returns IceArrowAct
 
local real x = GetUnitX(caster)
 
local real y = GetUnitY(caster)
 
local real z = GetUnitFlyHeight(caster)+OFFSET
 
local IceArrowAct this = IceArrowAct.allocate(x,y,z,tx,ty,0.0)
 
 
 
set this.caster = caster
 
set this.level = level
 
set this.fxpath = MISSILE
 
set this.scale = SCALE
 
call this.launch(SPEED, ARC)
 
return this
 
endmethod
 
 
 
method onHit takes nothing returns nothing
 
call damageOptions.damageTarget(.caster, .targetUnit, Damage(.caster))
 
endmethod
 
endstruct
 
 
 
private function spellIdMatch takes nothing returns boolean
 
return (GetSpellAbilityId()==SPELLID)
 
endfunction
 
 
 
private function onSpellEffect takes nothing returns nothing
 
local real tx = GetSpellTargetX()
 
local real ty = GetSpellTargetY()
 
local unit hero = GetTriggerUnit()
 
local integer level = GetUnitAbilityLevel(hero, SPELLID)
 
local IceArrowAct fb = IceArrowAct.create(hero,level,tx,ty)
 
set hero = null
 
endfunction
 
 
 
private function Init takes nothing returns nothing
 
local trigger t = CreateTrigger()
 
 
 
set damageOptions = xedamage.create()
 
call setupDamageOptions(damageOptions)
 
 
 
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
 
call TriggerAddCondition(t, Condition(function spellIdMatch))
 
call TriggerAddAction(t, function onSpellEffect)
 
set t = null
 
endfunction
 
 
 
endlibrary
 

BloodySkullz

Active Member
Reaction score
10
Try to use Scope than Library for spells.
Replace 'library' with scope and try again.
Make sure you have the two systems also.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top