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

[Trigger] Is my trigger MUI?

Status
Not open for further replies.
Level 4
Joined
Dec 5, 2011
Messages
75
Sorry, im new to MUI and im wondering if my trigger is MUI, thanks!

  • BUBBLE2
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (==) (Order(immolation))
    • Actions
      • Custom script: local unit waterunit
      • Custom script: local location waterloc
      • Set Water_Unit = (Ordered unit)
      • Custom script: set waterunit = udg_Water_Unit
      • Set Water_Loc = (Position of Water_Unit)
      • Custom script: set waterloc = udg_Water_Loc
      • Unit - Add Bubble Dummy Spell2 to Water_Unit
      • Trigger - Turn on BUBBLE CAST <gen>
      • Custom script: call RemoveLocation( udg_Water_Loc)
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
I can't say for sure because you're executing another trigger. waterunit and waterloc should be set to null, it will leak references if you don't.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Is this instant???? if it is then ofc is MUI but if it is not then show us the execution and loop trigger. Anyway shadowing xD

EDIT:

I don't know if you can attach the local variables in the another trigger :/
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You do know that the use of local variable, right ?
It's for use within the scope (trigger itself).

When you pass it onto another trigger, it fails to read the variable as it is a private variable and it does not share with other trigger.

Don't think that by making your global variable -> local, will make your trigger to become MUI.

You can however make local variable turns to global and make your trigger MUI, here's an example;
  • MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit udg_u = GetTriggerUnit()
      • Wait 5.00 seconds
      • Unit - Kill u
      • Custom script: set udg_u = null
You see the addition of 'udg_' in front of the variable ?
That's how you convert your local into global - but by doing this, your variable isn't considered as "Global Variable" because you can't use it within another trigger at all.

Then why do we do this ?
It's to make thing simpler, by doing this, you can access GUI function and use it as your global variable.

If you don't this, here's the outcome you have to type;
  • MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Wait 5.00 seconds
      • Custom script: call KillUnit(u)
      • Custom script: set u = null
See the difference ?

You can also simplify your variable assignment by doing it like this;
  • Custom script: local unit localunit = GetTriggerUnit()
Instead of this;
  • Custom script: local unit localunit
  • Set u = (Triggering unit)
  • Custom script: set localunit = udg_u
Also, you should null your local variable at all times.
However, nulling should not be done to global variable because the value is shared by all and is dynamically change from time to time - it's not unique, only eats a small portion of memory throughout the game.

Local have unique value to each assignment, that's why we should null it every time to reduce memory consumption.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
This seems to work;
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: set udg_u = u
      • Trigger - Run Untitled Trigger 001 <gen> (ignoring conditions)
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit - Kill u
Surprisingly it worked lol.
I've tested it for the first time and it doesn't work.

Well, time to cross out some statement in previous post.
 
Level 4
Joined
Dec 5, 2011
Messages
75
Guys, thanks for helping me it solved few of my problems.
I cant set my variables to null because this :

  • BUBBLE CAST
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to (==) Water_Unit
    • Actions
      • Custom script: local unit watertarget
      • Set Water_Target = (Attacked unit)
      • Custom script: set watertarget = udg_Water_Target
      • Unit - Order Water_Unit to Night Elf Warden - Shadow Strike Water_Target
  • [TRIGGER]BUBBLE OFF
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (==) (Order(unimmolation))
    • Actions
      • Unit - Remove Bubble Dummy Spell2 from Water_Unit
      • Trigger - Turn off BUBBLE CAST <gen>
[/TRIGGER]
so until my unit doesnt deactivate the spell i cant set it to null

maybe indexing would make my trigger easiest to "MUI"?
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
You are not using global shadowing.
This is global shadowing.
  • Custom script: local unit udg_Water_Target
  • Set Water_Target = (Triggering unit)
  • do stuff here
  • set Water_Target = null
This is not global shadowing.
  • Custom script: local unit watertarget
  • Set Water_Target = (Attacked unit)
  • Custom script: set watertarget = udg_Water_Target
  • do stuff here
  • set watertarget = null
As said above you need to null at the end of the trigger.
It won't hurt anything since it is at the end of the trigger.
 
Status
Not open for further replies.
Top