Demo Map Triggers - Multi-Unit Instanceability (MUI)

Sooda

Diversity enchants
Reaction score
318
Index:
1.0 - What is Multi-Unit Instanceability (MUI)?
1.1 - Trigger overlapping
1.2 - How to prevent it (achieving MUI)?
1.3 - Demo map with MUI knockback, damage over time abilities and tutorial example in action.

1.0 - What is Multi-Unit Instanceability (MUI)?
When triggered ability can be cast by multiple units at same time without ability malfunctioning. As a note MPI means Multi-Player Instanceability.

1.1 - Trigger overlapping
Happens when currently waiting trigger new instance fires and starts to overwrite previously set variable values. Trigger without waits never overlaps.

1.2 - How to prevent it (achieving MUI)?
Each trigger has execution count, that number is unique to every instance. Using that number as array indexes which trigger instance uses we achieve MUI.

When using custom scripts all your defined variables get prefix "udg_" (without ""). Local variable declaration must be first thing in trigger actions. Safest way to get started is always paste this section to your trigger start:
Trigger:
  • Actions
    • Custom script: local integer locExecCount = GetTriggerExecCount(GetTriggeringTrigger())
    • Custom script: if locExecCount == 50 then
    • Custom script: call ResetTrigger(GetTriggeringTrigger())
    • Custom script: endif
    • Custom script: set udg_trigExecCount = locExecCount

'trigExecCount' is integer variable with default starting values.

You can name variable differently, for example 'myTriggerIndex' (without ''). Then you would change variable name in custom script also:
Trigger:
  • Custom script: set udg_myTriggerIndex = locExecCount

I will use in my example still name 'trigExecCount' (without '').

Lastly MUI trigger with wait. After using wait in trigger you have to use custom script to set trigger execution variable again!
'triggerUnit' is unit variable array with default starting value.
Trigger:
  • Golden Hammer
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Golden Hammer (T)
    • Actions
      • Custom script: local integer locExecCount = GetTriggerExecCount(GetTriggeringTrigger())
      • Custom script: if locExecCount == 50 then
      • Custom script: call ResetTrigger(GetTriggeringTrigger())
      • Custom script: endif
      • Custom script: set udg_trigExecCount = locExecCount
      • Set hammer_target[trigExecCount] = (Target unit of ability being cast)
      • Set hammer_caster[trigExecCount] = (Triggering unit)
      • Special Effect - Create a special effect attached to the overhead of hammer_target[trigExecCount] using Objects\InventoryItems\PotofGold\PotofGold.mdl
      • Set hammer_sfx[trigExecCount] = (Last created special effect)
      • For each (Integer hammer_loop[trigExecCount]) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Cause hammer_caster[trigExecCount] to damage hammer_target[trigExecCount], dealing 50.00 damage of attack type Spells and damage type Normal
          • Player - Add 10 to (Owner of hammer_caster[trigExecCount]) Current gold
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (hammer_target[trigExecCount] is dead) Equal to True
            • Then - Actions
              • Special Effect - Destroy hammer_sfx[trigExecCount]
              • Player - Add 50 to (Owner of hammer_caster[trigExecCount]) Current gold
              • Skip remaining actions
            • Else - Actions
              • Wait 5.00 game-time seconds
              • Custom script: set udg_trigExecCount = locExecCount
      • Special Effect - Destroy hammer_sfx[trigExecCount]


Trigger execution count is reset after 50 by default. Maximum is 8190 (Thanks AceHart). For example:
Trigger:
  • Custom script: if locExecCount == 8190 then

When triggered ability requires 20 unit array indexes reserved then max simultaneous casts of ability would be 8190/ 20. Best would be to store instance reserved array index start to one integer variable and end to another integer variable.
1.3 - Demo map with MUI knockback, damage over time abilities and tutorial example in action.
It is attached below my post.

Version history:
1.3 - added Dash ability (works on area knock back trigger)
1.2 - fixed area knock back angle and added location check
1.1 - trigger execution count reset set to 50.
1.0 - Initial release.
 

Attachments

  • Multi-Unit Instanceability Demo Version 1.3.w3x
    49.3 KB · Views: 802

vypur85

