• 🏆 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!

[Solved] Destructible within region not registering after creation

Status
Not open for further replies.
Level 3
Joined
Mar 14, 2022
Messages
17
Hello! I am reasonably new to the map editor, however have been learning quickly on how everything works. I currently have a problem where after a destructible within a region has been removed and a new one created; a trigger - 'Destructible - Destructible within region (Playable map area) dies', the actions don't happen. I have tried a lot of troubleshooting and ways around this to figure out what the problem is... But nothing has worked. This is with my using the Test Map function in version 1.32k (6114).

See below for a detailed explanation of what I am trying to do and how I am currently doing it.

I am trying to create a TD, where each player has an upgradable gate that the creeps attack. After the gate - the creeps then move through another players area before making their way towards a king. See below:

Player Gates.png

(Creeps attack the gate to the left, and then continue moving to the purple region, etc. The gate to the right is more just for aesthetics. It gets destroyed as well 0.5 seconds after the left gate has been destroyed.)

I have created a Blacksmith building with a gate acting as a unit in front of it. This building is where the gate upgrades are purchased are from. The unit gate is to act as the unit entering the map area for the trigger, as well as act as a tech tree requirement for other gates upgrades (as destructibles cannot have or be tech tree requirements).

Blacksmith Gate.jpg


I've created several triggers for this to function. After creating variables to represent the player gates and regions, I have a gate initialization trigger - setting the variables to equal the gates placed for the player to have at the start of the game (the dungeon gates). I have also created custom units and destructibles to represent the different types of gates.

Gate Initialization.jpg


Within the pathing triggers created for the creeps - there is a trigger that orders them to attack the gate (represented by variables) if it is alive.

Path.jpg


I have a trigger set for upgrading a gate. There are 4 other triggers for different gates that use the same scripting, but with altered details to make it upgrade to a different gate.

Gate Upgrade Trigger.jpg


And then the problem (I think) - a trigger telling the units to move to the next region after a destructible within region dies.

Gate Dies Trigger.jpg


Trouble is; when an upgraded version of the gate is destroyed - the creeps don't move + the second gate doesn't get destroyed.

For some reason as well - after the first upgrade to the 'Iron Gate', the second gate breaks. I think the 'Gate Dies' trigger activates even though that gate technically isn't dying... Just being removed. It also doesn't activate for any of the other gate upgrades... So I don't know why it does that for the Iron gate.

(Note that this picture is with the 'Icy Gate' upgrade, not the Iron Gate since the second Iron Gate breaks when you upgrade)
Problem Picture.jpg


Its either I am doing something wrong that I cant see, or a bug. I think that when a new gate is created after the old one is removed - the editor for some reason cant find the new gate (referenced through a variable) as a destructible anymore. The triggers works perfectly for the first gate already placed in the map, but none of the upgrades.

I have double checked all the variable and region allocations... But everything looks like it should be doing what I'm asking. I have attached the current version of the map to this thread - note that its is very unfinished! This map is also just for me to test/try make everything work before creating the full version with more players.

I feel like I cant continue until this problem is solved... But I don't know how to fix it. Any help would be greatly appreciated!
(Also; I currently don't know how to avoid data leaks; any links or references to leak proofing triggers and maps would be awesome!)
 

Attachments

  • Test TD III.w3m
    56.5 KB · Views: 9
Level 3
Joined
Mar 14, 2022
Messages
17
I have just tried adding a function so instead of having the Basic Gate already placed in the editor; having them created using an action. Now the Iron Gate doesn't break (which I'm assuming is because it still cant read these newly created destructibles), but it still doesn't work.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
I'm looking at your map now. Once I have the issue fixed I'll edit this post and attach the map.

But in the meantime, I believe the issue is with how these Destructible Events work. I believe the triggers using these Events register the pre-placed Destructibles to them during map initialization, and when new Destructible are created they're ignored by the trigger since they've never been registered.

Edit:

So I got the Gates working how I think you wanted them to work. I fixed some memory leaks and redesigned/organized some triggers slightly. It's still mostly all the same just with slight tweaks here and there to promote better practices/efficiency.

Things to note:
  • I only got Player 1 working. I barely touched Player 2.
  • I cleaned up memory leaks. You were leaking Unit Groups and Points. If this memory leak stuff is overwhelming then just ignore it for now, it's a matter of efficiency not functionality: Memory Leaks
  • I added a Region Fixing system to the map. Most people don't realize that Regions are bugged by default which causes inconsistencies in their behavior.
  • I recommend using this system: GUI Unit Indexer 1.4.0.0 I saw that you were using Custom Value in your triggers and that's good but the linked system is better. It actually uses Custom Value in a way that gives you unlimited "Custom Values" that you can assign to each unit.
  • The way the gates work is I create 1 of each Gate Destructible-Type at the start of the game for the players (I only did P1 to save time). So the Icy, Elven, High Elven, and Demonic Gates all exist on top of your Basic Gate, they're just Hidden. This allows me to avoid Replacing the Gates which is what caused your problem in the first place. So now when you Upgrade from Basic to Icy for example, the Basic Gates are Hidden and the Icy Gates are Shown. Going from Icy to Elven hides the Icy Gates and Shows the Elven Gates.
  • I fixed an issue with your Gate Death trigger where it would cause unwanted issues if you were to finish Upgrading a Gate while the trigger was still running. The Wait action when not used properly is very unsafe as you create windows of time where things can go wrong like variables changing to something else.
  • I was under the impression at first that you could freely build any of the 5 Gate Types at any moment. I hadn't noticed their Requirements that only allow you to rank up in tiers and never go back. I designed these triggers in a way that would allow such a thing so if you're a bit confused as to some of my decision making, that's probably why. But hey, the design works either way so it doesn't really matter.
 

Attachments

  • Test TD III U1.w3m
    64 KB · Views: 10
Last edited:
Level 3
Joined
Mar 14, 2022
Messages
17
Thank you so much! Yes! It will only register pre-placed destructables!

In that case… Maybe we could have already placed hidden destructibles in the map somewhere, and then just use a ‘remove destructible’ trigger for the old gate, and move the hidden destructable to the correct region; then using a ‘show’ trigger. That way it’s registered at map initialization and functions the same!

Edit:

Uncle - You are amazing. Thank you so much for your detailed response! The way you have adjusted the gates is perfect, and I look forward to learning from how you've adjusted the triggers to better flow and avoid memory links! I'll read up on those links!

I am basing a lot of how I have been making the map on another TD called Ruined Temple TD, which is the main reason I included the custom values as that's what they did in their map. I'll be honest in that I wasn't completely sure what I was doing. I was assuming that the custom values were for elements such as multiboards/scoreboards and things later which I also plan to include.

Again - I really appreciate your help on this!
 
Last edited:
Status
Not open for further replies.
Top