System GUI MUI System

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
This system was made by Uareanoob.
Small math help from Pyrogasm.
Give credit when used.
v1.02

How to use:
When making a spell all you need to do is make all of your variables arrays and then use the casting units custom value to reference the array number.

This system uses custom values and array to make certain things some what MUI. Every thing you want MUI you need to make it a array.This system only makes it MUI nor SUI (same unit instantaniable.)

What this system does is it has 2 variables that are used one is a variable that stores the amount of units a player currently has. Another variable takes that value and then it subtracts it by 1 then multiplys by maxplayers and then adds the players number to it and then sets the units custom value. This does some thing like this:
Player 1 : Unit 1 = 1 Unit 2 = 17
Player 2 : Unit 1 = 2 Unit 2 = 18
and so on....
Formula : (n-1)*16 + PlayerNumberOf
Max units is 8191 and about 500+ units per player.
It assigns each unit on the map a number, which is then stored as the unit's Custom Value. The value is calculated in this line: "Set MUI_Unit_Vaule = (((MUI_Player_Total[(Player number of (Owner of (Picked unit)))] - 1) x MaxPlayers) + (Player number of (Owner of (Picked unit))))".

What that means is this: ((TheNthUnitOfTheOwningPlayer) - 1) x (TotalNumberOfPlayers) + (ThePlayerNumberOfTheOwnerOfTheUnit)

So, for instance, the 5th unit of Player 1 when there are 12 players would be: (5 - 1) x 12 + 1 = 49; this number is unique, and each unit has its own number.

When a unit casts a spell, it simply uses arrays of whatever variables you need with an index of the unit's cusom value.
Code:
MUI Start
    Events
        Map initialization
    Conditions
    Actions
        -------- ~~~~~~~~~~~~~~~~~Variables~~~~~~~~~~~~~~~~~ --------
        -------- MaxPlayers- This determines the max amount of players you will be using in this system. --------
        Set MaxPlayers = 16
        -------- Testing- End~Type: Integer~Defualt: 16 --------
        -------- ~~~~~~~~~~~~~~~~~Variables - End~~~~~~~~~~~~~~~~~ --------
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Custom script:   set bj_wantDestroyGroup = true
                Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is Summoned) Not equal to True)) and do (Actions)
                    Loop - Actions
                        Set MUI_Player_Total[(Player number of (Picked player))] = (MUI_Player_Total[(Player number of (Picked player))] + 1)
                        Set MUI_Unit_Vaule = ((((MUI_Player_Total[(Player number of (Picked player))] - 1) x MaxPlayers) + (Player number of (Picked player))) + (Player number of (Picked player)))
                        Unit - Set the custom value of (Picked unit) to MUI_Unit_Vaule
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Testing Equal to True
                            Then - Actions
                                Game - Display to (All players) the text: ((String(MUI_Player_Total[(Player number of (Picked player))])) + (.  + (String((Custom value of (Picked unit))))))
                            Else - Actions
Code:
MUI New Units
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Triggering unit) is Summoned) Equal to False
                (Custom value of (Triggering unit)) Equal to 0
    Actions
        Set MUI_Player_Total[(Player number of (Owner of (Triggering unit)))] = (MUI_Player_Total[(Player number of (Owner of (Triggering unit)))] + 1)
        Set MUI_Unit_Vaule = (((MUI_Player_Total[(Player number of (Owner of (Triggering unit)))] - 1) x MaxPlayers) + (Player number of (Owner of (Triggering unit))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                MUI_Unit_Vaule Greater than 8191
            Then - Actions
                Set MUI_Unit_Vaule = 0
                For each (Integer A) from 1 to 8191, do (Actions)
                    Loop - Actions
                        Set UnitNumber = (((IntegerPool[(Integer A)] - (Player number of (Owner of (Triggering unit)))) / MaxPlayers) + 1)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                And - All (Conditions) are true
                                    Conditions
                                        IntegerPool[(Integer A)] Not equal to 0
                                        (((UnitNumber - 1) x MaxPlayers) + (Player number of (Owner of (Triggering unit)))) Equal to IntegerPool[(Integer A)]
                            Then - Actions
                                Set MUI_Unit_Vaule = IntegerPool[(Integer A)]
                                Set IntegerPool[(Integer A)] = 0
                                Custom script:   exitwhen true
                            Else - Actions
            Else - Actions
        Unit - Set the custom value of (Triggering unit) to MUI_Unit_Vaule
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Testing Equal to True
            Then - Actions
                Game - Display to (All players) the text: ((String(MUI_Player_Total[(Player number of (Owner of (Triggering unit)))])) + (.  + (String((Custom value of (Triggering unit))))))
            Else - Actions
Code:
MUI Die
    Events
        Unit - A unit Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Triggering unit) is A Hero) Equal to False
                (Custom value of (Triggering unit)) Not equal to 0
    Actions
        Set IntegerPool[(Execution count of (This trigger))] = (Custom value of (Triggering unit))
        Unit - Set the custom value of (Triggering unit) to 0