Hibernate
Reaction score
803
Actually, I've done this before. Fusing Flare's MUI-GUI and then localise an integer so that all arrays are made MUI regardless of whether there's wait or not. Also, to make timer 'MUI', a dummy unit can be used to reference its custom value. Anyway, I've decided to scrape the idea because when the array becomes too big, it will either lags the game or may not function at all (this will happen if many large arrayed variables are created).

Anyway, I might be wrong, though.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> if locExecCount == 8191 then

You should stop at 8190...

> set udg_trigExecCount = locExecCount

What's the point of using two variables here?

And, those (pseudo-)locals have a couple features, like not working inside "pick every"s, conditions, ...


Also, the example given is not very useful as "Dying unit" already has no problems.
(Other than waiting for ages and the unit is removed from the game of course)


> Instansable

is not a word.
 

Psiblade94122

In need of sleep
Reaction score
138
instead of telling my to copy and paste the scripts, can you please tell me the exact effects of each script and their purpose?

like call ResetTrigger(GetTriggeringTrigger()) is easy to understand, i get that much because its straight forward

but then you have stuff like
local integer locExecCount = GetTriggerExecCount(GetTriggeringTrigger())
where i see its an integer but i have no idea how its counting, thus i have no idea how this script works as a whole and that just makes my head hurt like crazy =_=

also, i understand that locals isolate the trigger so it wont be overlaped by another instance but i dont see how a local integer would make DOTS and Slides mui

and no i cannot see the demo map for another 4 or so hours, im reading this at school at the moment,perhaps ill understand it a bit better if i look at it though, but since your tut is so gung ho about copy paste this local and youll be fine, i dont think ill be able to understand how exactly dose this work outside of that
 

Sooda

Diversity enchants
Reaction score
318
I just updated demo map with minor fixes, it should now be down loadable.

> What's the point of using two variables here?

After wait I load from local variable trigger execution count to global variable. Execution count is unique index which used with arrays makes trigger MUI.


> I don't get custom script part.


is in GUI this:
Code:
Actions
    Set trigExecCount = (Execution count of (This trigger))
Convert it to custom script and you will see that same thing. I restore execution count from local integer variable which is glued to trigger and does not get lost with waits. Thanks for comments. I hope your head does not hurt so much anymore :)

EDIT:

I will add next Dash ability which shows how to slide caster while keeping MUI. It works same way as Gold Hammer ability.
 

Trollvottel

never aging title
Reaction score
262
Its a nice idea, i didnt even know that there was something like a execution count ^^. Will be useful for some GUIlers.
 

Leazy

You can change this now in User CP.
Reaction score
50
This is awesome :)

One question, lets say I got a variable called ''Kill_Point''. Can I now have three triggers using the same variable using that custom value way or do I need to create a new variable for each single MUI trigger? For example:

One trigger kills a unit, then waits and revives it at Kill_Point
One trigger creates 10 footmens at Kill_Point after 20 seconds that someone casted an ability
and one trigger creates two special effects 10 seconds after a unit moves at that point (at Kill_Point).

Will this work? (It's just an example)
 

emjlr3

Change can be a good thing
Reaction score
395
if the only way to make GUI MUI is to use JASS....whats the point?
 

Romek

Super Moderator
Reaction score
963
if the only way to make GUI MUI is to use JASS....whats the point?
It's only a few lines of Jass.
GUIers could learn those lines, or simply copy and paste.
Then they could continue the trigger in GUI, without having to fully learn Jass.
 

emjlr3

Change can be a good thing
Reaction score
395
they could just as easily learn some simple JASS, and their triggering would be much better for it

spending a few hours learning it more then pays for itself in the long run, when you consider how much easier and faster it is to make trigger using JASS as compare dto GUI
 

Sooda

Diversity enchants
Reaction score
318
> One question, lets say I got a variable called ''Kill_Point''

'Kill_Point' needs to be variable array. Then you use trigger execution count as array index and it will be MUI when you restore from local variable execution count after wait in trigger. Without using array it is not possible.

Oh comments, I like feedback :)They could remember such trick to create MUI triggers. It' s similar to learning removing memory leaks.

EDIT:

Just for the record,

'triggerz' is trigger variable array with default starting value.
'triggerIndex' is integer variable with default starting value.
'thisTriggerIndex' is integer variable with default starting value.

