System Heal

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
JASS:
/*
 
    Heal v2.0.0
        by kingking
    
    - Library that transforms healing into a breeze, allowing full control on healing.
    
    CreateHealType()-> HealType
    ~ Generate a heal type.
    
    HealUnit(unit a, unit b,real,HealType)
    ~ Heal the unit + fire event.
    ~ Unit a -> Healer
    ~ Unit b -> Target
    
    RegisterHealEvent(trigger,integer)
    ~ trigger - Trigger to be registered, integer - priority
    
    UnregisterHealEvent(trigger)
    ~ trigger - Trigger to be registered
    
    RegisterHealUnitEvent(trigger,unit,integer)
    ~ trigger - Trigger to be registered, unit - healer, integer - priority
    ~ Fires if the unit heals anything.
    
    UnregisterHealUnitEvent(trigger,unit)
    ~ trigger - Trigger to be registered, unit - healer
    
    RegisterUnitHealedEvent(trigger,unit,integer)
    ~ trigger - Trigger to be registered, unit - healed, integer - priority
    ~ Fires if the unit is healed by anything.
    
    UnregisterUnitHealedEvent(trigger,unit)
    ~ trigger - Trigger to be registered, unit - healed
    
    GetHealAmount() -> real
    ~ Get the amount of healing at the moment.
    
    SetHealAmount(real)
    ~ Update the amount of healing.
    
    GetHealType()-> HealType
    ~ Get the type of healing.
    
    GetHealer() -> unit
    ~ Get healer.
    
    GetHealedUnit()-> unit
    ~ Get healed unit.
    
    Requires : A vJass complier
*/
library Heal
    
    struct HealType extends array
    endstruct
    
    globals
        HealType HEAL_TYPE_NORMAL=1
        private integer HealTypeCount=1
        private real Final=0.0
        private unit Healer=null
        private unit Target=null
        private HealType CurrHealType=1
        private key GenericCallback
        private key HealUnitCallback
        private key UnitHealedCallback
        private integer array TrigType
        private unit array HealedUnitList
        private unit array HealerList
        private trigger array Trig
        private integer array Next
        private integer array Prev
        private integer array Priority
        private integer array IndexStack
        private integer IndexStackMax=0
        private integer IndexMax=0
    endglobals
    
    function CreateHealType takes nothing returns HealType
        set HealTypeCount=HealTypeCount+1
        return HealTypeCount
    endfunction
    
    function GetHealer takes nothing returns unit
        return Healer
    endfunction
    
    function GetHealedUnit takes nothing returns unit
        return Target
    endfunction
    
    function GetHealType takes nothing returns HealType
        return CurrHealType
    endfunction
    
    function GetHealAmount takes nothing returns real
        return Final
    endfunction
    
    function SetHealAmount takes real r returns nothing
        set Final=r
    endfunction
    
    private function FireEvent takes unit healer, unit target, real amount, HealType htype returns nothing
        local unit oldhealer=Healer
        local unit oldtarget=Target
        local real oldamount=Final
        local HealType oldhealtype=CurrHealType
        local integer i=Next[0]
        local boolean ToFire
        set Healer=healer
        set Target=target
        set Final=amount
        set CurrHealType=htype
        loop
        exitwhen i==0
            set ToFire=false
            if TrigType<i>==GenericCallback then
                set ToFire=true
            elseif TrigType<i>==HealUnitCallback and HealerList<i>==healer then
                set ToFire=true
            elseif TrigType<i>==UnitHealedCallback and HealedUnitList<i>==target then
                set ToFire=true
            endif
            if ToFire==true and IsTriggerEnabled(Trig<i>) and TriggerEvaluate(Trig<i>) then
                call TriggerExecute(Trig<i>)
            endif
            set i=Next<i>
        endloop
        if Final&gt;amount then
            call SetWidgetLife(target,GetWidgetLife(target)+(Final-amount))
        elseif Final&lt;amount and Final&gt;=0.0 then
            call SetWidgetLife(target,GetWidgetLife(target)-(amount-Final))
        endif
        set Healer=oldhealer
        set Target=oldtarget
        set Final=oldamount
        set CurrHealType=oldhealtype
        set oldhealer=null
        set oldtarget=null
    endfunction
    
    function HealUnit takes unit healer, unit target, real amount, HealType htype returns nothing
        local real result
        if GetWidgetLife(target)&gt;.405 then
            set result=GetWidgetLife(target)+amount
            call SetWidgetLife(target,result)
            call FireEvent(healer,target,amount,htype)
        endif
    endfunction
    
    function RegisterHealEvent takes trigger trig, integer prio returns nothing
        local integer head
        local integer i
        local boolean isAdded
        if trig!=null then
            if IndexStackMax==0 then
                set IndexMax=IndexMax+1
                set i=IndexMax
            else
                set i=IndexStack[IndexStackMax]
                set IndexStackMax=IndexStackMax-1
            endif
            set Trig<i>=trig
            set Priority<i>=prio
            set TrigType<i>=GenericCallback
            set isAdded=false
            set head=Next[0]
            loop
                if prio&gt;Priority[head] then
                    set Next[Prev[head]]=i
                    set Prev<i>=Prev[head]
                    set Next<i>=head
                    set Prev[head]=i
                    set isAdded=true
                    set head=Prev[0]
                endif
                set head=Next[head]
            exitwhen head==0
            endloop
            if isAdded==false then
                set Next[Prev[head]]=i
                set Prev<i>=Prev[head]
                set Next<i>=head
                set Prev[head]=i
            endif
        endif
    endfunction
    
    function UnregisterHealEvent takes trigger trig returns nothing
        local integer i=Next[0]
        loop
        exitwhen i==0
            if Trig<i>==trig and TrigType<i>==GenericCallback then
                set Next[Prev<i>]=Next<i>
                set Prev[Next<i>]=Prev<i>
                set IndexStackMax=IndexStackMax+1                
                set IndexStack[IndexStackMax]=i
                return
            endif
            set i=Next<i>
        endloop
    endfunction
    
    function RegisterHealUnitEvent takes trigger trig, unit u, integer prio returns nothing
        local integer head
        local integer i
        local boolean isAdded
        if trig!=null then
            if IndexStackMax==0 then
                set IndexMax=IndexMax+1
                set i=IndexMax
            else
                set i=IndexStack[IndexStackMax]
                set IndexStackMax=IndexStackMax-1
            endif
            set Trig<i>=trig
            set Priority<i>=prio
            set TrigType<i>=HealUnitCallback
            set HealerList<i>=u
            set isAdded=false
            set head=Next[0]
            loop
                if prio&gt;Priority[head] then
                    set Next[Prev[head]]=i
                    set Prev<i>=Prev[head]
                    set Next<i>=head
                    set Prev[head]=i
                    set isAdded=true
                    set head=Prev[0]
                    set isAdded=true
                endif
                set head=Next[head]
            exitwhen head==0
            endloop
            if isAdded==false then
                set Next[Prev[head]]=i
                set Prev<i>=Prev[head]
                set Next<i>=head
                set Prev[head]=i
            endif
        endif
    endfunction
    
    function UnregisterHealUnitEvent takes trigger trig, unit u returns nothing
        local integer i=Next[0]
        loop
        exitwhen i==0
            if Trig<i>==trig and HealerList<i>==u then
                set Next[Prev<i>]=Next<i>
                set Prev[Next<i>]=Prev<i>
                set HealerList<i>=null
                set IndexStackMax=IndexStackMax+1                
                set IndexStack[IndexStackMax]=i
                return
            endif
            set i=Next<i>
        endloop
    endfunction
    
    function RegisterUnitHealedEvent takes trigger trig, unit u, integer prio returns nothing
        local integer head
        local integer i
        local boolean isAdded
        if trig!=null then
            if IndexStackMax==0 then
                set IndexMax=IndexMax+1
                set i=IndexMax
            else
                set i=IndexStack[IndexStackMax]
                set IndexStackMax=IndexStackMax-1
            endif
            set Trig<i>=trig
            set Priority<i>=prio
            set TrigType<i>=UnitHealedCallback
            set HealedUnitList<i>=u
            set isAdded=false
            set head=Next[0]
            loop
                if prio&gt;Priority[head] then
                    set Next[Prev[head]]=i
                    set Prev<i>=Prev[head]
                    set Next<i>=head
                    set Prev[head]=i
                    set isAdded=true
                    set head=Prev[0]
                    set isAdded=true
                endif
                set head=Next[head]
            exitwhen head==0
            endloop
            if isAdded==false then
                set Next[Prev[head]]=i
                set Prev<i>=Prev[head]
                set Next<i>=head
                set Prev[head]=i
            endif
        endif
    endfunction
    
    function UnregisterUnitHealedEvent takes trigger trig, unit u returns nothing
        local integer i=Next[0]
        loop
        exitwhen i==0
            if Trig<i>==trig and HealedUnitList<i>==u then
                set Next[Prev<i>]=Next<i>
                set Prev[Next<i>]=Prev<i>
                set HealedUnitList<i>=null
                set IndexStackMax=IndexStackMax+1                
                set IndexStack[IndexStackMax]=i
                return
            endif
            set i=Next<i>
        endloop
    endfunction
    
