Warcraft III resources & community, 2003–2006 · archived

Spell Help

24 posts
#16
I understand everything but : set caster = GetHandleUnit(trg, "LABEL"). What is that function for?
#17
That is the whole trick... Get locals from one function to another. But I didn't get it work yet... Perhaps Vicky can find a solution .:D
#18
So, locals can ONLY be used in one function? I thought they can be used anywhere in the whole trigger. Why dont you use a couple globals for the stuff you need in another function? I dont need it to be multiinstance.
#19
Because there may be more than one unit affected by the spell at the same time. That is the whole problem. Making it with triggers would be very buggy... And with JASS without locals... I wouldn't see the point because it would be buggy again. I'll try to have only one caster and more targets but I don't know if it will work. I want this spell perfect btw... :D
#20
As do i Daelin, as do i :P
Vicky hurry and help plz
#21
He looks online but he wouldn't answer... Dang... I have time to do it tonight if I get the solution. Bah...
#22
First Daelin i'm REALLY srry i didn't answer.Man the messenger should have notifited me(i was playing Sacred)Second such functions does not exist!Reason:you copyed this from Vexorian didn't you?Well those are his functions and he maded them!You have to copy the functions from one of his maps CS sections.Good luck to find them!
#23
Anyways Vexorian uses gamecaches to store memory that's what i tryed to do but it seems it doesn't work!That's why i posted the topic "Problem with gamechaches"If you wish try the script out or i shall make a new function by myself! :wink:
#24
Ok... I realized that the gamecache was not a solution and that the only way I can do it would be to take the unit itself but... look over the code.


function Trig_Chained_Souls_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Attacked takes unit caster returns nothing

local unit attacked
local real life
local real dmg
local real heal
local real dam
local unit caster
local trigger trg 

set trg = GetTriggeringTrigger()
set attacked = GetAttackedUnitBJ()
set life = GetUnitState(attacked,UNIT_STATE_LIFE)
set dmg = GetEventDamage()*0.60
set heal = life+dmg
set dam = life-dmg

call SetUnitLifeBJ (attacked, heal)
call SetUnitLifeBJ (caster, dam)

set caster = null
set attacked = null

endfunction


function Trig_Chained_Souls_Actions takes nothing returns nothing

    local unit cast
    local unit targ
    local trigger trg

    set targ = GetSpellTargetUnit()
    set cast = GetSpellAbilityUnit()
    set trg = CreateTrigger()

    call TriggerAddAction(trg, function Attacked(cast)) //the problem is here   

    loop
        exitwhen (UnitHasBuffBJ(targ,'B000')==false)
        call TriggerSleepAction (0.00)
    endloop

    set trg = null
    set targ = null
    set cast = null     

endfunction
[/jass]