I can't find out how to fix my code.

Ostrze

New Member
Reaction score
0
I've made a spell, that is chain heal spell...
But when i try to activate it in my WE, it pop out a list of errors. Why can it be?
Here is the spell code:
JASS:
function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

function ChainHeal takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local unit prevtarg
    local unit targ = GetSpellTargetUnit()
    local unit nexttarg
    local unit dummy
    local location p = GetUnitLoc(targ)
    local group postargets = GetUnitsInRangeOfLocAll( 500.00 , p)
    local group donetargets
    local integer noofdone
    local real heroint = GetHeroStatBJ(bj_HEROSTAT_INT, cast, true) 
    
    if IsUnitAlly(targ , GetOwningPlayer(cast)) == true then
        if IsUnitInGroup(targ , donetargets) == false then
            set dummy = CreateUnitAtLoc( GetOwningPlayer(cast) , 'h000' , GetUnitLoc(cast) , 0.00 )
            call IssueTargetOrder( dummy , "ChainHeal" , targ )
            call UnitApplyTimedLife( dummy , 'BTLF' , 3.00)
            call SetUnitLifeBJ(targ , ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( 3 * heroint)))
            call TriggerSleepAction(3.00)
        endif
    endif
    set dummy = null
    set nexttarg = FirstOfGroup(postargets)
    set p = GetUnitLoc(nexttarg)
    set postargets = GetUnitsInRangeOfLocAll( 500.00 , p)
    call GroupAddUnit(donetargets, targ)
    set noofdone = noofdone + 1
    set prevtarg = targ
    set targ = nexttarg
    set heroint = heroint * 0.75     
        
    loop
        exitwhen noofdone == 16
        if IsUnitAlly(targ , GetOwningPlayer(cast)) == true then
            if IsUnitInGroup( targ , donetargets) == false then
                set dummy = CreateUnitAtLoc( GetOwningPlayer(cast) , 'h000' , GetUnitLoc(prevtarg) , 0.00 )
                call IssueTargetOrder( dummy , "ChainHeal" , targ )
                call UnitApplyTimedLife( dummy , 'BTLF' , 3.00)
                call SetUnitLifeBJ(targ , ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( 3 * heroint)))
            endif
        endif
        set nexttarg = FirstOfGroup(postargets)
        set p = GetUnitLoc(nexttarg)
        set postargets = GetUnitsInRangeOfLocAll( 500.00 , p)
        set dummy = null
        call GroupAddUnit(donetargets, targ)
        set noofdone = noofdone + 1
        set prevtarg = targ
        set targ = nexttarg
        set heroint = heroint * 0.75
    endloop
    
    set cast = null
    set targ = null
    set prevtarg = null
    set nexttarg = null
    set p = null
    set postargets = null
    set donetargets = null   
    
function InitTrig_ChainHeal takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition(function Cond))
    call TriggerAddAction( t, function ChainHeal)
endfunction


There is one saying awaiting endif. The other ones are mostly to do something with the last part of my spell. It's when i am nullyfying my variables.

Can some1 fix this?


My JaSS Shop Pro doesn't find anything.
 

Artificial

Without Intelligence
Reaction score
326
JASS:
[...]
    set p = null
    set postargets = null
    set donetargets = null
    //set noofdone = null  --  The variable is an integer, null isn't.
    //set heroint = null   --  The variable is a real, null isn't.
    // Only handles are nulled, not reals, integers, strings, codes, and booleans.
endfunction // You were missing this.
    
function InitTrig_ChainHeal takes nothing returns nothing
    local trigger t
[...]
 

Ostrze

New Member
Reaction score
0
So...
After i fixed the code as you said...i am able to test it. After i tested it i found out it doesn't work. Any idea on how to fix the problem? I changed the code in the first post.
 

Ostrze

New Member
Reaction score
0
The spell itself still doesn't work...and when i put second jass spell into the map, it displays a long error list...277 lines. What's wrong with that?
 
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