endlibrary
</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


Heal
v1.0.0 - Release
v1.0.1 - Changed Healable from a boolean into an integer stack.
v1.0.2 - Changed Healable to Heal_Block/Heal_BlockAll.
v1.0.3 - Fixed bug that caused the system ignore the amount of healing.
v1.0.4 - Added heal type, it is useful for spell making.
v1.0.5 - Fixed heal type's bug. Changed Heal_GetTriggerUnit() to Heal_Target().
v1.0.6 - Removed useless parameter in Heal_BlockAll(). Fixed block healing code.
v1.0.7 - Moved initializer into module to fix bug (Heal_RegisterEvent did not work in struct initializers) which is caused by jasshelper.
v1.0.8 - Removed stack, replaced with local variables. A little efficiency gain in getting source/target/amount/type and adding block. Removed the usage of UnitAlive to avoid problem from map optimizer.
v2.0.0 - Rewrote whole library from scratch. Added prioritized event firing, ability to register heal events for particular unit, and modify amount of healing. Heal can never be done so easily before this!
 

Attachments

Sickle

New Member
You have gone way overboard. You took a simple function that should maybe be attached to an event and turned it into a mess.

Make it cleaner. Make it faster. Make it sane.

Edit:

This is the kind of thing I want to see.
JASS:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\\
//:: Heal                                                                           ::\\
//::                                                                                ::\\
//:: by your friendly neighborhood Sickle.                                          ::\\
//::                                                                                ::\\
//:: What?                                                                          ::\\
//::   1. Heal lets you heal units using a certain function.                        ::\\
//::   2. It is recommended that all healing in your map be done with this function.::\\
//::                                                                                ::\\
//:: Why?                                                                           ::\\
//::   1. Heal fires an event when a unit is healed.                                ::\\
//::   2. It provides a clean, standard healing function.                           ::\\
//::   3. Why should I need another reason?                                         ::\\
//::                                                                                ::\\
//:: How?                                                                           ::\\
//::   These functions are available to you.                                        ::\\
//::                                                                                ::\\
//::     Heal(unit toHeal, real amount) returns nothing                             ::\\
//::       This function heals the unit for the given amount and fires an event.    ::\\
//::                                                                                ::\\
//::     GetHealedUnit(nothing) returns unit                                        ::\\
//::       This function returns the unit healed in the event.                      ::\\
//::                                                                                ::\\
//::     GetHealAmount(nothing) returns real                                        ::\\
//::       This function returns how much a unit was healed for.                    ::\\
//::                                                                                ::\\
//::     TriggerRegisterHealEvent(trigger whichTrigger) returns nothing             ::\\
//::       This function causes the trigger to fire when a unit is healed via Heal. ::\\
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\\