Code:
Idea
    Events
    Conditions
    Actions
        -------- Set it up --------
        Set triggerz[triggerIndex] = (This trigger)
        Set triggerIndex = (triggerIndex + 1)
        -------- Get current trigger index --------
        For each (Integer A) from 0 to triggerIndex, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        triggerz[(Integer A)] Equal to (This trigger)
                    Then - Actions
                        Set thisTriggerIndex = (Integer A)
                    Else - Actions
        -------- Remove trigger from list --------
        For each (Integer A) from 0 to triggerIndex, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        triggerz[(Integer A)] Equal to (This trigger)
                    Then - Actions
                        Set triggerz[(Integer A)] = triggerz[triggerIndex]
                        Set triggerIndex = (triggerIndex - 1)
                    Else - Actions
Can be used to create MUI triggers with loop check, it is correct until 'This Trigger' points to fired trigger (maybe 60 seconds).
 

lindenkron

You can change this now in User CP
Reaction score
102
Now I've read this tutorial twice, and I might just be dumb, but I still don't get it...

Trigger:
  • MUI Example
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: local integer locExecCount = GetTriggerExecCount(GetTriggeringTrigger())
      • Custom script: if locExecCount == 50 then
      • Custom script: call ResetTrigger(GetTriggeringTrigger())
      • Custom script: endif
      • Custom script: set udg_trigExecCount = locExecCount
      • Set triggerUnit[trigExecCount] = (Dying unit)
      • Game - Display to (All players) the text: (Killed unit was: + (Name of (Dying unit)))
      • Game - Display to (All players) the text: (Trigger execution count: + (String(trigExecCount)))
      • Wait 5.00 seconds
      • -------- IMPORTANT: Setting with custom script trigger execution count again! --------
      • Custom script: set udg_trigExecCount = locExecCount
      • Game - Display to (All players) the text: (After wait unit was: + (Name of triggerUnit[trigExecCount]))


The custom scripts used here, are the same as in the abilities.. Right?
All I see that script doing is counting how many creeps have been killed, I fail to see how that helps me with my wait issue.. I see alot of stuff that I don't get, I don't know if this tutorial was made for peopel further in understanding JASS etc. then me, but it's not far enough basic for me atleast to understand.
 

Sooda

Diversity enchants
Reaction score
318
> I think it'd be easier if you just made them local globals. Less script overall.

Now that suggestion I didn't expected... whole point of this tutorial is to avoid map breaking local globals.

> The custom scripts used here, are the same as in the abilities.. Right?
Yes.

> I fail to see how that helps me with my wait issue..

It stores trigger execution count into local variable and sets global variable after wait again to local variable value (trigger execution count). Trigger execution count is unique to every trigger unless reset, which I do after 50 runs, 50 instances at same time should be fine for GUI-ers.

Here is GUI concept of it:
Trigger:
  • MUI Concept
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Died unit name is: + (Name of (Dying unit)))
      • Set myUnitVariableArray[(Execution count of (This trigger))] = (Dying unit)
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: (Died unit name after wait is still: + (Name of myUnitVariableArray[(Execution count of (This trigger))]))

Though it keeps MUI until 'This Trigger' is stored in memory (60 seconds maybe). I use local variable at actions start to store trigger. It makes MUI independent from 'This Trigger'.

EDIT: 'This Trigger' isn't safe to use, with new trigger firing execution count is raised.
 

SwedishChef

New Member
Reaction score
32
Sooda i have to say (and i hope that you see this) that your mui-tutorial is great:thup: i have only question thought: why do you only use " if locExecCount == 50 then" not ==30?? Maby nooby question but i got to know:p.

they could just as easily learn some simple JASS, and their triggering would be much better for it

spending a few hours learning it more then pays for itself in the long run, when you consider how much easier and faster it is to make trigger using JASS as compare dto GUI

I would love to learn jass but i don't understand the guides. I dont know how a jass "trigger" is built up and i don't know how the action, events and conditions should be written :confused:. Anyone have a good guide, maby you emjlr3??
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Well, if you're a GUI user, but seriously don't want to pick up JASS, then this is the thread for you.

Approved, but under the category of 'demo map', not 'tutorial'.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top