• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Code crashing test map

Status
Not open for further replies.
Level 10
Joined
Aug 14, 2009
Messages
309
Hello Hiveworkshop,

I'm currently developing a RPG map which is quite large (over 8 MB uncompressed/optimized). It has a lot of code and a lot of imports.

Since yesterday the map went crashing whenever I tested it. The crashing message is this:

crasherror.jpg


I debugged the code and narrowed out where the problem is. It's in this part of the code:

JASS:
function Trig_Quest_Finish takes nothing returns nothing

        local timer t = GetExpiredTimer()
        local qst q = GetTimerData(t)

        if ... then
                ...
        ...

        elseif q.nr == 114 then
            call CompleteQuest(q.p, 47, 300, 150, 0)
        elseif q.nr == 115 then
            call StartQuest(q.p, 48, "Sword and Board", "Old Lady Gibson has asked you to help her out by collecting some boar hides for her. They can be found off any wild boar.", "Collect 7 boar hides ( 0 / 7 collected )", "ReplaceableTextures\\CommandButtons\\BTNRazorback.blp", gg_unit_n03F_0016, false)
        elseif q.nr == 116 then
            call UpdateQuest(q.p, 48, "Bring the prepared boar hides to Kate in Armadale City", gg_unit_n03J_0203, true)
            set QuestMessageKate[q.id] = true
        elseif q.nr == 117 then
            //call CompleteQuest(q.p, 48, 260, 340, 0)   or any other call really
                // PROBLEM ! 
        endif
        
        set QuestTextFree[q.id] = true
        if not excep then
            call ReleaseTimer(t)
            call q.destroy()
        endif
        set e = null
    endfunction

It doesn't matter if I use call CompleteQuest(...) or call AddSpecialEffect(..) or call UnitAddAbility(...) it keeps crashing, if I comment out the call there the crashing stops.
I have no idea what could be causing this crash from happening since even a "normal" like AddSpecialEffect(..) causes it.

Checked out both these lists but none of the things in it seems to be the reason.
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/list-warcraft-iii-crashes-194706/
http://www.wc3c.net/showthread.php?t=80693

Just to narrow the problem down: there is no looping, no excessive calls or anything as the code just works fine without that additional elseif statment.
Could it maybe be the 100+ elseif statements? I know it isn't a real good way to code but it should work I think.

I hope someone can help me out, I'm completely stuck at the moment.

Thanks in advance, also +rep for a solution!
 
Last edited:
Level 10
Joined
Aug 14, 2009
Messages
309
have you check the string's size ? may be to long ? (but i'm not sur that crash the map)

Of the special effect string? Isnt that long, even when I use a different call (like UnitAddAbility(...)) the map crashes.

can you post the structur ?

If you mean the q struct; here it is:

JASS:
struct qst
        integer id
        player p
        integer nr
        
        static method create takes integer nr, player p, integer id returns qst
            local qst q = qst.allocate()
            set q.nr = nr
            set q.p = p
            set q.id = id
            return q
        endmethod
        
        method onDestroy takes nothing returns nothing
            set this.id = 0
            set this.p = null
            set this.nr = 0
        endmethod
    endstruct

EDIT: I also update the first post code with the locals to have it make more sense.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
For me, elseif crashes when there are more than 116, it is a read error though, write errors are scarce and more likely of object editor. I do not need an action either nor to run the code because wc3 crashes already when trying to load it in.

You may cut out a big part in the middle (that is not run) to test it.
 
Level 10
Joined
Aug 14, 2009
Messages
309
For me, elseif crashes when there are more than 116, it is a read error though, write errors are scarce and more likely of object editor. I do not need an action either nor to run the code because wc3 crashes already when trying to load it in.

You may cut out a big part in the middle (that is not run) to test it.

Thank you so much, this was indeed the problem. Just created a new map with 116+ elseif statements and I get the same crash, so it seems there is a 116 limit for elseif statements.

Thanks again :)
 
Status
Not open for further replies.
Top