1.24 patch causes my spells make wc3 not load

Red_drake

New Member
Reaction score
4
so basically, after patch 1.24, i had to sift through my map and remove all the retun bugs (which i did) but its still not loading (like im still using the return bug(which im not)) and then i read somewhere about if/elseif blocks causing wc3 to think im using the return bug... so i isolated the triggers that are causing it to not load... so i disabled the triggers, the map loads fine, and then when i re-enable the triggers, the map doesnt load (like im using the bug)... now 4/6 of the spells dont use *anything* fancy, just a basic unit casts spell. do simple effects (the other two use TimerUtils, but i fixed that to use GetHandleId(h) instead of the return bug)... but for some reason its still not loading (i disabled the condition, cause i thought something might be messed up with the condition's return, but its not that, i also removed the filter cause it uses if/elseif blocks, but its not that either)

so, after my long explanation, here are my spells, if anyone could *please* help me, i really would rather be able to actually finish this map...

EDIT: so only stalker and blood for the blood god dont work now

EDIT2: so everything is fixed, i set booleans isntead of returninig, and put the single spells without filters into scopes and made the gobals private, and everything works... this thread can be closed now.

JASS:
globals
    integer i
endglobals

function Trig_Stalker_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetTriggerUnit(), 'A04P') > 0
endfunction
    
struct stalker
    unit u
endstruct

function stalker_filter takes nothing returns nothing
    if GetDestructableTypeId(GetEnumDestructable()) == 'JTtw' then
        set i = i+1
    endif
endfunction

function stalker_timer takes nothing returns nothing 
    local location l 
    local stalker d = GetTimerData(GetExpiredTimer())
    
    set i = 0
    set l = GetUnitLoc(d.u)
    call LoreEnumDestructablesInRangeOfLoc(l, 350, function stalker_filter)
    
    if i > 0 then
        if GetUnitAbilityLevel(d.u, 'A04U') == 0 then
            call UnitAddAbility(d.u, 'A04W')
        endif
        call SetUnitAbilityLevel(d.u, 'A04U', GetUnitAbilityLevel(d.u, 'A04P'))
        call SetUnitAbilityLevel(d.u, 'A04V', GetUnitAbilityLevel(d.u, 'A04P'))
    else
        call UnitRemoveAbility(d.u, 'A04W')
    endif
    
    call RemoveLocation(l)
    set l = null
endfunction

function Trig_Stalker_Actions takes nothing returns nothing
    local timer t = NewTimer()
    local stalker d = stalker.create()
    
    set d.u = GetTriggerUnit()
    
    call SetTimerData(t, d)
    call TimerStart(t, 1, true, function stalker_timer)
endfunction

//===========================================================================
function InitTrig_Stalker takes nothing returns nothing
    set gg_trg_Stalker = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Stalker, GetWorldBounds())
    call TriggerAddCondition( gg_trg_Stalker, Condition( function Trig_Stalker_Conditions ) )
    call TriggerAddAction( gg_trg_Stalker, function Trig_Stalker_Actions )
endfunction

JASS:
function Trig_the_shrouding_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetTriggerUnit(), 'A06A') > 0
endfunction

struct shrouding
    unit u
endstruct

function shrouding_filter takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) then
        return false
    endif
    
    return true
endfunction

function shrouding_timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local shrouding d = GetTimerData(t)
    local unit u = d.u
    local location l = GetUnitLoc(u)
    local group g = CreateGroup()
    local unit n
    local unit i
 
     if IsUnitType(d.u, UNIT_TYPE_DEAD) == false then
        call GroupEnumUnitsInRangeOfLoc(g, l, 800, Condition(function shrouding_filter))    
        loop
            set n = FirstOfGroup(g)
            call GroupRemoveUnit(g, n)
            exitwhen n == null
            
            if IsUnitEnemy(n, GetOwningPlayer(u)) then 
                set i = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
                call UnitAddAbility(i, 'A080')
                call SetUnitAbilityLevel(i, 'A080', GetUnitAbilityLevel(u, 'A06A'))
                call IssueTargetOrder(i, "curse", n)
                call UnitApplyTimedLife(i, 'BTLF', 2)
            endif        
        endloop
    endif

    call d.destroy()
    call DestroyGroup(g)
    call RemoveLocation(l)
    set g = null
    set l = null
    set u = null
    set n = null
    set i = null
endfunction

function Trig_the_shrouding_Actions takes nothing returns nothing
    local timer t = NewTimer()
    local shrouding d = shrouding.create()
    
    set d.u = GetTriggerUnit()
    call SetTimerData(t, d)
    call TimerStart(t, 1, true, function shrouding_timer)
    
    call d.destroy()
