• 🏆 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] How to make Entering Region a MUI?

Status
Not open for further replies.
Level 2
Joined
May 13, 2017
Messages
21
I'm an amateur map maker, so I'm making triggers that I do not know if they are MUI or not. Please someone tell me how do i make entering region a MUI. For my RPG map

  • Shipyard
    • Events
      • Unit - A unit enters Shipyard <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Peasant
    • Actions
      • If ((Owner of (Entering unit)) Equal to Player 1 (Red)) then do (Set PlayingUnit = Footman 0271 <gen>) else do (Do nothing)
      • If ((Owner of (Entering unit)) Equal to Player 2 (Blue)) then do (Set PlayingUnit = Footman 0272 <gen>) else do (Do nothing)
      • If ((Owner of (Entering unit)) Equal to Player 3 (Teal)) then do (Set PlayingUnit = Footman 0273 <gen>) else do (Do nothing)
      • If ((Owner of (Entering unit)) Equal to Player 4 (Purple)) then do (Set PlayingUnit = Footman 0274 <gen>) else do (Do nothing)
      • If ((Owner of (Entering unit)) Equal to Player 5 (Yellow)) then do (Set PlayingUnit = Footman 0275 <gen>) else do (Do nothing)
      • -------- Setup for Dialog 1 --------
      • Set EnteringUnit = (Entering unit)
      • Dialog - Clear MapTeleportShip
      • Dialog - Change the title of MapTeleportShip to Travel to Shipyard?
      • Dialog - Create a dialog button for MapTeleportShip labelled Yes
      • Set DialogButtons[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for MapTeleportShip labelled No
      • Set DialogButtons[2] = (Last created dialog Button)
      • -------- Showing the dialog to all players --------
      • Dialog - Show MapTeleportShip for (Owner of (Entering unit))
      • Unit - Pause (Entering unit)
Is this trigger a MUI and leakless?
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
I think you don't understand what MUI and leaks are. In this trigger it is impossible for it not to be MUI (Multi Unit instanceability), since every action is made without interruptions in the middle, so called, waits (the Wait - 2 seconds.) For the trigger NOT be MUI it would have to have at least 1 Wait, then all values like "Entering Unit" would be overwritten, thus you cant reference to the old ones. Note that "Triggering Unit" won't get overwritten because it is a local variable so then you could have waits in some other triggers, but not in this.
Currently you have no leaks because here you're not creating any locations (Points), special effects, unit groups, player groups and many others without destroying/removing them.
  • Something
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
"Center of Region 000 <gen>" creates a point (location) leak. The way to remove it is creating a variable of type "Point" and do this:
  • Something fixed
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
    • Actions
      • Set Point = (Center of Region 000 <gen>)
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
Check out some tutorials starting by this one, I guesss: Things That Leak

As it stands, I find it quite difficult to spot leaks in your snippet. Well done!

On the question of efficiency, should it be presented, I would say calling (entering unit) once, and that's when assigning it to a variable.
Could be, but if you're talking about efficiency for real, then you should have said "triggering unit" because it is not only faster than "entering unit" (since it calls "triggering unit") but also it's the first one that appears and it works for most event responses. But effiency or speed in this trigger is quite irrelevant.
 
Status
Not open for further replies.
Top