library Heal requires Event

globals
    private unit u = null
    private Event e
    private real r = 0
endglobals

function TriggerRegisterHealEvent takes trigger t returns nothing
    call e.register(t)
endfunction

function GetHealedUnit takes nothing returns unit
    return u
endfunction

function GetHealAmount takes nothing returns real
    return r
endfunction

native UnitAlive takes unit id returns boolean

function Heal takes unit lu, real lr returns nothing
    if not UnitAlive(lu) then
       return
    endif
    set r = lr
    set u = lu
    call SetWidgetLife(lu, GetWidgetLife(lu) + lr)
    call e.fire()
    set r = 0
    set u = null
endfunction

private struct Sickle extends array
static method onInit takes nothing returns nothing
    set e = Event.create()
endmethod
endstruct

endlibrary


Edit II: Maybe, just maybe, this.
JASS:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\\
//:: Heal                                                                           ::\\
//::                                                                                ::\\
//:: by your friendly neighborhood Sickle.                                          ::\\
//::                                                                                ::\\
//:: What?                                                                          ::\\
//::   1. Heal lets you heal units using a certain function.                        ::\\
//::   2. It is recommended that all healing in your map be done with this function.::\\
//::                                                                                ::\\
//:: Why?                                                                           ::\\
//::   1. Heal fires an event when a unit is healed.                                ::\\
//::   2. It provides a clean, standard healing function.                           ::\\
//::   3. Why should I need another reason?                                         ::\\
//::                                                                                ::\\
//:: How?                                                                           ::\\
//::   These functions are available to you.                                        ::\\
//::                                                                                ::\\
//::     Heal(unit toHeal, real amount) returns nothing                             ::\\
//::       This function heals the unit for the given amount and fires an event.    ::\\
//::                                                                                ::\\
//::     HealEx(unit healer, unit toHeal, real amount) returns nothing              ::\\
//::       This function heals the unit for the given amount and fires an event.    ::\\
//::                                                                                ::\\
//::     GetHealedUnit(nothing) returns unit                                        ::\\
//::       This function returns the unit healed in the event.                      ::\\
//::                                                                                ::\\
//::     GetHealer(nothing) returns unit                                            ::\\
//::       This function returns the healer (if any) in the event.                  ::\\
//::                                                                                ::\\
//::     GetHealAmount(nothing) returns real                                        ::\\
//::       This function returns how much a unit was healed for.                    ::\\
//::                                                                                ::\\
//::     TriggerRegisterHealEvent(trigger whichTrigger) returns nothing             ::\\
//::       This function causes the trigger to fire when a unit is healed via Heal. ::\\
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\\