endfunction

//===========================================================================
function InitTrig_the_shrouding takes nothing returns nothing
    set gg_trg_the_shrouding = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_the_shrouding, GetWorldBounds())
    call TriggerAddCondition( gg_trg_the_shrouding, Condition( function Trig_the_shrouding_Conditions ) )
    call TriggerAddAction( gg_trg_the_shrouding, function Trig_the_shrouding_Actions )
endfunction

JASS:
function Trig_nemasis_active_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A06C'
endfunction

function Trig_nemasis_active_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit n
    local unit i = GetSpellTargetUnit()
    local unit t
    local location l = GetUnitLoc(u)
            
    set n = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
    call UnitAddAbility(n, 'A06K')
    call IssueTargetOrder(n, "spiritlink", u)
    call UnitApplyTimedLife(n, 'BTLF', 2)
    
    set t = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
    call UnitAddAbility(t, 'A075')
    call IssueTargetOrder(t, "thunderbolt", i)
    call UnitApplyTimedLife(t, 'BTLF', 2)
    
    call UnitAddAbility(u, 'A06M')    
    call SetUnitAbilityLevel(u, 'A06J', GetUnitAbilityLevel(u, 'A06C'))
    
    call IssueTargetOrder(u, "attack", i)
    
    call RemoveLocation(l)
    set l = null
    set u = null
    set n = null
    set i = null
    set t = null
endfunction

function StartNemasis takes nothing returns nothing
    set gg_trg_nemasis_active = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_nemasis_active, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_nemasis_active, Condition( function Trig_nemasis_active_Conditions ) )
    call TriggerAddAction( gg_trg_nemasis_active, function Trig_nemasis_active_Actions )
endfunction

//===========================================================================
function InitTrig_nemasis_active takes nothing returns nothing
endfunction

JASS:

function Trig_ardent_blade_cast_Conditions takes nothing returns boolean
    return true
endfunction

function blade_filter takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) then
        return false
    endif
    
    return true
endfunction

function Trig_ardent_blade_cast_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit n
    local unit i
    local location l = GetUnitLoc(u)
    local group g = CreateGroup()
    
    call SetUnitTimeScale(u, .5) 
    call SetUnitAnimation(u, "attack")
    
    call GroupEnumUnitsInRangeOfLoc(g, l, 700, Condition(function blade_filter))
    loop
        set n = FirstOfGroup(g)
        call GroupRemoveUnit(g, n)
        exitwhen n == null
            
        if AngleBetweenUnits(n, u)+180 > (GetUnitFacing(u)-45) and AngleBetweenUnits(n, u)+180 < (GetUnitFacing(u)+45) and IsUnitAlly(n, GetOwningPlayer(u)) == false then
            set i = CreateUnitAtLoc(GetOwningPlayer(u), 'h01E', l, 270)
            call SetUnitAbilityLevel(i, 'A09N', GetUnitAbilityLevel(u, 'A09J'))
            call IssueTargetOrder(i, "attack", n)
            call UnitApplyTimedLife(i, 'BTLF', 1)
        endif
    endloop
    
    call SetUnitTimeScale(u, 1)    
    
    call RemoveLocation(l)
    call DestroyGroup(g)
    set l = null
    set g = null
    set u = null
    set n = null
    set i = null
endfunction

function StartArdentCast takes nothing returns nothing
    set gg_trg_ardent_blade_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ardent_blade_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ardent_blade_cast, Condition( function Trig_ardent_blade_cast_Conditions ) )
    call TriggerAddAction( gg_trg_ardent_blade_cast, function Trig_ardent_blade_cast_Actions )
endfunction

//===========================================================================
function InitTrig_ardent_blade_cast takes nothing returns nothing
endfunction

JASS:
function Trig_UnstableInjection_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00O'
endfunction

