• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Transferring object and trigger data to other maps

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2013
Messages
116
I've searched all over with no success. I need your help.
I'm interested in a way I could make model/object/trigger data and copy it to other maps.

Some time ago, I found a mod that used an installer where I could select a map, and then the installer would add another playable race to it.
And since I like doing stuff like that, adding new units, upgrades, and even races, I'd like my 'game mode' be available on more than one map.

What would be the fastest way of transferring all that data to all maps in the game?
 
Level 5
Joined
Jun 21, 2013
Messages
116
Are there any modding programs that allow me to automate the process?
Because if there are 100 maps, that could be annoying to update on all maps.

Or, alternatively, could I edit the warcraft files to include my custom data by default, so I edit them on just one place, instead on each map?
 
Level 5
Joined
Jun 21, 2013
Messages
116
^ You can use the campaign editor for units, abilities, and doodads and the new data will be available in all maps in the campaign, but I don't know how well that works for triggers and custom spells.
Yea, but I'm trying to do that on normal maps, not trying to make a campaign.

Basically, I'm trying to make a system that would add more races and add more to 4 existing ones and apply it to all maps in warcraft folder.
The problem is updating it, since if I want to add something later on, I'd have to go through whole process again.

Similar thing in the trigger editor. You will probably have to update rawcodes after doing so.
What exactly do you mean "update rawcodes"? Should I go through every trigger and checks if they reference correct unit/ability type?
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
Back in the day a custom MPQ would have been what you wanted to achieve that, though it still would have required importing triggers. We have CASCs instead of MPQs now so I'm not sure if you can even add stuff to them any more. Someone with more knowledge could help better than I.

Yes that's what I meant about rawcodes. It's also possible ability lists/techtree requirements/units trained/units sold/buildings constructed/items sold and anything else similar can have errors too in the following scenario: An imported object A references another imported object B. Object B has the same rawcode as an existing object C in the map (that was not imported), so when B is imported it is given a new rawcode. Object A may incorrectly reference C when it should be B. If you import all object data at once (rather than each type in sequence) I believe you won't have this issue because the editor knows it just changed the rawcode of Object B and acts accordingly... but I'm not too familiar.
 
Level 5
Joined
Jun 21, 2013
Messages
116
Back in the day a custom MPQ would have been what you wanted to achieve that, though it still would have required importing triggers. We have CASCs instead of MPQs now so I'm not sure if you can even add stuff to them any more. Someone with more knowledge could help better than I.

Yes that's what I meant about rawcodes. It's also possible ability lists/techtree requirements/units trained/units sold/buildings constructed/items sold and anything else similar can have errors too in the following scenario: An imported object A references another imported object B. Object B has the same rawcode as an existing object C in the map (that was not imported), so when B is imported it is given a new rawcode. Object A may incorrectly reference C when it should be B. If you import all object data at once (rather than each type in sequence) I believe you won't have this issue because the editor knows it just changed the rawcode of Object B and acts accordingly... but I'm not too familiar.
Damn...
But wait, if I find an old version of warcraft, with MPQs, is there a good tutorial that shows what to do?
Since I really want to avoid transferring everything manually to many maps.
 
If your goal is a melee mod. There are multiple ways to do that. Even in 1.31.1. The simplest is probably the one Retera showed in some of his youtube videos. One starts World Editor adds/changes the object Editor stuff and export each section for it own with the name "war3map", each gains a unique extension but the editor should handle that. This files are placed into your warcraft 3 folder. When they are in your folder and read (it is only read by maps not having such files by themself), will use this custom object Editor files. When you want to play multiplayer the other players also need the same files. Otherwise you fastly get kicked from their Lobby.

Jump to 18:00 for the Object Editor explanition. Although this war3mod.mpq folder does not work anymore. In 1.31 one could use Allow Local Files = 1 in regedit and place that files just into the warcraft 3 folder.
In 1.29 to 1.30 had a folder name war3mod.mpq which were a good place for that, but in 1.31 you can only use Allow Local Files. Both do not work in the current Reforge Beta (State Custom Map Release). When you got that working the object Editor part is done. I suggest to do a first test, something simple like giving workers more life or speed which can be seen in a second just by starting a melee map.

If you also need custom triggers that is a bit more compilcated. That can be done over Blizzard.j. One gets a copy of Blizzard.j and places it into "scripts/Blizzard.j" inside the warcraft 3 folder. Also adds your code into that jass file in jass format.
The quli is not that that good


Instead of giving map custom data one also could replace the default unit data. That requires you to overlap the slk-files containing them and will affect alot more than only melee maps. With that slk files you also could change the data the editor sees as default.

It's unsure how well reforge will handle all that.
 
Last edited:
Level 18
Joined
Jan 1, 2018
Messages
728
I made a small commandline application that can batch import files for you. I only tested it with war3mapPreview.tga so I don't know if it will work correctly when you try to overwrite a file that already exists (I think it should add both, but it should use the new one).

It takes three arguments: the first is a folder containing your input maps, the second is the output directory, and the third is either a single file, or a folder containing files, that will be imported to all maps.