library Heal requires Event

globals
    private unit u = null
    private unit h = null
    private Event e
    private real r = 0
endglobals

function TriggerRegisterHealEvent takes trigger t returns nothing
    call e.register(t)
endfunction

function GetHealedUnit takes nothing returns unit
    return u
endfunction

function GetHealAmount takes nothing returns real
    return r
endfunction

function GetHealer takes nothing returns unit
    return h
endfunction

native UnitAlive takes unit id returns boolean

function Heal takes unit lu, real lr returns nothing
    if not UnitAlive(lu) then
       return
    endif
    set r = lr
    set u = lu
    call SetWidgetLife(lu, GetWidgetLife(lu) + lr)
    call e.fire()
    set r = 0
    set u = null
endfunction

function HealEx takes unit lh, unit lu, real lr returns nothing
    if not UnitAlive(lu) then
       return
    endif
    set r = lr
    set u = lu
    set h = lh
    call SetWidgetLife(lu, GetWidgetLife(lu) + lr)
    call e.fire()
    set r = 0
    set u = null
    set lh = null
endfunction

private struct Sickle extends array
static method onInit takes nothing returns nothing
    set e = Event.create()
endmethod
endstruct

endlibrary
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
He is going to use his version of Heal to crush your map by making the functionality of GetWidgetLife > .405 fails. :p
 