function Trig_UnstableInjection_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit n = GetSpellTargetUnit()
    local location l = GetUnitLoc(n)
    local unit i
    local real r = GetUnitState(n, UNIT_STATE_LIFE)
    
    if IsUnitAlly(n, GetOwningPlayer(u)) == true then
        call SetUnitState(n, UNIT_STATE_LIFE, r + (75 + 50*GetUnitAbilityLevel(u, 'A00O')) )
        
        set i = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
        call UnitAddAbility(i, 'A00Q')
        call SetUnitAbilityLevel(i, 'A00Q', GetUnitAbilityLevel(u, 'A00O'))
        call IssueTargetOrder(i, "bloodlust", n)
        call UnitApplyTimedLife(i, 'BTFL', 2)
        
    else
        call UnitDamageTarget(u, n, (75 + 50*GetUnitAbilityLevel(u, 'A00O')), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
        
        set i = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
        call UnitAddAbility(i, 'A00P')
        call SetUnitAbilityLevel(i, 'A00P', GetUnitAbilityLevel(u, 'A00O'))
        call IssueTargetOrder(i, "slow", n)
        call UnitApplyTimedLife(i, 'BTFL', 2)
    endif
    
    call RemoveLocation(l)
    set u = null
    set n = null
    set i = null    
endfunction

function StartInjection takes nothing returns nothing
    set gg_trg_UnstableInjection = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_UnstableInjection, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_UnstableInjection, Condition( function Trig_UnstableInjection_Conditions ) )
    call TriggerAddAction( gg_trg_UnstableInjection, function Trig_UnstableInjection_Actions )
endfunction

//===========================================================================
function InitTrig_UnstableInjection takes nothing returns nothing
endfunction

JASS:
globals
    integer level = 0
endglobals

function Trig_Blood_for_the_Blood_God_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetKillingUnit(), 'A03O') > 0
endfunction

function Trig_Blood_for_the_Blood_God_Actions takes nothing returns nothing
    local unit u = GetKillingUnit()
    local unit n
    local location l = GetUnitLoc(u)
    
    set n = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l, 270)
    call UnitAddAbility(n, 'A03Q')
    
    if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
        set level = 5 + 5*GetUnitAbilityLevel(u, 'A03O')
    elseif GetUnitAbilityLevel(u, 'B015') == 0 then
        set level = 1
    else
        set level = level + 1
        if level > 5 + 5*GetUnitAbilityLevel(u, 'A03O') then
            set level = 5 + 5*GetUnitAbilityLevel(u, 'A03O')
        endif
    endif
    
    call SetUnitAbilityLevel(n, 'A03Q', level)        
    call IssueImmediateOrder(n, "roar")
    call UnitApplyTimedLife(n, 'BTLF', 2)
    
    call RemoveLocation(l)
    set u = null
    set n = null
    set l = null
endfunction

function StartBloodGod takes nothing returns nothing
    set gg_trg_Blood_for_the_Blood_God = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Blood_for_the_Blood_God, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Blood_for_the_Blood_God, Condition( function Trig_Blood_for_the_Blood_God_Conditions ) )
    call TriggerAddAction( gg_trg_Blood_for_the_Blood_God, function Trig_Blood_for_the_Blood_God_Actions )
endfunction

//===========================================================================
function InitTrig_Blood_for_the_Blood_God takes nothing returns nothing
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, the only thing I know about the new patch is that you can't use elseif, so:
JASS:
function shrouding_filter takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
        return false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) then
        return false
    endif
    
    return true
endfunction


Has to be:

JASS:
function shrouding_filter takes nothing returns boolean
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
        return false
    endif
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
        return false
    endif
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) then
        return false
    endif
    
    return true
endfunction


