wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > -- Submit A Tutorial --
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-07-2009, 01:45 PM   #1
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default Finding out why your map doesn't work with patch 1.24

I explained this in the other thread, but rather quickly. This will help you find out the functions that make warcraft III unable to play your map, without doing any brute force, there is one exception though, and it is that World editor sometimes crashes. If one of the functions in your map causes this crash, then you are doomed to brute force. The good thing is that this seem to be the exception rather than the rule.

Requirements
* First of all, you need to be able to run World Editor.
* Then you need patch's 1.24's blizzard.j . Because for some reason it is not obvious to some people how to get it, I am attaching a zip file that includes that file.
* Finally, you need your map's war3map.j , there are many ways to get it, but I'll explain one that requires newgen pack. If you don't want to use newgen pack, then you'll have to use a MPQ editor to extract war3map.j from your map.

Getting the map's script
* Open your map in newgen pack, save the map. Make sure jasshelper doesn't give you any errors. If it does, fix them...
* Go to your newgen pack's folder, then to the logs\ subfolder. You will find a file called outputwar3map.j in there, open it with a text editor.

Merging the map script with blizzard.j
This could be done with a tool, I think jasshelper can do it, but well, it is easy to do it manually...

Make a copy of blizzard.j then open it and outputwar3map.j in a text editor, the merge process is easy, you'll find your map's script has a lot of globals inside a single globals block:

Collapse JASS:
globals
  ..  tons of stuff ! ..
endglobals

Select all the contents of this globals block, and Copy it to the clipboard. Then go to the blizzard.j copy, you will find a globals block in it as well. Find the bottom of blizzard.j's globals, and paste your map's globals just before endglobals
Collapse JASS:
    boolexpr           filterMeleeTrainedUnitIsHeroBJ    = null
    boolexpr           filterLivingPlayerUnitsOfTypeId   = null

    // Memory cleanup vars
    boolean            bj_wantDestroyGroup         = false

  ... tons of stuff from outputwar3map.j

endglobals


Finally, go to your outputwar3map.j, and go bellow the endglobals keyword, select all the contents bellow it (a lot of functions) copy it to the clipboard, head to the blizzard.j copy and then go to the end of the file. Paste your map's functions there.

Save the blizzard.j copy as "your\warcraft III folder\scripts\blizzard.j"

Getting the errors
Now open NORMAL World editor, create an empty map, and save the map.

* If WE crashes, you are doomed, stick to bruteforce.

* If the map is saved and no errors are shown, you didn't follow this tutorial correctly.

* If WE shows you an error that says "Expected a name" and the error line says something like "function InitGlobals" then either your map's issues are not caused by Jass but by something else (unlikely) or you didn't follow this tutorial correctly.

* If WE shows you an error that says "Unexpected type" or something like that with the word "type" in it. And the error line shown in the code preview is the beginning of the map's script, while the actual line number in the error is very high, then congratulations! You can find out what's your problem.

Find the problems
Notice the high line number ( Line XXX: blah blah blah, get the XXX) then go to the blizzard.j copy at the scripts folder, and go to line XXX, this line will be inside a function. Something like:

Collapse JASS:
function a takes boolean b returns something
   blah blah blah

    return onething
  blah blah blah
    return maybemorereturns

 return otherthing
endif

Copy the contents of this function to some new text file, then remove all the returns but the last one (in scripts\blizzard.j) save scripts\blizzard.j and then save the empty map again.

If WE tells you "expected a name" and the line in the code preview says "function InitGlobals" then you have found all the problems in your map, if it again tells you something about a bad type, and a high line number, you have to repeat this step.

Fix the problems
If you did everything correctly and your computer contributed to the process, now you have a file containing all the functions that cause problems in your map. Now you have to find out what system/trigger/whatever is generating them, and then go and fix the function in the system/trigger/whatever. If the /whatever was made by someone else and you can't understand the code, request this someone else to fix it for you (maybe he actually has already updated it for 1.24). If the function is yours, you'll have to fix it. It is easy, just modify the function so that there is only one return stament, use variables and modify the structure of the function. If you have no idea where the function comes from, then you have a problem. Go to the problems section.



Problems
If your map crashes or you have no idea where one of the bugged functions comes from, you can actually post your map + outputwar3map.j in a zip in the pastebin and send me the link. There are some conditions:
* The map should have used vJass or a system/spell made by me, if not then you can go to heck, I won't spend my time on helping you...
* You should have tried this tutorial, if the map doesn't crash then I hope you provide me the text file containing the bugged functions, else the map MUST crash...
Attached Files
File Type: zip blizzard.j.zip (59.2 KB, 158 views)
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-07-2009, 08:35 PM   #2
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

