• 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.

Map Adapter

Level 19
Joined
Jan 1, 2018
Messages
738
Have you ever wanted to play a map but couldn't, because it was made with Reforged's World Editor?

Well today is your lucky day, because now you can make those maps compatible with patch 1.31 (1.30, 1.29, and 1.28 also supported, or any patch for which you have the game files since v1.0.0), using my new tool. I have worked on this some time ago, and recently got the motivation to make a user interface for it, so that other people can use it as well. There aren't a lot of buttons so I'm assuming I don't need to write a guide for how to use this tool, but if you have any questions feel free to ask them.

The map script (war3map.j or war3map.lua) usually needs some adjustments to be compatible with 1.31. Unfortunately, these cannot be automated at the moment, so you need to make the changes manually. To help you with that, here's a list of some common adjustments you may need to make:
  • BlzCreateUnitWithSkin, BlzCreateItemWithSkin, etc: Replace with CreateUnit, CreateItem, etc, and remove the last argument. This last argument is for the skinId, and is usually the same as the item/unit/object id, so there's no harm in removing it. Another solution (useful if these natives are used a lot of times) is to insert the following functions after endglobals:
JASS:
function BlzCreateItemWithSkin takes integer itemid, real x, real y, integer skinId returns item
    return CreateItem(itemid, x, y)
endfunction

function BlzCreateUnitWithSkin takes player id, integer unitid, real x, real y, real face, integer skinId returns unit
    return CreateUnit(id, unitid, x, y, face)
endfunction

function BlzCreateDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable
    return CreateDestructable(objectid, x, y, face, scale, variation)
endfunction

function BlzCreateDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable
    return CreateDestructableZ(objectid, x, y, z, face, scale, variation)
endfunction

function BlzCreateDeadDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable
    return CreateDeadDestructable(objectid, x, y, face, scale, variation)
endfunction

function BlzCreateDeadDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable
    return CreateDeadDestructableZ(objectid, x, y, z, face, scale, variation)
endfunction
  • BlzGetEventIsAttack: This is used in newer versions of Damage Engine. According to the description there, you can add the following to make it work:
    JASS:
    function BlzGetEventIsAttack takes nothing returns boolean
       return BlzGetEventDamageType() == DAMAGE_TYPE_NORMAL
    endfunction
  • Audio files with .flac extension: Replace the file extension with .wav (this assumes the .flac file is not imported. if it is, this will not work).
Note that lua maps cannot be adapted for patches below 1.31

This project is open source, you can find it here.
To run it, you need to have .NET Desktop runtime 6.0.x installed: Download .NET 6.0 Runtime

This tool requires an appsettings.json file, which stores the location of the game files required to adapt files.
As of v1.3.0, if this file is not found, a new window will show on startup where you can select the directory containing the game files and the patch to which those files belong.
The directory must at least contain the following files in order for the tool to work correctly: War3App/PathConstants.cs at master · Drake53/War3App
For example, if you have the triggerdata.txt file at "C:\Users\User\Documents\Warcraft III files\war3.w3mod\ui\triggerdata.txt", you must set the directory to "C:\Users\User\Documents\Warcraft III files\war3.w3mod".
-> To obtain these files, you must extract the game files using a tool, for example:
 

Attachments

  • Map Adapter v1.1.6.zip
    1.3 MB · Views: 894
  • Map Adapter v1.3.1.zip
    982.2 KB · Views: 133
  • Map Adapter v1.3.2.zip
    985.1 KB · Views: 66
Last edited:
Level 25
Joined
Jul 26, 2008
Messages
1,403
Just out of curiosity, will this tool work for future patches of Reforged? I mean, no-one knows what new features they will bring, but if they change the format of maps or w/e, will this tool still work?

And this tool only works for maps saved with the 1.32+ editor but not ones that actually use functions of 1.32?

Cool project.

Edit: And does this work for just single maps, or campaigns also, if I may ask.
 