Or you could simple do this:
JASS:
<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">JASS:</div><div class="bbCodeBlock-content"><pre class="bbCodeCode"><code class="jass"><span class="keyword">function</span> <span>shrouding_filter</span> <span class="keyword">takes</span> <a href="http://wiki.thehelper.net/wc3/jass/common.j/nothing" class="type">nothing</a> <span class="keyword">returns</span> <a href="http://wiki.thehelper.net/wc3/jass/common.j/boolean" class="type">boolean</a>
    <span class="keyword">return</span> <span class="symbol">(</span><span class="keyword">not</span> <span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/IsUnitType" class="native">IsUnitType</a><span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/GetFilterUnit" class="native">GetFilterUnit</a><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">,</span> <a href="http://wiki.thehelper.net/wc3/UNIT_TYPE_MECHANICAL" class="variable">UNIT_TYPE_MECHANICAL</a><span class="symbol">)</span><span class="symbol">)</span><span class="symbol">)</span> <span class="keyword">or</span> <span class="symbol">(</span><span class="keyword">not</span> <span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/IsUnitType" class="native">IsUnitType</a><span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/GetFilterUnit" class="native">GetFilterUnit</a><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">,</span> <a href="http://wiki.thehelper.net/wc3/UNIT_TYPE_STRUCTURE" class="variable">UNIT_TYPE_STRUCTURE</a><span class="symbol">)</span><span class="symbol">)</span><span class="symbol">)</span> <span class="keyword">or</span> <span class="symbol">(</span><span class="keyword">not</span> <span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/IsUnitType" class="native">IsUnitType</a><span class="symbol">(</span><a href="http://wiki.thehelper.net/wc3/jass/common.j/GetFilterUnit" class="native">GetFilterUnit</a><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">,</span> <a href="http://wiki.thehelper.net/wc3/UNIT_TYPE_DEAD" class="variable">UNIT_TYPE_DEAD</a><span class="symbol">)</span><span class="symbol">)</span><span class="symbol">)</span>
<span class="keyword">endfunction</span></code></pre></div></div>
 

UndeadDragon

Super Moderator
Reaction score
447
Why the hell did Blizzard stop you using elseif??

Elseif is an important conditional statement.
 

Red_drake

New Member
Reaction score
4
well, i thought that would be a problem too, but there are triggers that dont use elseifs at all, and still bug
 

darkreapers

New Member
Reaction score
6
have you also checked any systems you may have in your map, e.g timer ultis ect ect. those systems would need to be updated as well
 

jwallstone

New Member
Reaction score
33
It has nothing to do with elseif. There is nothing wrong with using it. It has everything to do with how you use the "return" statement. It's safest to just use it at the end of the function.
 

waaaks!

Zinctified
Reaction score
255
It has nothing to do with elseif. There is nothing wrong with using it. It has everything to do with how you use the "return" statement. It's safest to just use it at the end of the function.
agreed

its still about the return bug, they say they have fixed the return bug, but people still found a way to use return bug, and with that, lots of if/else/elseif blocks with returns turned out to be bugged
 

R 3 T R O

New Member
Reaction score
12
Uhm are you guys sure you cant use the elseif becaouse im using it and i can still host the map properly xD
 

Rainther

I guess I should write something of value here...
Reaction score
61
JASS:
function returnish takes noting returns boolean
local boolean returner
if &lt;statement&gt; then
set returner = false
elseif &lt;statement2&gt; then
set returner = true
endif
return returner
Works, rite? Anybuddy got a good method to search and replace elseif returners in ones map? Cause I have like 40 seperate triggers :p
 

Igor_Z

You can change this now in User CP.
Reaction score
61
Does some 1 know something about GUI? I want to know should I update to the 1.24 patch or not. Reply plz
 

Chocobo

White-Flower
Reaction score
409
Does some 1 know something about GUI? I want to know should I update to the 1.24 patch or not. Reply plz

GUI only can't do elseif return or H2I return bug so it's safe.


JASS:
function returnish takes noting returns boolean
local boolean returner
if &lt;statement&gt; then
set returner = false
elseif &lt;statement2&gt; then
set returner = true
endif
return returner


should work

but another way of doing this would be :
JASS:
function returnish takes noting returns boolean
return (&lt;statement2&gt; and not &lt;statement&gt;)
 

Rainther

I guess I should write something of value here...
Reaction score
61
Of course, but if I'm creating a dummy for instance I want to do more then returning a value. I want to create unit, etc.

And is there any efficient way to search and find where I use elseif and return?
 

Chocobo

White-Flower
Reaction score
409
Of course, but if I'm creating a dummy for instance I want to do more then returning a value. I want to create unit, etc.

And is there any efficient way to search and find where I use elseif and return?

search for : "elseif return" and fix them one by one until you find no more of them


JASS:
function blabla takes nothing returns boolean
    if &lt;blabla&gt; then
        return false //ok
    elseif &lt;blabla&gt; then
        return false //NOT ok
    elseif &lt;blabla then
        call PolledWait(2.0) //ok
    endif
    return true
endfunction
 

Rainther

I guess I should write something of value here...
Reaction score
61
NVM, these 2 seems to have been triffling with my map.

This is taken from TimerUtils:
JASS:
    function ReleaseTimer takes timer t returns nothing
        if(t==null) then
            debug call BJDebugMsg(&quot;Warning: attempt to release a null timer&quot;)
            return
        endif
        if (tN==8191) then
            debug call BJDebugMsg(&quot;Warning: Timer stack is full, destroying timer!!&quot;)

            //stack is full, the map already has much more troubles than the chance of bug
            call DestroyTimer(t)
        else
            call PauseTimer(t)
            if(GetTimerData(t)==HELD) then
                debug call BJDebugMsg(&quot;Warning: ReleaseTimer: Double free!&quot;)
                return //I&#039;m talking about this thingie here
            endif
            call SetTimerData(t,HELD)
            set tT[tN]=t
            set tN=tN+1
        endif    
    endfunction

Does this mess anything up?
And while at it:
JASS:
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    return null
endfunction
Does this count as the return bug?
 
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