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

Barrel and Icon

Level 6
Joined
Mar 28, 2018
Messages
128
Hello Guys,

1. I put some barrels on the map that you break and something drops. the problem is that I don't want it to appear later and I know that this is the cause... but I don't know how to solve it :(
  • ReviveTree
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is dead) Equal to True
            • Then - Actions
              • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation
            • Else - Actions
2. I would like to set the icon to show on the minimap where the barrels are. I kept looking and I don't know how to do this more precisely.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
1. if I understand you correctly, you have placed trees and barrels in your map and you have this trigger that is supposed to resurrect just the trees, but the issue is that it also resurrect barrels, right?
If so, all you need is to place another condition under the '((Picked destructible) is dead) Equal to True' and check that the destructible-type is not barrel. The condition is under 'Destructible-Type Comparison' category
  • ReviveTree
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is dead) Equal to True
              • (Destructible-type of (Picked destructible)) Not equal to Barrel
            • Then - Actions
              • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation
            • Else - Actions
2. You can show destructibles as rectangles on minimap (same way that non-hero units are shown)
Find the barrel in Object Editor and look for the 'Art - Minimap - ...' section. For example if you do this:
1701457652138.png


Then you can see the destructibles as cyan-colored rectangles on minimap:
1701457704144.png
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
those icons can be seen in partial fog, but they cannot be seen in full (black) fog.

I don't think there is a way to enable that, but what you can do is place custom icons on the minimap, similarly to how gold mine can be seen on map.
It's a bit more complex, but it should work. However I am not sure if there is a limit to how many icons can be shown on minimap. I tried this with 63 icons and was OK.
Try the following:
  1. In object editor, find your barrel and set the 'Art - Minimap - Show' to false to hide barrel's original minimap icon
  2. In trigger editor, create these variables (make sure mapCrates and mapIcons have 'Array' checked):
    1701461829814.png
  3. Create the following trigger:
    • Map Ini
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Destructible - Pick every destructible in (Playable map area) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Destructible-type of (Picked destructible)) Equal to Crates
              • Then - Actions
                • Set VariableSet loc = (Position of (Picked destructible))
                • Cinematic - Create Minimap Icon at loc of color (255, 125, 60) using UI\Minimap\MiniMap-Goldmine.mdl and fog visibility Black mask
                • Quest - Set Minimap Icon Visible for (Last created minimap icon) to True
                • Set VariableSet mapIndex = (mapIndex + 1)
                • Set VariableSet mapIcons[mapIndex] = (Last created minimap icon)
                • Set VariableSet mapCrates[mapIndex] = (Picked destructible)
                • Trigger - Add to Crate Destroyed <gen> the event (Destructible - (Picked destructible) dies)
                • Custom script: call RemoveLocation(udg_loc)
              • Else - Actions
    This trigger will on map start pick every destructible that is your barrel (in my case, it's the 'Crates' destructible) and for each of these destructible it creates a minimap icon, using the 'gold mine' icon model.
    Next it stores reference to the icon and the barrel/crate under same index in both array variables.
    Finally, since you will most likely want to remove the minimap icon when the barrel has been destroyed, you will need to add new events to a second trigger that will be fired when any of the picked barrels are destroyed.
  4. Create a second trigger that will react when a barrel has been destroyed.
    Notice that this trigger has no events, because they are added via the 'Trigger - Add to ... the event ..." action in previous trigger
    • Crate Destroyed
      • Events
      • Conditions
      • Actions
        • For each (Integer iterator) from 1 to mapIndex, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • mapCrates[iterator] Equal to (Dying destructible)
              • Then - Actions
                • Quest - Destroy Minimap Icon for mapIcons[iterator]
                • Set VariableSet mapCrates[iterator] = mapCrates[mapIndex]
                • Set VariableSet mapIcons[iterator] = mapIcons[mapIndex]
                • Set VariableSet mapIndex = (mapIndex - 1)
                • Skip remaining actions
              • Else - Actions
    This trigger just uses the loop to find out the index of the destroyed barrel in order to destroy the correct icon. Then it does a bit of a cleanup.
And that's all. This is how it looks like in my test map - all those brown-ish gold mine icons are locations of creates
1701462128499.png
 
Top