Also I'll put the source code here 'cuz I'm not gonna upload something as tiny as this to gihub but I want it to be open source anyways. It uses my MPQ library:
C#:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

using War3Net.IO.Mpq;

namespace BatchImportMpq
{
    internal class Program
    {
        private static void Main( string[] args )
        {
            if (args.Length != 3)
            {
                throw new ArgumentException( $"Expect 3 arguments, but got {args.Length} instead." );
            }

            var inputDirectory = new DirectoryInfo(args[0]);
            var outputDirectory = new DirectoryInfo(args[1]);
            var import = args[2];

            var importFiles = new List<string>();

            if (!inputDirectory .Exists)
            {
                throw new DirectoryNotFoundException($"Could not find input directory: {inputDirectory.FullName}");
            }

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            if (File.Exists(import))
            {
                importFiles.Add( import );
            }
            else if (Directory.Exists(import))
            {
                importFiles.AddRange( Directory.EnumerateFiles( import, "*", SearchOption.TopDirectoryOnly ) );
            }
            else
            {
                throw new DirectoryNotFoundException( $"Could not find file/directory for files to import: {import}" );
            }

            var importFileNames = importFiles.Select(file => new FileInfo(file).Name).ToHashSet();
            var importMpqFiles = importFiles.Select(file => MpqFile.New(File.OpenRead(file), new FileInfo(file).Name));

            foreach (var inputMapPath in inputDirectory.EnumerateFiles())
            {
                var outputMapPath = Path.Combine(outputDirectory.FullName, inputMapPath.Name);

                var inputMap = MpqArchive.Open(inputMapPath.FullName);

                MpqArchive.Create( outputMapPath, importMpqFiles.Concat( inputMap.GetMpqFiles() ).ToArray() );
            }
        }
    }
}
 

Attachments

  • BatchImportMpq.zip
    329.3 KB · Views: 101
Level 5
Joined
Jun 21, 2013
Messages
116
If your goal is a melee mod. There are multiple ways to do that. Even in 1.31.1. The simplest is probably the one Retera showed in some of his youtube videos. One starts World Editor adds/changes the object Editor stuff and export each section for it own with the name "war3map", each gains a unique extension but the editor should handle that. This files are placed into your warcraft 3 folder. When they are in your folder and read (it is only read by maps not having such files by themself), will use this custom object Editor files. When you want to play multiplayer the other players also need the same files. Otherwise you fastly get kicked from their Lobby.

Jump to 18:00 for the Object Editor explanition. Although this war3mod.mpq folder does not work anymore. In 1.31 one could use Allow Local Files = 1 in regedit and place that files just into the warcraft 3 folder.
In 1.29 to 1.30 had a folder name war3mod.mpq which were a good place for that, but in 1.31 you can only use Allow Local Files. Both do not work in the current Reforge Beta (State Custom Map Release). When you got that working the object Editor part is done. I suggest a to first test something simple like giving workers more life or speed.

If you also need custom triggers that is a bit more compilcated. That can be done over Blizzard.j. One gets a copy of Blizzard.j and places it into "scripts/Blizzard.j" inside the warcraft 3 folder. Also adds your code into that jass file in jass format.
The quli is not that that good


Instead of giving map custom data one also could replace the default unit data. That requires you to overlap the slk-files containing them and will affect alot more than only melee maps. With that slk files you also could change the data the editor sees as default.

It's unsure how well reforge will handle all that.

Wow, thanks for your detailed answer.
So if I were to, say, have an old warcraft 3 version 1.29., I could make all of the things from the videos?

Also, about the triggers, could there be a problem that was mentioned by Pyrogasm earlier, about triggers not using correct rawcodes, or would that be ok?
 
So if I were to, say, have an old warcraft 3 version 1.29., I could make all of the things from the videos?
Yes.

Also, about the triggers, could there be a problem that was mentioned by Pyrogasm earlier, about triggers not using correct rawcodes, or would that be ok?
Only if you merge/combine data from multiple sources. If all is from one map/source that can't happen.
 
Can you tell me where you placed your files and how they are named.

Did you place the files into the folder war3mod.mpq inside warcraft 3 or directly into the warcraft 3 folder?

When you place them into the warcraft 3 folder you need the DWord Allow Local Files in regedit.
Computer\HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III
 
Last edited:
Level 5
Joined
Jun 21, 2013
Messages
116
Can you tell me where you placed your files and how they are named.

Did you place the files into the folder war3mod.mpq inside warcraft 3 or directly into the warcraft 3 folder?

When you place them into the warcraft 3 folder you need the DWord Allow Local Files in regedit.
Computer\HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III
It's in warcraft 3 folder, like in the video.
But yeah, didn't do the registry part, from your post I figured it's additional step for 1.31.
Will try that when I get home.
 
Level 5
Joined
Jun 21, 2013
Messages
116
If you plan to make these maps playable in bnet then this isn't a viable solution, Drake53 already posted probably the best solution for this problem, but you chose to ignore it.
Oh, no, I'm gonna do that if there's no other way. Was hoping for a more elegant way, though.
 
Status
Not open for further replies.
Top