1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Map Adapter

Discussion in 'Warcraft Editing Tools' started by Drake53, Aug 9, 2020.

  1. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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, 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
      :
    Code (vJASS):
    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:
      Code (vJASS):
      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).
    This project is open source, you can find it here.
    To run it, you need to have .NET Core Desktop runtime 3.1.x installed: Download .NET Core 3.1 Runtime
     

    Attached Files:

    Last edited: Oct 23, 2020 at 11:30 PM
  2. tulee

    tulee

    Joined:
    Jul 26, 2008
    Messages:
    1,134
    Resources:
    8
    Maps:
    8
    Resources:
    8
    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.
     
  3. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.

    Yes, there's no way to use the new natives in older patches, so the only solution is to replace or remove them.

    Campaigns are supported as well.
     
  4. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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: Aug 9, 2020
  5. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    The colour corresponds to the status, descriptions are here: Drake53/War3App

    The opened archive is only read, not written to.

    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.
     
  6. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Ah, so that's where I should do
    that stuff?
     
  7. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.
     
  8. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Holy Molly of Jass
    anima.png



    EDIT:
    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
     

    Attached Files:

    Last edited: Aug 10, 2020
  9. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.

    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

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

    Can't do anything like that in 1.31, so you'll have to delete it.
     
    Last edited: Aug 10, 2020
  10. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Aw, I'm too stupid to understand custom script or what you did there exactly.
    I guess I'll just delete stuff like
     
  11. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.
     
  12. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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: Aug 10, 2020
  13. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    Done.

    Should be easy to add, I'll do it tomorrow.

    That should work.
     
  14. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    But then it won't show those fields as adapted?
     
  15. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.
     
  16. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Tried adapting this one and I can't see it in 1.31.1 for some reason.
    Only 7 createunit fields I had to edit.
     

    Attached Files:

  17. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    Maybe you forgot to remove the skinId parameters? I tried to adapt the map and it works fine.
     
  18. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    There was only one model that I had to remove. Didn't get any reports on skins.
    Or wait, are there also false negatives?
     
  19. Drake53

    Drake53

    Joined:
    Jan 1, 2018
    Messages:
    421
    Resources:
    0
    Resources:
    0
    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.
     
  20. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,303
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm not sure what those parameters exactly are.

    err.png err2.png