Sickle

New Member
Here. Let me fix that then. Import this and find and replace GetWidgetLife(u) > .405 with IsUnitAlive(u). Alternatively, I updated my script.

JASS:
library IsUnitAlive

native UnitAlive takes unit id returns boolean

function IsUnitAlive takes unit u returns boolean
    return UnitAlive(u)
endfunction

function IsUnitDead takes unit u returns boolean
    return not UnitAlive(u)
endfunction

endlibrary
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
JASS:
library HealCrusher initializer Init requires Heal
    
    private function Cond takes nothing returns boolean
        call Heal(GetHealedUnit(),100.)
        return false
    endfunction
    
    private function Init takes nothing returns nothing
          local trigger trig = CreateTrigger()
          call TriggerRegisterHealEvent(trig)
          call TriggerAddCondition(trig,Condition(function Cond))
    endfunction
endlibrary

Put this library into a map.
Make a healing spell with your library, then cast it. See what happen.

JASS:
library HealCrusher initializer Init requires Heal
    
    private function Cond takes nothing returns boolean
        call HealUnit(Heal_GetSource(),Heal_GetTriggerUnit(),100.)
        return false
    endfunction
    
    private function Init takes nothing returns nothing
          local trigger trig = CreateTrigger()
          call Heal_RegisterEvent(trig)
          call TriggerAddCondition(trig,Condition(function Cond))
    endfunction
endlibrary

Use this with my library. Test the spell. Compare them.
 

Sickle

New Member
Whoop dee doo. Yours works recursively. Somewhat.

I could achieve what your system does with a single check. But that would be stupid. Recursive healing is madness.
 

Sickle

New Member
Yes. I know.

His is recursively defined. Somewhat.

I could add a single check and mine is fixed.
 

Viikuna

No Marlo no game.
Somethign like this is indeed useful, since it makes it easy to create for example some buff types that make unit unhealable or something, or some thingies that incerease healing done or whatever.

But its so simple, that it might be easier for user to make it himself. Dont really know.
 

Weep

Godspeed to the sound of the pounding
// Questions : UnitDamageTarget does healing
// effect when negative damage amount is used
// as arguement. Why we need to use this?
//
// Truth : UnitDamageTarget works but it is not
// detectable by EVENT_UNIT_DAMAGED.
Uh, what? Negative target damage only works with spell-type damage (otherwise is 0) and can be detected by EVENT_UNIT_DAMAGED just fine.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Uh, what? Negative target damage only works with spell-type damage (otherwise is 0) and can be detected by EVENT_UNIT_DAMAGED just fine.
Oh, ya. Forget to update it, it works just fine.

However, some damage detection systems do GetEventDamage() > 0. filtration before executing triggers.
 

Jesus4Lyf

Good Idea™
However, some damage detection systems does GetEventDamage() > 0. filtration before executing triggers.
Post in the threads of such systems and complain. I don't think we have any at TheHelper.
JASS:
Heal_Enable(unit, flag)

Heal_Bock(amount) makes much more sense, because it can be totally conditional.
 

Advice D.

New Member
Just a few things I noticed:
JASS:
//  Heal_Unit(healer, target, amount)
Should be "HealUnit"?
JASS:
            if life == maxlife then
                return false//If target has full hp, no healing is done.
            else
                set amount = maxlife - life //if current hp + amount &gt; max hp, set amount to max hp - current hp.
                call SetWidgetLife(target,life + amount)
            endif
This ends up fully healing regardless of the amount used in the function call. Add a hp check, perhaps?
EDIT: Just tested it without the maxlife-life line and it worked fine. Is there any reason for it to be in at all?
 

XeNiM666

I lurk for pizza
Hmmm. Nice system. Just what I needed for a spell... XD

