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

Mui

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how do i make a trigger like this mui?
Like i understand the whole indexing and to create a loop when a spell is being cast. But in this cast it's only for basic attacks, do i still need to make the loop like you usually do?
(I know i should not use this event, only for demo).

  • Demo
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Item carried by (Attacking unit) of type Arcane Hammer) is owned) Equal to True
    • Actions
      • Set VariableSet ArcaneHammer_Stacking = (ArcaneHammer_Stacking + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArcaneHammer_Stacking Greater than or equal to 10
        • Then - Actions
          • Set VariableSet ArcaneHammer_Stacking = 0
          • Set VariableSet ArcaneHammer_Caster = (Attacking unit)
          • Set VariableSet ArcaneHammer_Point = (Position of ArcaneHammer_Caster)
          • Set VariableSet ArcaneHammer_SPXPoint = (Position of ArcaneHammer_Caster)
          • Set VariableSet ArcaneHammer_Group = (Units within 500.00 of ArcaneHammer_Point.)
          • Set VariableSet ArcaneHammer_HealthPercentage = 0.10
          • Set VariableSet ArcaneHammer_Dmg = (200.00 + ((Life of ArcaneHammer_Caster) + ArcaneHammer_HealthPercentage))
          • Special Effect - Create a special effect at ArcaneHammer_SPXPoint using war3mapImported\Arcane Explosion.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in ArcaneHammer_Group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) belongs to an enemy of (Owner of ArcaneHammer_Caster).) Equal to True
                • Then - Actions
                  • Unit - Cause ArcaneHammer_Caster to damage (Picked unit), dealing ArcaneHammer_Dmg damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_ArcaneHammer_Point)
          • Custom script: call RemoveLocation(udg_ArcaneHammer_SPXPoint)
          • Custom script: call DestroyGroup(udg_ArcaneHammer_Group)
        • Else - Actions
 
Level 12
Joined
Feb 5, 2018
Messages
521
? Your demo does not even use any indexing. It will not work with dynamic indexing, because a single unit might have multiple indexes.

Best to achieve this is to use custom value of a unit with unit indexer as index.

Or use hashtables to save the stacks for invidual units.