Code:
This system was made by Uareanoob.
Small math help from Pyrogasm.
Give credit when used.
v1.02
Links for Updated versions:
http://www.thehelper.net/forums/showthread.php?t=58815
http://www.wc3campaigns.net/showthread.php?t=95131
http://www.hiveworkshop.com/resources_new/spells/985/

Every thing you want to be MUI needs to be a array.

~~When using system~~
1. Add Unit - Add classification of Summoned to (Last created unit) to dummy casters if you do not want it to be added to the MUI process.
2. When you need to remove leaks for a spell with arrays you to add this after the "(udg_<variable>)": [GetUnitUserData(GetSpellAbilityUnit())]). 
    but for other possibilities instead of "GetSpellAbilityUnit" see "Unit List" Trigger Comment.
3. When using periodic events like: "Time - Every 2.00 seconds of game time" you need to use:
   "For each (Integer A) from 1 to MaxPlayers, do (Actions)" and then the actions you want with the (Integer A) in the array slots.
4. When using "For Each Integer" loops use "For Each Integer Variable" then create a Variable 
    for the trigger you are using the loop in and have it be an array integer so you can use it along with the "triggering unit's" custom value.
5. When you lower the variable "MaxPlayers" it removes from the players from the end of the list which means if it is set to 12 it will only
    support players 1-12.
6. If you use pre-placed units for doodads or destructible then you must add the class "Summoned" to the unit's "Stats- Unit Classification".
Code:
v1.02
Full Unit List:
    1.GetLastCreatedUnit() - (Last created unit)
    2.GetLastRestoredUnitBJ()/GetLastRestoredUnit() - (Last restored unit)
    3.GetLastReplacedUnitBJ()/GetLastReplacedUnit() - (Last replaced unit)
    4.GetLastHauntedGoldMine() (Last Haunted Gold Mine)
    5.GetEnumUnit() - (Picked unit)
    6.GetFilterUnit() - (Matching unit)
    7.GetAttackedUnitBJ()/GetAttackedUnit() - (Attacked unit)
    8.GetAttacker() - (Attacking unit)
    9.GetBuyingUnit() - (Buying unit)
    10.GetCancelledStructure() - (Cancelled structure)
    11.GetSpellAbilityUnit() - (Casting unit)
    12.GetConstructingStructure() - (Constructing structure)
    13.GetConstructedStructure() - (Constructed structure)
    14.GetEventDamageSource() - (Damage source)
    15.GetDecayingUnit() - (Decaying unit)
    16.GetDyingUnit() - (Dying unit)
    17.GetEnteringUnit() - (Entering unit)
    18.GetManipulatingUnit() - (Hero manipulating item)
    19.GetKillingUnitBJ()/GetKillingUnit() - (Killing unit)
    20.GetLearningUnit() - (Learning Hero)
    21.GetLeavingUnit() - (Leaving unit)
    22.GetLevelingUnit() - (Leveling Hero)
    23.GetLoadedUnitBJ()/GetLoadedUnit() - (Loading unit)
    24.GetOrderedUnit() - (Ordered unit)
    25.GetChangingUnit() - (Ownership-changed unit)
    26.GetResearchingUnit() - (Researching unit)
    27.GetRevivableUnit() - (Revivable Hero)
    28.GetRevivingUnit() - (Reviving Hero)
    29.GetSellingUnit() - (Selling unit)
    29.GetSoldUnit() - (Sold unit)
    29.GetSummonedUnit() - (Summoned unit)
    29.GetSummoningUnit() - (Summoning unit)
    29.GetOrderTargetUnit() - (Target unit of issued order)
    29.GetSpellTargetUnit() - (Target unit of ability being cast)
    29.GetEventTargetUnit() - (Targeted unit)
    29.GetTrainedUnit() - (Trained unit)
    29.GetTransportUnitBJ()/GetTransportUnit() - (Transporting unit)
    29.GetTriggerUnit() - (Triggering unit)
Code:
This system was made by Uareanoob.
Small math help from Pyrogasm.
Change Log: v1.01
1. Changed All "Casting Units" To "Triggering Unit".
2.Changed "MUI New Units" Event to "Unit - A unit enters (Playable map area)"
3.Also removed unit group from "MUI New Units".
Change Log: v1.02
1.Re-Made Test Spell

________________________
Check Out my MUI System for GUI
 

