HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

spell causing wc3 to not load map?

08-06-2009, 05:10 AM#1
Drake
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 general locaiton of whats causing it to not load... and ive found a single spell that definatly causes it to not load (there are others, but there disabled for now)
so i disabled the trigger, the map loads fine, and then when i re-enable the trigger, the map doesnt load (like im using the bug)... now im not using *anything* fancy, just a basic unit casts spell. do simple effects... 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)

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

Hidden information:
Collapse 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



EDIT: ok so now im confused.... its working now... for no aparent reason... i didnt change *anything*
EDIT2: also, just so i know, what are the rules for bumping a post?
EDIT3: do i need a newer version of newgen or someting?

EDIT4: 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.
08-06-2009, 06:02 AM#2
Sophismata
Please

Collapse vJASS:
scope Nemesis

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A06C'
endfunction

private function 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

public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
    // optional: set trig = null
endfunction

endscope

08-06-2009, 06:06 AM#3
Drake
so what does that do?

edit: other than putting it in a scope... does that really help me any?
08-06-2009, 07:09 AM#4
Sophismata
Specifically, no, but I was under the impression you'd gotten things working.

It is, however, something you should start doing, because it lets you do things that will help you.
08-06-2009, 05:32 PM#5
Drake
right. point taken... however. i dont think ive ever gotten the reason why scopes are so useful... mind explaining it to me? :D

also, again, for some unknown reason, another spell is bugging on me... i have a feeling its newgen, cause when i put the trigger into vanilla wc3 editor, it compiles and loads fine.
08-06-2009, 06:42 PM#6
Anitarf
Quote:
Originally Posted by Drake
also, again, for some unknown reason, another spell is bugging on me... i have a feeling its newgen, cause when i put the trigger into vanilla wc3 editor, it compiles and loads fine.
Posting the trigger might help.
08-06-2009, 06:57 PM#7
Drake
kk, theres 4 XD
and i have no idea why they're causing the map to not load

Hidden information:
Collapse 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

Collapse 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


Collapse 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


Collapse 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

08-06-2009, 08:53 PM#8
Anitarf
Try replacing the blade_filter function with this:
Collapse JASS:
function blade_filter takes nothing returns boolean
    local boolean b = true
    if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
        set b = false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
        set b = false
    elseif IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) then
        set b = false
    endif
    return b
endfunction
Same goes for the shrouding_filter function.
08-06-2009, 08:57 PM#9
Drake
ive tried that, and it still bugs...

however it might have been some other random trigger, and il try it again

EDIT: ok wierd, i guess it must have been something else randomly not working, cause it works now

still doesnt explain how the other triggers bug
08-07-2009, 01:10 AM#10
Joker
Ani's post is a workaround for blizzards lame return bug check.