I just did this. It tells me the error lies in line 2649

Checking it, it shows me the goddamn following blizzard.j comment block
Collapse JASS:
//***************************************************************************
//*
//*  Environment Utility Functions//this be the goddamn line 2649
//*
//***************************************************************************

__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.

Last edited by Alevice : 08-07-2009 at 08:36 PM.
Alevice is offline   Reply With Quote
Old 08-07-2009, 09:46 PM   #3
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

2649 is very low.

Post a screenshot of the error dialog.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-07-2009, 10:19 PM   #4
Anopob
Yay!
 
Anopob's Avatar
 
Join Date: May 2006
Posts: 870

Anopob has a spectacular aura about (120)

Default

This works! Thanks a lot!
__________________
Give +REP to people who help you with things or make good resources.
Better Ways of Requesting For Help - Race Contest #2 WIP Thread (Bone Race)
As of December 1st I have my blue rep. Yay :D
Anopob is offline   Reply With Quote
Old 08-08-2009, 04:15 AM   #5
watterly
User
 
Join Date: Nov 2006
Posts: 26

watterly has little to show at this moment (4)

Default

Well I'll try this; but as I already told you, in the Caster System's Thread, I had already pointed 2 functions that caused returns bugs. Actually I do understand the coding, but I really don't know how to fix your system.

The first error; Line 12854, with the following message: "Invalid type for specified operator"... Open the merged blizzard.j and search for the 12854 line with Microsoft Word; gives me that function :

function s__ArbreRespawn__allocate takes nothing returns integer
local integer kthis
local integer this=si__General_F
if (this!=0) then
set si__General_F=si__General_V[this]
else
set si__General_I=si__General_I+1
set this=si__General_I
endif
if (this>8190) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Unable to allocate id for an object of type: ArbreRespawn") //Error is showed at this line.
return 0
endif

set si__General_type[this]=28
set kthis=this

set s__ArbreRespawn_arbre[this]= null
set s__ArbreRespawn_timemax[this]= 55
set s__ArbreRespawn_timedone[this]= 0
set si__General_V[this]=-1
return this
endfunction


This function is created by the vjass compiler.
watterly is offline   Reply With Quote
Old 08-08-2009, 04:36 AM   #6
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

for now, disable the debug mode. If that doesn't work, just post the contents of the struct called ArbreRespawn, I'll figure something out...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-08-2009, 04:49 AM   #7
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

Quote:
Originally Posted by Vexorian
2649 is very low.

Post a screenshot of the error dialog.
Zoom (requires log in)

Attached lies the blizzard.j file i used
Attached Images
File Type: jpg we error.jpg (484.2 KB, 463 views)
Attached Files
File Type: rar Blizzard.rar (100.4 KB, 6 views)
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 08-08-2009, 04:57 AM   #8
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Something just above those comments:

Collapse JASS:
function TriggerRegisterDestDeathInRegionEvent takes trigger trig, rect r returns event
    set bj_destInRegionDiesTrig = trig
    set bj_destInRegionDiesCount = 0
    call EnumDestructablesInRect(r, null, function RegisterDestDeathInRegionEnum)
    return trig
endfunction

Err, did you use the blizzard.j from patch 1.24 ? This one is for the books, very strange, anyway, since it is in the blizzard.j part, just replace the function with return null and continue...

edit: You didn't use the latest blizzard.j , specifically bj_lastCreatedHashtable isn't around
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-08-2009, 05:31 AM   #9
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

shit you are right. will fix that and see if it work now
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 08-08-2009, 02:25 PM   #10
watterly
User
 
Join Date: Nov 2006
Posts: 26

watterly has little to show at this moment (4)

Default

Quote:
Originally Posted by Vexorian
for now, disable the debug mode. If that doesn't work, just post the contents of the struct called ArbreRespawn, I'll figure something out...

I've saved with Debug Mode disabled; still gives me 198371283978 errors, but the first one isn't the same one and I can't find any type errors messages, (only expected end of line, expected a variable name, expected a name, expected endloop).

But if i test the real map with Debug Mode disabled, I still can't load the map.
watterly is offline   Reply With Quote
Old 08-08-2009, 03:05 PM   #11
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Well, just post the lines nearby the first error. I'll focus this afternoon to try to remove double returns from jasshelper, it will be VERY hard.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-08-2009, 05:13 PM   #12
watterly
User
 
Join Date: Nov 2006
Posts: 26

watterly has little to show at this moment (4)

Default

