[Solved] Pretty please help making GUI dummy/buff system MUI?

Level 5
Joined
Feb 13, 2019
Messages
129
Trigger

  • Events
    • Player - Player 1 (Red) types a chat message containing test as An exact match
  • Conditions
  • Actions
    • Set VariableSet Hero_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Hero))
    • Unit Group - Pick every unit in Hero_Group and do (Set VariableSet UnitHunger[(Player number of (Owner of (Picked unit)))] = 3)
    • Unit - Create 1 Dummy (0) for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
    • Unit - Add Well Fed Dummy (Archimonde) to (Last created unit)
    • Unit - Order (Last created unit) to Special Archimonde - Finger Of Death (Picked unit)
  • Custom script: call DestroyGroup(udg_Hero_Group)
  • Custom script: call RemoveLocation(udg_??????)


I'm just trying to set it up so that when the game starts, every player owned Hero unit, receives this buff from the dummy.

But I'm not sure on how to set the variables to the units without making a separate trigger for each player, and making triggers that just uses "specific unit".


I want to say this is what loops are for? But don't they run forever? (the loop) will that have an adverse affect on gameplay?

Thank you for your time I really appreciate it.
 
Level 24
Joined
Aug 10, 2018
Messages
2,839
How many heroes does each player own?

Here's an example for 1 Hero per player:
  • Well Fed Dummy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This will keep track of our Heroes for the rest of the game --------
      • Set VariableSet Hero[1] = Paladin 0000 <gen>
      • Set VariableSet Hero[2] = Paladin 0001 <gen>
      • Set VariableSet Hero[3] = Paladin 0002 <gen>
      • -------- --------
      • -------- Create a Dummy unit to cast Well Fed on each Hero --------
      • Set VariableSet TempPoint = (Center of (Playable map area))
      • Unit - Create 1 Dummy for Neutral Passive at TempPoint facing Default building facing degrees
      • Set VariableSet Dummy = (Last created unit)
      • Unit - Add Well Fed (Dummy) to Dummy
      • Unit - Add a 1.00 second Generic expiration timer to Dummy
      • -------- --------
      • -------- Loop through All Players, ordering the Dummy to cast Well Fed on each Player's Hero --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet PN = (Player number of (Picked player))
          • Unit - Order Dummy to Human Priest - Inner Fire Hero[PN]
      • -------- --------
      • -------- Clean up the Point (Location) Memory Leak --------
      • Custom script: call RemoveLocation (udg_TempPoint)
Alternate version that doesn't require Dummy units but instead uses an Aura for the buff:
  • Well Fed Aura
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This will keep track of our Heroes for the rest of the game --------
      • Set VariableSet Hero[1] = Paladin 0000 <gen>
      • Set VariableSet Hero[2] = Paladin 0001 <gen>
      • Set VariableSet Hero[3] = Paladin 0002 <gen>
      • -------- --------
      • -------- Loop through All Players, adding the Well Fed ability to each Player's Hero --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet PN = (Player number of (Picked player))
          • Unit - Add Well Fed (Aura) to Hero[PN]
 

Attachments

  • Well Fed Example.w3m
    18.9 KB · Views: 18
Last edited:
Level 24
Joined
Aug 10, 2018
Messages
2,839
I want to say this is what loops are for? But don't they run forever? (the loop) will that have an adverse affect on gameplay?
There are different kinds of "Loops", but I think you're misunderstanding how they work. They don't run forever, instead, their length depends on what you tell them to do.

So how do they really work?
Pick every unit/Pick every player Loops are assigned a "group" of units/players to "loop" through. This group depends on what you told them to do. So the group could be "All Players" if you used "Pick every player in All Players". Or the group could be "Units owned by Player 1" if you did "Pick every unit owned by Player 1". Anyway, once the group has been created then the Loop will run through it, running the Loop - Actions ONCE for each object inside the group.

Think of it like if you had a bag of 10 marbles and you "looped" through that bag. You would remove each marble 1 at a time, and each time you removed a marble you would do something to it (in Warcraft 3's case you'd run Actions like "Kill picked unit" or something). Eventually you'll run out of marbles, right? Because you've looped through every single one inside the bag. That's the basic idea of what's going on with Warcraft 3's Loops.

Some more examples:

This one loops through each unit in the playable map area. Meaning, if there are 10 units in the map then this will run 10 times, once for each picked unit.
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
This one is similar to Pick every unit except that it loops through each Player instead. So if there are 5 Players in the game, it will run 5 times, once for each picked player.
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
This one loops from X to Y, Z amount of times. It has some extra useful functionality that can read about here: [Trigger] - Loops and Arrays tutorial
In this example: X = 1, Y = 10, and Z = the range between X and Y (1 to 10).
In other words, this Loop will run the actions 10 times (1 to 10).
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
Another example of this. This one runs the Actions 50 times, starting at 50 and ending at 100:
  • For each (Integer A) from 50 to 100, do (Actions)
    • Loop - Actions
 
Last edited:
Level 5
Joined
Feb 13, 2019
Messages
129
Sorry for the late reply, but thank you so so so so much! It seems like this opens the door for a lot of versatility! And it was explained beautifully and helped me digest the information a bit easier, and gave me a hands on example to learn from!

Also, it helped me find that my dummy unit must have been set up incorrectly, because it would only cast the effect on one unit at a time? I couldn’t understand what I had done wrong until I put everything in a new empty map, and through trial and error noticed that my dummy unit was set up incorrectly or bugged, so that was also helpful :p!
 
Level 24
Joined
Aug 10, 2018
Messages
2,839
No problem, glad I could help.

And the Dummy unit should have it's Movement Type set to None, Speed base set to 0, and most importantly the Art - Animation - Cast backswing/point set to 0.00.

The Cast Backswing/Point is what delays a unit when it casts a spell. This is done so the unit is forced to play a portion of it's Spell animation before the spell actually goes off. By setting these fields to 0 your Dummy will have no cast delay therefore it can cast any ability instantly. Note that if an ability has a Casting Time (99.99% of abilities do not use this field) it will delay the spell.

Also, setting the Movement Type to None makes it so the Dummy doesn't have to turn and face units in order to cast it's spells. It can freely cast a spell like Storm Bolt regardless of which direction it's facing.

I attached a map with a properly setup Dummy unit.
 

Attachments

  • Dummy Unit.w3m
    16.2 KB · Views: 17
Last edited:
Top