Level 19
Joined
Jan 1, 2018
Messages
738
Just out of curiosity, will this tool work for future patches of Reforged? I mean, no-one knows what new features they will bring, but if they change the format of maps or w/e, will this tool still work?
The tool will requires updates if new things get added in future patches. For example recently the file format for war3map.w3s was changed again. Without an update, the tool will show a parse error for that file, and it can no longer adapt the file, because it does not know how to handle the new data. The list of natives (from common.j) also needs to be updated.

And this tool only works for maps saved with the 1.32+ editor but not ones that actually use functions of 1.32?
Yes, there's no way to use the new natives in older patches, so the only solution is to replace or remove them.

Edit: And does this work for just single maps, or campaigns also, if I may ask.
Campaigns are supported as well.
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
So, there's a bunch of stuff in here. What do the colours mean?
anima.png

After Adapt All:
anima.png

Also, does it automatically overwrite/save the opened map/campaign after adapting all?



Now what do I do, remove the yellow stuff and save?
anima.png
Can't see the map in 1.31.1 after I removed that. I guess it uses new natives that the .j file is incompatible?
 
Last edited:
Level 19
Joined
Jan 1, 2018
Messages
738
So, there's a bunch of stuff in here. What do the colours mean?
The colour corresponds to the status, descriptions are here: Drake53/War3App

Also, does it automatically overwrite/save the opened map/campaign after adapting all?
The opened archive is only read, not written to.