Collapse JASS:
function MeleeTournamentFinishNowRuleA takes integer multiplier returns nothing
    local integer array playerScore
    local integer array teamScore
    local force array   teamForce
    local integer       teamCount
    local integer       index
    local player        indexPlayer
    local integer       index2
    local player        indexPlayer2
    local integer       bestTeam
    local integer       bestScore //Error Shows Here, Line 10657 with 'Expected End of Line'
    local boolean       draw

    // Compute individual player scores
    set index = 0
    loop
        set indexPlayer = Player(index)
        if MeleeWasUserPlayer(indexPlayer) then
            set playerScore[index] = GetTournamentScore(indexPlayer)
            if playerScore[index] <= 0 then
                set playerScore[index] = 1
            endif
        else
            set playerScore[index] = 0
        endif
        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop

    // Compute team scores and team forces
    set teamCount = 0
    set index = 0
    loop
        if playerScore[index] != 0 then
            set indexPlayer = Player(index)

            set teamScore[teamCount] = 0
            set teamForce[teamCount] = CreateForce()

            set index2 = index
            loop
                if playerScore[index2] != 0 then
                    set indexPlayer2 = Player(index2)

                    if PlayersAreCoAllied(indexPlayer, indexPlayer2) then
                        set teamScore[teamCount] = teamScore[teamCount] + playerScore[index2]
                        call ForceAddPlayer(teamForce[teamCount], indexPlayer2)
                        set playerScore[index2] = 0
                    endif
                endif

                set index2 = index2 + 1
                exitwhen index2 == bj_MAX_PLAYERS
            endloop

            set teamCount = teamCount + 1
        endif

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop

    // The game is now over
    set bj_meleeGameOver = true

    // There should always be at least one team, but continue to work if not
    if teamCount != 0 then

        // Find best team score
        set bestTeam = -1
        set bestScore = -1
        set index = 0
        loop
            if teamScore[index] > bestScore then
                set bestTeam = index
                set bestScore = teamScore[index]
            endif

            set index = index + 1
            exitwhen index == teamCount
        endloop

        // Check whether the best team's score is 'multiplier' times better than
        // every other team. In the case of multiplier == 1 and exactly equal team
        // scores, the first team (which was randomly chosen by the server) will win.
        set draw = false
        set index = 0
        loop
            if index != bestTeam then
                if bestScore < (multiplier * teamScore[index]) then
                    set draw = true
                endif
            endif

            set index = index + 1
            exitwhen index == teamCount
        endloop

        if draw then
            // Give draw to all players on all teams
            set index = 0
            loop
                call ForForce(teamForce[index], function MeleeDoDrawEnum)

                set index = index + 1
                exitwhen index == teamCount
            endloop
        else
            // Give defeat to all players on teams other than the best team
            set index = 0
            loop
                if index != bestTeam then
                    call ForForce(teamForce[index], function MeleeDoDefeatEnum)
                endif

                set index = index + 1
                exitwhen index == teamCount
            endloop

            // Give victory to all players on the best team
            call ForForce(teamForce[bestTeam], function MeleeDoVictoryEnum)
        endif
    endif

endfunction
watterly is offline   Reply With Quote
Old 08-08-2009, 07:52 PM   #13
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

That's something very strange.

If for some reason it gives you errors on some blizzard.j function, replace it with an empty function and continue the process.

Just in case, does line 10657 exist in the empty map script?
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-08-2009, 09:18 PM   #14
midiway
Pro-carnivorous
 
midiway's Avatar
 
Join Date: Nov 2006
Posts: 217

Submissions (1)

midiway will become famous soon enough (43)midiway will become famous soon enough (43)

Default

I get this error whenever I reference a global array which have, in somewhere, a local with the same name:

Zoom (requires log in)
Attached Images
File Type: jpg sc1.jpg (70.6 KB, 442 views)
midiway is offline   Reply With Quote
Old 08-08-2009, 10:14 PM   #15
moonliterhythm
User
 
Join Date: Mar 2006
Posts: 71

moonliterhythm has little to show at this moment (8)

Default

thanks for the help, worked like a charm.

a few (seemingly obvious) gotchas for people who may be running into dumb issues i ran into:

- when you run the real world editor to find your errors, make sure you're using the latest world editor (aka, the patched one). a good clue to know you're using the wrong editor is the "Unregistered native function" error on top of the script.

- like in the above example, please make sure you have the correct blizzard.j file (i had to manually extract it myself since for some reason wc3c.net kept giving me the "NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft." error)

- if you know of any functions that have two return statements (even in different places), they're going to get marked as problematic. in my case, i had short cuts on loops that would return values as soon as they were found, along with a default return value if the loop fell through. it seems as though the new patch DOES NOT like this kind of coding. in the future, write jass code that typically has one return statement

- seems like the CSSafeCache is broken, so if you are using it right now, try disabling it to figure out other issues with your own map first.

good luck!
moonliterhythm is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:13 PM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services