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

Help! Triggers deleted but runs on Test

Level 2
Joined
Jul 27, 2024
Messages
2
I've somehow accidentally deleted my Jass triggers and am not able to recover them nor do I have a backup, i've spent lots of time writing and researching till I came up with the code and now I have it deleted somehow.

On testing the map, the triggers work and run but i no longer can see or have access to the code.

Can someone help me to somehow recover the code? Thank you!
 
Level 6
Joined
Jan 16, 2017
Messages
110
You can try opening the map in Ladik's MPQ Editor.
Once you do, you should see a list of items that looks something like this:

1722108725338.png


The file with JASS code you should look for is named war3map.j which once you extract you can take a look at through notepad.
You're free to edit the code this way and once you're done, you can press 'Add File(s)...' to add the edited JASS file into the map.
However doing it this way might corrupt the map so make sure to keep a backup.
 
On testing the map, the triggers work and run but i no longer can see or have access to the code.
Testing the map might write over the file, or write over a backup copy. You probably don't want to do that if you have only one copy and it is in danger. Copy the map file in Windows first. Then you have multiple copies, in case the exact state when you "lost" things might be a state that you can recover from.

It might also be worth looking in "Documents/Warcraft III/JassHelper" folder. Sometimes there are automatic map backups created in that folder, but maybe not always.
 
Level 2
Joined
Jul 27, 2024
Messages
2
@Fintrik
Wow, thanks a lot!! <3
But why does it not appear in the trigger editor?? The map is unusable now as it shows error upon changing anything and saving it. Is there a way to fix this? Or I should make a new map and start all over?

@Retera
Unfortunately there is no backup for my map in JassHelper folder.
 