Now what do I do, remove the yellow stuff and save?
Can't see the map in 1.31.1 after I removed that. I guess it uses new natives that the .j file is incompatible?
The 'Incompatible' files can be edited manually by double clicking them (or pressing enter when it's selected).
This opens a new screen where you can edit the file, and on the left it will also have a list of incompatibilities that you can click on to find them in the text.
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
The 'Incompatible' files can be edited manually by double clicking them (or pressing enter when it's selected).
Ah, so that's where I should do
BlzCreateUnitWithSkin, BlzCreateItemWithSkin, etc: Replace with CreateUnit, CreateItem, etc, and remove the last argument. This last argument is for the skinId, and is usually the same as the item/unit/object id, so there's no harm in removing it.
that stuff?
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
Exactly. After clicking the OK button in that screen the status changes to 'Modified', so you can adapt it again to confirm it's now compatible.
Holy Molly of Jass
anima.png


EDIT:
  • BlzCreateUnitWithSkin, BlzCreateItemWithSkin, etc: Replace with CreateUnit, CreateItem, etc, and remove the last argument. This last argument is for the skinId, and is usually the same as the item/unit/object id, so there's no harm in removing it.

  • Audio files with .flac extension: Replace the file extension with .wav (this assumes the .flac file is not imported. if it is, this will not work).
Hey, can you do something to automate this?
I mean, it's ok when you do it for 30 or so lines but for 300+? :|

From what I'm seeing BlzCreateUnitWithSkin is found in the highest number in most maps.



How should I rename these?
BlzGetFrameByName
BlzStartUnitAbilityCooldown

To
GetFrameByName and StartUnitAbilityCooldown?

So, I've adapted this: Diverse Fights v0.8.2 (Reforged) and I can't see it in 1.31.1 (attached adapted version).

On another map I found: CreateMinimapIconAtLocBJ
 

Attachments

  • DF v0.8.2 Reforged_Protected1311.w3x
    1.4 MB · Views: 147
Last edited:
Level 19
Joined
Jan 1, 2018
Messages
738
Hey, can you do something to automate this?
I mean, it's ok when you do it for 30 or so lines but for 300+? :|

From what I'm seeing BlzCreateUnitWithSkin is found in the highest number in most maps.
Should be possible to automate some things, but most natives cannot simply be replaced, and it's not easy to implement (would need to do it for both jass and lua too, so that takes even more time). Basically, it's at the bottom of my priority list so don't expect this to get added anytime soon.
In the case of BlzCreateUnitWithSkin being used hundreds of time, in that case it's faster to use the solution I wrote in my post here: Mini Mapping Contest #16 - Poll
Note that this solution will yield false positives, but you can still save the map.

How should I rename these?
BlzGetFrameByName
BlzStartUnitAbilityCooldown
BlzGetFrameByName is a different type of incompatibility detection. It's available in 1.31, but there's only a certain number of valid strings for the 'name' parameter.
Here's the list: Default Names for BlzGetFrameByName
As you can see, there were some names added in 1.32 that you cannot use in 1.31

The other one I don't know, you'd probably need to use some workaround to get similar behaviour in 1.31

So, I've adapted this: Diverse Fights v0.8.2 (Reforged) and I can't see it in 1.31.1 (attached adapted version).
I'll try adapting it myself later and see if I can get it working.
EDIT: If I had to guess and assume you did everything correctly, it may be due to false negatives in the map script (the list of natives added since 1.32 is outdated).

On another map I found: CreateMinimapIconAtLocBJ
Can't do anything like that in 1.31, so you'll have to delete it.
 
Last edited:

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
Level 19
Joined
Jan 1, 2018
Messages
738
Aw, I'm too stupid to understand custom script or what you did there exactly.
It's simple really, you just scroll down until the end of the globals (after endglobals) and then you paste the code there.

Also, I have uploaded a new version. It has some bugfixes for campaigns, updated natives list, and you can now also adapt maps for 1.29 using the combobox.
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
It's simple really, you just scroll down until the end of the globals (after
endglobals
) and then you paste the code there.

Also, I have uploaded a new version. It has some bugfixes for campaigns, updated natives list, and you can now also adapt maps for 1.29 using the combobox.
Should document this in the main post.
Also, can you do a CTRL+F search(box)?
Not sure where to find endglobals. Finding endfunction stuff.
OK found endglobals upon scrolling like crazy.

Not sure I did it right though:
adapt.png
 
Last edited:
Level 19
Joined
Jan 1, 2018
Messages
738
But then it won't show those fields as adapted?
That doesn't matter, like I said it causes false positives.
Even if the status is modified or incompatible, it will still save the file with the changes you made.

Also, changelog for new version: Added new column for file type, added 'edit' button to context menu (right-click), and in the text edit window, there is now a searchbox+button.
Obviously not much effort put into the searchbox (5 minutes work), because if you need to make bigger changes than simply handling the incompatibilities listed on the left, you might as well copypaste everything into notepad++ and work on it there, then copy it back.
 
Level 19
Joined
Jan 1, 2018
Messages
738
There was only one model that I had to remove. Didn't get any reports on skins.
Or wait, are there also false negatives?
The model does not have to be deleted for the map to show up.
There shouldn't be false negatives for identifiers. What I mean about the skinId is when you replace BlzCreateUnitWithSkin with CreateUnit, you need to remove the last parameter. If you only change the name, you pass 6 parameters to CreateUnit, but it only takes 5.

The reason for it not showing up may be the filename now that I think about it. If you mess up the map script, it should still show up, but give an error. But if the filename has no extension, it won't show up.
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
There shouldn't be false negatives for identifiers. What I mean about the skinId is when you replace BlzCreateUnitWithSkin with CreateUnit, you need to remove the last parameter. If you only change the name, you pass 6 parameters to CreateUnit, but it only takes 5.
I'm not sure what those parameters exactly are.

err.png
err2.png
 
Level 19
Joined
Jan 1, 2018
Messages
738
I'm not sure what those parameters exactly are.

Did you open the adapted map again instead of the unchanged? In that case, the program detects the map was made for 1.31, so it won't allow you to target that patch, and automatically selects the only other available option 1.29. Should probably remove that functionality.
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
Did you open the adapted map again instead of the unchanged? In that case, the program detects the map was made for 1.31, so it won't allow you to target that patch, and automatically selects the only other available option 1.29. Should probably remove that functionality.
No, I just opened the original version. Now it shows only createunit stuff after closing and reopening the program.
 
Last edited:
Level 19
Joined
Jan 1, 2018
Messages
738
No, I just opened the original version. Now it shows only createunit stuff after closing and reopening the program.

EDIT:
tell me what I'm doing wrong (video).
What I said earlier was incorrect, when the status is 'incompatible' it won't save changes, only if you leave it at 'modified'.
I fixed that now so it will always save changes you make. Also fixed the bug about removing maps and map files inside a campaign.
EDIT: Didn't watch the whole video at first, but I noticed you were doing alot of editing stuff after copypasting the Blz methods after endglobals. You shouldn't do that, just copypaste it in and you're done.
 
Level 19
Joined
Jan 1, 2018
Messages
738

Same.
So I'm adapting for 1.31.1, not 1.29 if that helps with anything.
Difference in 1.29 and 1.31 is the changes it makes to war3map.w3i, and it adds a .w3x header in 1.29.
With 1.29 there are also more incompatible natives used in the map script.

Anyways, here's the file when I adapt it for 1.31, tested and 'works on my machine'™. If this doesn't show up for you I really don't know what's wrong, but at least shouldn't be an issue with my program.
 

Attachments

  • ulf for 131.w3x
    1,005.3 KB · Views: 114

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
It explains why it works differently, but it does not explain why it won't show up in 1.31.1 non-PTR.
Gonna ask somebody to see if the issue is present for that person as well.

EDIT: someone tried and he also couldn't see the map in the game.
He eventually got into it via the editor but I couldn't (video). He pressed Yes 10 times. For me it just minimizes the game. Even No doesn't do anything different.

To make it work I saved it with the 1.31.1 editor and then I could also see it in the game.
 

Attachments

  • 2020-08-12 01-01-02.mp4
    20.8 MB · Views: 192
Last edited:
Level 19
Joined
Jan 1, 2018
Messages
738
Gonna ask somebody to see if the issue is present for that person as well.

EDIT: someone tried and he also couldn't see the map in the game.
He eventually got into it via the editor but I couldn't (video). He pressed Yes 10 times. For me it just minimizes the game. Even No doesn't do anything different.

To make it work I saved it with the 1.31.1 editor and then I could also see it in the game.
I'll fix the 'saved in newer version' warning in the next version.

Also did some thinking, maybe the cause is the (attributes) file? Can you try removing it and see if it shows up? Also this might be the fix for the campaign in the other thread as well, so can you try removing this file instead of removing the war3map.wts file?
 

deepstrasz

Map Reviewer
Level 73
Joined
Jun 4, 2009
Messages
19,676
Also did some thinking, maybe the cause is the (attributes) file? Can you try removing it and see if it shows up?
anima.png
Still can't see it.
Also this might be the fix for the campaign in the other thread as well, so can you try removing this file instead of removing the war3map.wts file?
Seems to work after removing all (attribute) files.
 
Level 19
Joined
Jan 1, 2018
Messages
738
When I remove the attributes file from the version I uploaded earlier, there remain only three differences:
My version has no .w3x header, has a difference of 512 bytes in archive size (due to missing w3x header), and the data offset is also different.
The last one is a bit weird though, in your version its value is [32, 254, 255, 255], while I would expect it to be [32, 0, 0, 0] like in mine.
The individual files in both archives are exactly the same, so I will enable the .w3x header for 1.31 (not only when targeting 1.29) and then it should work.
 
Level 19
Joined
Jan 1, 2018
Messages
738
You might want to have these Mini Mapping Contest #16 - Poll written in the main post to keep things organized, not link to them.
Done. Also uploaded new version, changelog:
  • The file (attributes) is now always removed.
  • Map and campaign .w3i/.w3f files' editorversion and gameversion fields now get changed based on target patch.
  • Version is now shown in window title (v0.5.0 currently).
  • Archives are now always saved with .w3x header.
  • Save button is always enabled when you open an archive, not only after you make changes.

@deepstrasz Can you try adapting the map again and see if it works now? And if it still won't show up, re-save it in the world editor again and upload it, so I can compare the files.
 
Top