Also use a damage event instead of a unit is attacked.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
  • Demo
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet CV = (Custom value of DamageEventSource)
      • Set VariableSet HammerStacks[CV] = (HammerStacks[CV] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HammerStacks[CV] Equal to 10
        • Then - Actions
          • -------- do stuff --------
        • Else - Actions
I'm using a different Damage Engine but the concept is the same.

The Unit Indexer gives each unit a unique Custom Value which can be used as the Index in your Arrays.
 

Attachments

  • Hammer Example 1.w3m
    58.6 KB · Views: 20
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
  • Demo
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet CV = (Custom value of DamageEventSource)
      • Set VariableSet HammerStacks[CV] = (HammerStacks[CV] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HammerStacks[CV] Equal to 10
        • Then - Actions
          • -------- do stuff --------
        • Else - Actions
I'm using a different Damage Engine but the concept is the same.

The Unit Indexer gives each unit a unique Custom Value which can be used as the Index in your Arrays.

Okay i see thank you, so this pretty much works the same as making a loop etc?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Unit Indexing and Dynamic Indexing are similar in that they both take advantage of Arrays and Indexing, but the way you use them is different.

Unit Indexing is useful for things like Attributes that a Unit will only ever have one value of. So if you wanted to create a 4th Hero Attribute for example, let's call it Luck, you could use Unit Indexing.
  • Set Variable Luck[Custom value of some unit] = 25
But say you wanted to create a custom Shockwave ability that has no cooldown and can be spammed by multiple units, multiple times, and without any MUI issues. That's where Dynamic Indexing comes into play. It's not limited to only having one value per unit so a single unit could have 20 Shockwaves out on the map at a time without any issues.

Further Explanation:

This is a Variable: HammerStacks
This is a Variable with an Array: HammerStacks[]
The Array enables the use of these brackets --> [], which allows you to assign a Value which will be stored at the [ Index ]
The Index is the number that goes in the brackets --> [#]

Example:
HammerStacks[0] = 5
HammerStacks[394] = 10
HammerStacks[1000] = 15

0, 394, and 1000 are the Indexes.
5, 10, and 15 are the Values stored at those Indexes.

A Unit Indexer is a system that automatically assigns a Custom value to each unit in your map. This custom value is stored as an Integer that serves as an Id (identification).
Think of it like numbering your units. So if you only had 3 total units in your map, let's say 3 Footman, the system would do this:

FootmanA's custom value = 1
FootmanB's custom value = 2
FootmanC's custom value = 3

So now each Footman has it's own Integer id. This Id is what allows you to differentiate between the different units.
It's similar to the Id that you would have on your Driver's License or the Id you have at the end of your Battlenet name -> #14923. This Id is what makes you unique and different from others.

But how does the system actually number the units?

Whenever a new unit is created, the Unit Indexer increases an Integer variable by 1. Then it saves this Integer variable as the Custom value of that newly created unit. Custom value is basically an extra stat that Blizzard provided for us, it allows us to store an Integer value to each unit.

In Bribe's Unit Indexer he uses an Integer called UDex to handle this. UDex starts at 0 by default, and is increased by 1 whenever a new unit enters the map (is created). If you have pre-placed units on your map then they'll be Indexed first.
In other words, the system automatically numbers all of your units for you.

All you have to do is import (copy & paste) the Unit Indexer into your map and from there you'll have the ability to use Unit Indexing to create MUI effects.

So using the previous Example of our 3 Footman (A, B, and C), here's how we can keep track of HammerStacks for EACH of those units:

HammerStacks[custom value of FootmanA] = 5
HammerStacks[custom value of FootmanB] = 10
HammerStacks[custom value of FootmanC] = 15

So we're plugging our unit's Id (custom value) into the Index of our HammerStacks Array. This is what you're really doing:
HammerStacks[1] = 5
HammerStacks[2] = 10
HammerStacks[3] = 15

Because FootmanA has a custom value of 1, FootmanB has a custom value of 2, and FootmanC has a custom value of 3.

///

Dynamic Indexing is another method of Indexing. The key thing here is that it doesn't require a Unit Indexer.
Instead, you do your own Indexing, meaning you create your own variable like UDex and you Increase/Decrease it whenever necessary. Doing this allows you to dynamically control your Variable Arrays, which makes creating MUI effects quite simple.
I won't get into it too much but it's really quite simple once you understand the concept of Indexing. You're simply assigning each a unit it's own number, and then using this number as the [Index] in your Arrays. This is MUI because each unit has it's own number. Additionally, Dynamic Indexing allows you to give a unit multiple numbers, so a single unit could be using the Index 0, 1, and 2 in your Array. This is what makes it more useful than Unit Indexing in certain situations, especially in cases when you want an ability to work even with 0 a second cooldown (spam it all you want with any number of units and it will still work).
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Unit Indexing and Dynamic Indexing are similar in that they both take advantage of Arrays and Indexing, but the way you use them is different.

Unit Indexing is useful for things like Attributes that a Unit will only ever have one value of. So if you wanted to create a 4th Hero Attribute for example, let's call it Luck, you could use Unit Indexing. Set Variable Luck[custom value of some unit] = 25.

But say you wanted to create a custom Shockwave ability that has no cooldown and can be spammed by multiple units, multiple times, without any MUI issues, that's where Dynamic Indexing comes into play. It's not limited to only having one value per unit so a single unit could have 20 Shockwaves out on the map at a time without any issues.

Further Explanation:

This is a Variable: HammerStacks
This is a Variable with an Array: HammerStacks[]
The Array enables the use of these brackets --> [], which allows you to assign a new value to each [ Index ]
The Index is the number that goes in the brackets --> [#]

Example:
HammerStacks[0] = 5
HammerStacks[394] = 10
HammerStacks[1000] = 15

0, 394, and 1000 are the Indexes.
5, 10, and 15 are the Values stored at those Indexes.

A Unit Indexer is a system that automatically assigns a Custom value to each unit in your map. This custom value is stored as an Integer that serves as an Id (identification).
Think of it like numbering your units. So if you only had 3 total units in your map, let's say 3 Footman, the system would do this.

Example:
FootmanA's custom value = 1
FootmanB's custom value = 2
FootmanC's custom value = 3

So now each Footman has it's own Integer id. This Id is what allows you to differentiate between the different units.
It's similar to the Id that you would have on your Driver's License or the Id you have at the end of your Battlenet name -> #14923. This Id is what makes you unique and different from others.

But how does the system actually number the units?

Whenever a new unit is created the Unit Indexer increases an Integer variable by 1. Then it saves this Integer variable as the Custom value of that newly created unit.
In Bribe's Unit Indexer he uses an Integer called UDex. UDex starts at 0 by default, and is increased by 1 whenever a new unit enters the map (aka is created). If you have pre-placed units on your map then they'll be indexed first.
So the system automatically numbers all of your units for you, now all you have to do is take advantage of this.

So after importing the Unit Indexer into your map you can now use a method called Unit Indexing to create MUI effects.

So using the previous Example of our 3 Footman (A, B, and C), here's how we can keep track of HammerStacks for EACH of those units.

Example:
HammerStacks[custom value of FootmanA] = 5
HammerStacks[custom value of FootmanB] = 10
HammerStacks[custom value of FootmanC] = 15

So we're plugging our unit's Id (custom value) into the Index of our HammerStacks Array. This is what you're really doing:
HammerStacks[1] = 5
HammerStacks[2] = 10
HammerStacks[3] = 15

Because FootmanA has a custom value of 1, FootmanB has a custom value of 2, and FootmanC has a custom value of 3.

///

Dynamic Indexing is another method of Indexing. The key thing here is that it doesn't require a Unit Indexer.
Instead, you do your own Indexing, meaning you create your own variable like UDex and you Increase/Decrease it whenever necessary. Doing this allows you to dynamically control your Variable Arrays, which makes creating MUI effects quite simple.
I won't get into it too much but it's really quite simple once you understand the concept of Indexing. You're simply assigning each a unit it's own number, and then using this number as the [Index] in your Arrays. This is MUI because each unit has it's own number. Additionally, Dynamic Indexing allows you to give a unit multiple numbers, so a single unit could be using the Index 0, 1, and 2 in your Array. This is what makes it more useful than Unit Indexing in certain situations.

Wow, unbelievable how helpful you are dude. I'll take good use of this and probably learn from it! :)
 
Status
Not open for further replies.
Top