Last edited:
Level 6
Joined
Jan 16, 2017
Messages
110
@Fintrik
Wow, thanks a lot!! <3
But why does it not appear in the trigger editor?? The map is unusable now as it shows error upon changing anything and saving it. Is there a way to fix this? Or I should make a new map and start all over?
I'm not sure why it doesn't appear (It's likely another bug in the Reforged World Editor) but the file responsible for that should be war3map.wtg which holds all the information for GUI to display individual triggers, conditions, actions etc in the Trigger Editor. The information stored here however is non-human readable and will require a good bit of trial and error + experimenting to figure out.
If your project is relative small I'd recommend to do as you suggested and start over/import everything into a new map. However, another thing you could do is to make sure that while the trigger exists, it does nothing and see if that works.

Here's my JASS trigger I made as an example, let's pretend it's invisible in this example:

1722156166226.png


Besides that I have another trigger which is GUI:

1722156246502.png


We'll use these two triggers to see what's going on with the map
So upon extracting war3map.wtg we should see this in the Notepad:

1722156402676.png

1722157586371.png


First thing we notice is that for the GUI trigger it stores information for each individual event/condition/action and it's parameters, there's also some structure to it, however we can't understand it from a simple glance.
Another thing we notice is the lack of any information stored for our JASS trigger other than the name.
With this information we can assume that deleting actions in the GUI trigger might cause issues (Deleting the trigger from war3map.j corrupts the map, saving the map uses the information from war3map.wtg and overwrites it + Testing the map from the World Editor throws me into the menu without playing the map) and there shouldn't be any issues tinkering with the inner workings of the JASS trigger.

Next we extract and take a look at war3map.j and scroll down to our JASS trigger:

1722156835951.png


Here we can see some functions but the most interesting for us will be 'InitTrig_mytrig'
This function sets up the trigger and makes sure that it is created, has events, conditions and actions to execute
So let's comment all of that like so:
NOTE: Make sure no trigger is attempting to run this trigger through Run Trigger action!
1722157268781.png


Before:
1722157174827.png


After:
1722157426367.png
 
(It's likely another bug in the Reforged World Editor)
Right, so, another possible workaround might be to use the World Editor in the 2008 version of Frozen Throne from before the Activision merger, which was made by passionate and inspired people and which does not have bugs such as disappearing triggers that are hidden still inside the map. Then, when you save a map made on that older World Editor made by the passionate and inspired people, you can play that same map file on the Reforged client with your friends online.

But in that case, you wouldn't have these issues when developing.

Edit: I am perhaps feeling a little bit old and tired, and there is a case to be made that what I am saying is troll-ish. But I also think that what I am saying is largely true. Note that if you take my word for it, and try to do what I am describing, you would be unable to run the old Frozen Throne World Editor on your computer because Reforged World Editor modifies the registry to block the old Frozen Throne World Editor from running on the computer. But do not be fooled; the old program runs perfectly fine on a Windows 11 PC that has never launched the Reforged World Editor. So it is not a technical incompatibility between the old game and the newer Windows. It is an incompatibility between the old game and a computer modified by the Reforged. Fixing the registry is quire straightforward. Presumably the disablement is the result of an accident and not something intentional, and a former Activision employee (who helped develop Reforged) told us where it is and how to delete it. You can find more about this elsewhere on Hive.
 
Last edited:
Level 6
Joined
Jan 16, 2017
Messages
110
Right, so, another possible workaround might be to use the World Editor in the 2008 version of Frozen Throne from before the Activision merger, which was made by passionate and inspired people and which does not have bugs such as disappearing triggers that are hidden still inside the map. Then, when you save a map made on that older World Editor made by the passionate and inspired people, you can play that same map file on the Reforged client with your friends online.

But in that case, you wouldn't have these issues when developing.

Edit: I am perhaps feeling a little bit old and tired, and there is a case to be made that what I am saying is troll-ish. But I also think that what I am saying is largely true. Note that if you take my word for it, and try to do what I am describing, you would be unable to run the old Frozen Throne World Editor on your computer because Reforged World Editor modifies the registry to block the old Frozen Throne World Editor from running on the computer. But do not be fooled; the old program runs perfectly fine on a Windows 11 PC that has never launched the Reforged World Editor. So it is not a technical incompatibility between the old game and the newer Windows. It is an incompatibility between the old game and a computer modified by the Reforged. Fixing the registry is quire straightforward. Presumably the disablement is the result of an accident and not something intentional, and a former Activision employee (who helped develop Reforged) told us where it is and how to delete it. You can find more about this elsewhere on Hive.
For compatibility reasons I develop my maps on older versions of the editor like 1.26 (and occasionally 1.29 or 1.30) otherwise i'd be cutting off the majority of my players. On top of the fact that any maps made in 1.31 and above make it impossible to play in older versions of warcraft makes me primarily edit on older versions and for that reason I'm not as familiar with the Reforged World Editor and haven't had any reason to utilize most of the new natives that also came with it. So I have little experience with the issues as well, that's why I assume when there's a problem I'm not familiar with that it's something that arrived with the later versions.

I won't talk about this further since we're straying off topic.
 
Level 29
Joined
Sep 26, 2009
Messages
2,595
I'm not sure why it doesn't appear...
You should always avoid editing map's internal files via text editor, since those files are binary files - they have a predefined structure and a lot of zero bytes, which normal text editors would evaluate as 'null' symbols and not display them at all (unless you use things like Notepad++'s 'Show All symbols'). Accidentally removing more bytes than necessary would lead to file corruption.

If you want to edit those files, I recommend using a hex editor which displays each byte in the file and allows you to safely edit them.

I had a project in C# for migrating entire custom races between maps and thus I spent quite a lot of time going through those files. The *.wtg is one of the most complex files, even more so on Reforged, because Blizz added to wtg files a lot of unneeded data (probably because they aimed to add Script Libraries like in SCII, but never finished that).
I got to a point where I was able to display all GUI triggers in .Net's winforms, although I never got to the part of saving an edited file.

Long story short:
  • the *.wtg file contains information about the tree view in trigger editor, the definition of all global variables and definition of all GUI triggers
  • the *.wct file contains Map Header and Map Script (seen in trigger editor when selecting the root/map node in tree view) and all the content of jass scripts as well as gui-to-jass-converted triggers. At this point I have not checked where lua scripts are stored, but I imagine it would be the same file since you can choose either jass or lua, not both
  • the *.j file is the map script file that contains all scripts (and GUI triggers converted to scripts). This file is used in actual game.

I would assume that due to some issue during map save process, the .wtg and .wct scripts have been edited, but the .j file stayed the same.

@deathtrap do you know which triggers are missing? All perhaps? If you want, you can upload the map here and I could check it in that .net app I've mentioned to see if that is able to read the .wtg file.
 
Top