Attachments

  • WC3ScrnShot_052607_122909_01.jpg
    WC3ScrnShot_052607_122909_01.jpg
    90.5 KB · Views: 957
  • Uareanoob's GUI MUI System v1.02.w3x
    53.9 KB · Views: 551

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
Code:
This system was made by Uareanoob.
Small math help from Pyrogasm.
Change Log: v1.01
1. Changed All "Casting Units" To "Triggering Unit".
2.Changed "MUI New Units" Event to "Unit - A unit enters (Playable map area)"
3.Also removed unit group from "MUI New Units".
________________________
Check Out my MUI System for GUI
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
715
Wait, what what what? What is this supposed to do. I'm a dummy, please elaborate.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
It assigns each unit on the map a number, which is then stored as the unit's Custom Value. The value is calculated in this line: "Set MUI_Unit_Vaule = (((MUI_Player_Total[(Player number of (Owner of (Picked unit)))] - 1) x MaxPlayers) + (Player number of (Owner of (Picked unit))))".

What that means is this: ((TheNthUnitOfTheOwningPlayer) - 1) x (TotalNumberOfPlayers) + (ThePlayerNumberOfTheOwnerOfTheUnit)

So, for instance, the 5th unit of Player 1 when there are 12 players would be: (5 - 1) x 12 + 1 = 49; this number is unique, and each unit has its own number.

When a unit casts a spell, it simply uses arrays of whatever variables you need with an index of the unit's cusom value.
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
It assigns each unit on the map a number, which is then stored as the unit's Custom Value. The value is calculated in this line: "Set MUI_Unit_Vaule = (((MUI_Player_Total[(Player number of (Owner of (Picked unit)))] - 1) x MaxPlayers) + (Player number of (Owner of (Picked unit))))".

What that means is this: ((TheNthUnitOfTheOwningPlayer) - 1) x (TotalNumberOfPlayers) + (ThePlayerNumberOfTheOwnerOfTheUnit)

So, for instance, the 5th unit of Player 1 when there are 12 players would be: (5 - 1) x 12 + 1 = 49; this number is unique, and each unit has its own number.

When a unit casts a spell, it simply uses arrays of whatever variables you need with an index of the unit's cusom value.
Exactly I quoted to first post.
________________________
Check Out my MUI System for GUI
 

Tom Jones

N/A
Reaction score
437
The very first unit group your using doesn't work properly, your using trigger unit instead of matching unit.
I suggest you to make some better examples, I had no clue what the -ton test proved.
As far as I could understand from the code, one unit can only have one location, one real, etc. at a time. Or did I overlook something?
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
I suggest you to make some better examples, I had no clue what the -ton test proved.
As far as I could understand from the code, one unit can only have one location, one real, etc. at a time. Or did I overlook something?
-ton turns on a trigger that creates and destroys units. In trigger "MUI Die" dying units value gets stored into a variable. And so that when you have reach the max on a array 8191 (size 8192, 0-8192) it will reuse the vaules.

And for the one thing you are right for each variable a unit can only get one slot that means its not SUI but merely MUI.
________________________
Check Out my MUI System for GUI
 

Hero

─║╣ero─
Reaction score
250
If you want MUI so badly..just use JASS...it seems so much easier
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
You can have as many variables as you need, Tom; you just simply have to have them be arrays that you can reference.
 

Tom Jones

N/A
Reaction score
437
If you want MUI so badly..just use JASS...it seems so much easier
It sure does.

You can have as many variables as you need, Tom; you just simply have to have them be arrays that you can reference.
Yes of course, the thing I'm pointing out is that you can't have, let's say, all your location variables in one location array variable:
Code:
Set MUI_Locations[*Custom value Unit A*] = *Location A*
Set MUI_Locations[*Custom value Unit A*] = *Location B*
That would be a nice feature to implement.
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
Yes of course, the thing I'm pointing out is that you can't have, let's say, all your location variables in one location array variable:
Code:
Set MUI_Locations[*Custom value Unit A*] = *Location A*
Set MUI_Locations[*Custom value Unit A*] = *Location B*
That would be a nice feature to implement.

I don't get it. Can you explain it better?
________________________
Check Out my MUI System for GUI
 

elmstfreddie

The Finglonger
Reaction score
203
GREATEST THING SINCE JESUS.

Naw it's cool, a lot of GUIers will need this.
I used to use similar (very similar, suspiciously similar) systems to make things MUI, then I finally gave into JASS.
 

elmstfreddie

The Finglonger
Reaction score
203
I cancelled that classroom... :D

But I was doing that stuff a lonnnngg time ago.
I KNEW how to use custom values of units, but I never really did. I mostly used unit variables along with booleans with arrays n stuff.
 

MaaxeEvid

New Member
Reaction score
8
hahahaha, i will not criticize your tutorial, cause its no bad.
But why you dont teach, how to use Handles in JASS? its more efficient.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top