May I suggest a "Heal over time" function?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
@Advice D.
Should be "HealUnit"?
That was a typo. >< My bad.

This ends up fully healing regardless of the amount used in the function call. Add a hp check, perhaps?
EDIT: Just tested it without the maxlife-life line and it worked fine. Is there any reason for it to be in at all?

I will look into it. :p

@XeNiM666
3 flavors here for you to choose. :)

JASS:
/////////////////////////////////////////////////////////////
//
//                  Timed Healing (Blue)
//                        v1.0.0
//  
//                  An add-on for Heal.
//
//     It enables &quot;healing over time&quot; can be done easily.
//
//  Functions provided :
//  TimedHealUnit(healer,target,amount,period,duration,effect)
//
//  Info :
//  Blue   : Uses KT2
//  Red    : Uses T32 (For speed freaks)
//  Purple : Uses TimerUtils (For those who does not like KT2)
//
//  Blue and Purple flavor are able to deal with any period.
//  Red flavor is only able to heal every .03125 (T32's period)
//////////////////////////////////////////////////////////////
library_once TimedHealing requires Heal, KT

    private struct Data
        unit healer
        unit target
        real amount
        real tick
        effect eff
        
        method onDestroy takes nothing returns nothing
            call DestroyEffect(.eff)
            set .eff = null
        endmethod
        
    endstruct
    
    private function Handler takes nothing returns boolean
        local Data d = KT_GetData()
        if d.tick &gt; 0 then
            set d.tick = d.tick - 1
            if HealUnit(d.healer,d.target,d.amount) == false then
                call d.destroy()
                return true
            endif
            return false
        endif
        call d.destroy()
        return true
    endfunction

    function TimedHealUnit takes unit healer, unit target, real totalAmount, real period, real duration, effect eff returns nothing
        local Data d = Data.create()
        set d.healer = healer
        set d.target = target
        set d.tick = R2I(duration / period)
        set d.amount = totalAmount / period
        set d.eff = eff
        call KT_Add(function Handler,d,period)
    endfunction
endlibrary


JASS:
/////////////////////////////////////////////////////////////
//
//                  Timed Healing (Red)
//                        v1.0.0
//  
//                  An add-on for Heal.
//
//     It enables &quot;healing over time&quot; can be done easily.
//
//  Functions provided :
//  TimedHealUnit(healer,target,amount,period,duration,effect)
//
//  Info :
//  Blue   : Uses KT2
//  Red    : Uses T32 (For speed freaks)
//  Purple : Uses TimerUtils (For those who does not like KT2)
//
//  Blue and Purple flavor are able to deal with any period.
//  Red flavor is only able to heal every .03125 (T32's period)
//////////////////////////////////////////////////////////////
library_once TimedHealing requires Heal, T32

    private struct Data
        unit healer
        unit target
        real amount
        real tick
        effect eff
        
        method onDestroy takes nothing returns nothing
            call DestroyEffect(.eff)
            set .eff = null
        endmethod
        
        method periodic takes nothing returns nothing
            if .tick &gt;= T32_Tick then
                if HealUnit(.healer,.target,.amount) == false then
                    call .destroy()
                    call .stopPeriodic()
                endif
            else
                call .destroy()
                call .stopPeriodic()
            endif
        endmethod
        
        implement T32x
        
        static method add takes unit healer, unit target, real totalAmount, real duration, effect eff returns nothing
            local thistype this  = thistype.create()
            set .healer = healer
            set .target = target
            set .tick = T32_Tick + R2I(duration / T32_PERIOD)
            set .amount = totalAmount / T32_PERIOD
            set .eff = eff
            call .startPeriodic()
        endmethod
    endstruct

    function TimedHealUnit takes unit healer, unit target, real totalAmount, real duration, effect eff returns nothing
        call Data.add(healer,target,totalAmount,duration,eff)
    endfunction
endlibrary


