- Joined
- Sep 14, 2012
- Messages
- 3,413
Ok I'll remove the line.
told u that ^Jad said:native GetHeroId takes nothing returns integer
scope SpellName
//CONFIGURATION
globals
private constant integer SPELL_ID = 'XXXX'
//Some more things that needs configuration
endglobals
//Some private constant function that could be cool like damage calculation or something
//END CONFIGURATION
private struct SpellName extends array
private static method cond takes nothing returns boolean
//Do the stuff
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEvent(t, ....)
call TriggerAddCondition(t, Condition(function thistype.cond))
set t = null
endmethod
endstruct
endscope
Doesn't matter anymore, I'm quitting this.He wanted to test without and it makes bugs yes :/
library DoT
globals
private constant real FPS = 0.0100
endglobals
struct DoT extends array
private unit caster
private unit target
private real interval
private real during
private real dmg
private real temp
private static integer count
private thistype prev
private thistype next
private static timer period
private static method iterate takes nothing returns nothing
local thistype this = thistype(0)
loop
set this = this.next
exitwhen this == 0
set this.temp = this.temp + FPS
if this.temp >= this.interval then
call UnitDamageTarget(this.caster, this.target, this.dmg, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
set this.temp = this.temp-this.interval
endif
set this.during = this.during - FPS
if this.during <= 0 then
call this.destroy()
endif
endloop
endmethod
static method add takes unit cast, unit targ, real dur, real inter, real dm returns nothing
local thistype this
if thistype(0).prev == 0 then
set count = count + 1
set this = count
else
set this = thistype(0).prev
set thistype(0).prev = thistype(0).prev.prev
endif
if thistype(0).next == 0 then
call TimerStart(period, FPS, true, function thistype.iterate)
else
set thistype(0).next.prev = this
endif
set this.next = thistype(0).next
set thistype(0).next = this
set this.prev = thistype(0)
set this.caster = cast
set this.target = targ
set this.interval = inter
set this.during = dur
set this.dmg = dm
set this.temp = 0
endmethod
private method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
set this.caster = null
set this.target = null
endmethod
private static method onInit takes nothing returns nothing
set count = 0
set period = CreateTimer()
endmethod
endstruct
endlibrary