JASS:
/////////////////////////////////////////////////////////////
//
//                  Timed Healing (Purple)
//                        v1.0.0
//  
//                  An add-on for Heal.
//
//     It enables &quot;healing over time&quot; can be done easily.
//
//  Functions provided :
//  TimedHealUnit(healer,target,amount,period,duration,effect)
//
//  Info :
//  Blue   : Uses KT2
//  Red    : Uses T32 (For speed freaks)
//  Purple : Uses TimerUtils (For those who does not like KT2)
//
//  Blue and Purple flavor are able to deal with any period.
//  Red flavor is only able to heal every .03125 (T32's period)
//////////////////////////////////////////////////////////////
library_once TimedHealing requires Heal, TimerUtils

    private struct Data
        unit healer
        unit target
        real amount
        real tick
        effect eff
        timer t
        
        method onDestroy takes nothing returns nothing
            call ReleaseTimer(.t)
            call DestroyEffect(.eff)
            set .eff = null
        endmethod
        
    endstruct
    
    private function Handler takes nothing returns boolean
        local Data d = GetTimerData(GetExpiredTimer())
        if d.tick &gt; 0 then
            set d.tick = d.tick - 1
            if HealUnit(d.healer,d.target,d.amount) == false then
                call d.destroy()
            endif
            return false
        endif
        call d.destroy()
        return true
    endfunction

    function TimedHealUnit takes unit healer, unit target, real totalAmount, real period, real duration, effect eff returns nothing
        local Data d = Data.create()
        set d.healer = healer
        set d.target = target
        set d.tick = R2I(duration / period)
        set d.amount = totalAmount / period
        set d.eff = eff
        set d.t = NewTimer()
        call SetTimerData(d.t,d)
        call TimerStart(d.t,period,true,function Handler)
    endfunction
endlibrary


Update :
v1.0.3 released. Credits to Advice D. for finding out the bug.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    My grandmother just passed away, she was 95. I might be going to Florida for a week.
  • The Helper The Helper:
    I have a buddy in Florida who has an extra office space for me with a computer so I can do anything so likely I will be going up there wednesday or thursday
  • Ghan Ghan:
    Let me know if there's anything I can do to help.
  • The Helper The Helper:
    thank you Ghan
  • jonas jonas:
    Sorry for your loss
    +1
  • Varine Varine:
    I'm sorry to hear that bro
  • Varine Varine:
    Not to distract but is anyone aware of any software to help visually impaired people interact with their PC?
  • Varine Varine:
    Also what's the best way to ship a PC? Should I just wrap the fuck out of it in the case or put the components in static bags and wrapped up individually?
  • Ghan Ghan:
    The GPU is the biggest danger typically.
  • Ghan Ghan:
    Some of the pre-built vendors use expanding foam to fill in the case and secure the GPU. Otherwise it might be best to remove it and ship it separately.
  • Ghan Ghan:
    Similar if the machine has a large tower CPU cooler installed. Those can experience huge forces and destroy the socket during shipment if they are heavy.
  • Varine Varine:
    So mainly just the heavier things that jut out? I'm planning on pulling out the SSD's too and anything that I don't have well secured. I'll probably be good leaving the motherboard and PSU screwed in there though if I bundle it up?
  • Ghan Ghan:
    Yeah, I'd expect those to be fine. It's mainly the heavy stuff that is also long/tall where dropping the case would cause it to exert a ton of force on the mount. The motherboard will be fine screwed into the board unless the case itself is somehow severely damaged.
  • Varine Varine:
    I have the original packaging for it, so I was going to just put it back in there
  • Varine Varine:
    I don't think I have the boxes for the components though and so I don't want to have a bunch of loose shit bouncing around
  • The Helper The Helper:
    damn I just read that lol
  • The Helper The Helper:
    when i read up and saw spray in foam I was like oh shit
  • The Helper The Helper:
    going to do the last controller giveaway in the NUON Dome forum because I just cannot sell them since I got them for free from a deceased NUON Legend. It is my last one from that.

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top