• 🏆 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] MUI Spell

Status
Not open for further replies.
Level 1
Joined
Oct 12, 2014
Messages
1
Hello everyone,

As the title states, I could use some help to make a GUI spell MUI.
Before asking, I have already read a lot of tutorials and topics asking for this kind of help and still could not find any answer. Tutorials usually describes "Damage over time" and "Knockback" spell types, where one or few actions are repeated ; triggers I have no difficult to make.
However, I have quite a big spell I would like to turn MUI, performing long sequences of actions where usual loops (periodic event) would make it process several times in one cast.
It contains -I know- a lot of Waits.

Basically, it's a no-target AoE spell. Casting hero moves swiftly to picked organic targets one after one, instantly killing them then running back to the casting point before flying up. Dead units leave a black mark on the ground that fires a black bolt to the hero when he's in the air. Finally, he comes back hitting the ground, dealing damage to the area based on killed units amount.

  • Black sun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Black sun
    • Actions
      • Set blacksun_caster = (Triggering unit)
      • Set blacksun_caster_point = (Position of blacksun_caster)
      • Cinematic - Apply a filter over 0.40 seconds using Normal blending on texture Black Mask, starting with color (100.00%, 100.00%, 100.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 40.00% transparency
      • Unit - Pause blacksun_caster
      • Special Effect - Create a special effect at (Position of blacksun_caster) using war3mapImported\Eclipse1.mdx
      • Set blacksun_effect[0] = (Last created special effect)
      • Wait 0.40 game-time seconds
      • Unit - Set level of Specter slide for blacksun_caster to 14
      • Unit Group - Pick every unit in (Units within 900.00 of blacksun_caster_point matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is Mechanical) Not equal to True)) and ((((Unit-type of (Matching unit)) Not equal to Dummy) and (((Matching unit) is A Hero) N and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to blacksun_group[0]
      • Set blacksun_count = (Number of units in blacksun_group[0])
      • Set blacksun_target = (Random unit from blacksun_group[0])
      • Wait 1.80 game-time seconds
      • Camera - Lock camera target for (Owner of blacksun_caster) to blacksun_caster, offset by (0.00, 0.00) using Default rotation
      • Camera - Set (Owner of blacksun_caster)'s camera Distance to target to 550.00 over 0.50 seconds
      • Unit - Unpause blacksun_caster
      • Trigger - Turn on Black sun 2 <gen>
  • Black sun 2
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (blacksun_group[0] is empty) Not equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (blacksun_target is alive) Equal to True
            • Then - Actions
              • Unit - Unpause blacksun_caster
              • Unit - Turn collision for blacksun_caster Off
              • Unit - Order blacksun_caster to Move To (Position of blacksun_target)
              • Wait until ((Distance between (Position of blacksun_target) and (Position of blacksun_caster)) Less than or equal to 80.00), checking every 0.10 seconds
              • Unit Group - Remove blacksun_target from blacksun_group[0]
              • Unit - Move blacksun_caster instantly to (Position of blacksun_target)
              • Unit - Cause blacksun_caster to damage blacksun_target, dealing 9999999.00 damage of attack type Spells and damage type Normal
              • Unit - Pause blacksun_caster
              • Unit - Create 1 Dummy for (Owner of blacksun_caster) at (Position of blacksun_target) facing (Random angle) degrees
              • Animation - Change (Last created unit)'s size to (25.00%, 100.00%, 100.00%) of its original size
              • Unit - Add Black sun dummy (afterkill) to (Last created unit)
              • Unit - Add Specter form (dash) to (Last created unit)
              • Unit Group - Add (Last created unit) to blacksun_group[1]
              • Custom script: set udg_blacksun_target = null
            • Else - Actions
              • Set blacksun_target = (Random unit from blacksun_group[0])
        • Else - Actions
          • Unit - Unpause blacksun_caster
          • Special Effect - Destroy blacksun_effect[0]
          • Trigger - Turn on Black sun 3 <gen>
          • Countdown Timer - Start Timer[0] as a One-shot timer that will expire in 0.10 seconds
          • Trigger - Turn off (This trigger)
  • Black sun 3
    • Events
      • Time - Timer[0] expires
    • Conditions
    • Actions
      • Camera - Set (Owner of blacksun_caster)'s camera Distance to target to 2500.00 over 0.50 seconds
      • Unit - Order blacksun_caster to Move To blacksun_caster_point
      • Wait until ((Distance between blacksun_caster_point and (Position of blacksun_caster)) Less than or equal to 50.00), checking every 0.10 seconds
      • Trigger - Turn off Specter dash <gen>
      • Unit - Hide blacksun_caster
      • Unit - Create 1 Specter Shimmy (air) for (Owner of blacksun_caster) at blacksun_caster_point facing Default building facing degrees
      • Set blacksun_dummy[0] = (Last created unit)
      • Animation - Change blacksun_dummy[0] flying height to 2500.00 at 2000.00
      • Wait 0.50 game-time seconds
      • Trigger - Turn on Black sun 4 <gen>
      • Special Effect - Create a special effect at blacksun_caster_point using war3mapImported\Eclipse2.mdx
      • Set blacksun_effect[1] = (Last created special effect)
      • Wait (1.30 + (0.15 x (Real(blacksun_count)))) game-time seconds
      • Animation - Change blacksun_dummy[0] flying height to 0.00 at 3000.00
      • Unit - Create 1 Dummy for (Owner of blacksun_caster) at blacksun_caster_point facing Default building facing degrees
      • Animation - Change (Last created unit)'s size to (220.00%, 100.00%, 100.00%) of its original size
      • Unit - Add Black sun final to (Last created unit)
      • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Wait 0.30 game-time seconds
      • Unit - Remove blacksun_dummy[0] from the game
      • Unit - Unhide blacksun_caster
      • Selection - Select specter for (Owner of specter)
      • Camera - Reset camera for (Owner of blacksun_caster) to standard game-view over 1.00 seconds
      • Unit Group - Pick every unit in (Units within 900.00 of blacksun_caster_point matching ((((Matching unit) is A structure) Not equal to True) and ((Unit-type of (Matching unit)) Not equal to Specter Shimmy (air)))) and do (Actions)
        • Loop - Actions
          • Unit - Cause blacksun_caster to damage (Picked unit), dealing (100.00 x (Real(blacksun_count))) damage of attack type Magic and damage type Normal
      • Special Effect - Destroy blacksun_effect[0]
      • Special Effect - Destroy blacksun_effect[1]
      • Unit - Remove Specter form (dash) from blacksun_caster
      • Unit - Add Specter form (Aura) to blacksun_caster
      • Unit - Remove Specter slide dummy buff from blacksun_caster
      • Unit - Set level of Specter slide for blacksun_caster to (Level of Blink (Shimmy) for specterform_caster)
      • Trigger - Turn on Specter dash <gen>
      • Custom script: call RemoveLocation(udg_blacksun_caster_point)
      • Custom script: set udg_blacksun_caster = null
      • Custom script: set udg_blacksun_dummy[0] = null
      • Custom script: call DestroyGroup (udg_blacksun_group[0])
      • Custom script: call DestroyGroup (udg_blacksun_group[1])
      • Wait 2.00 game-time seconds
      • Cinematic - Fade in over 0.80 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 40.00% transparency
      • Trigger - Turn off (This trigger)
  • Black sun 4
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of blacksun_group[1] are dead) Not equal to True
        • Then - Actions
          • Set blacksun_dummy[1] = (Random unit from blacksun_group[1])
          • Unit - Order blacksun_dummy[1] to Neutral - Firebolt blacksun_dummy[0]
          • Unit - Add a 0.02 second Generic expiration timer to blacksun_dummy[1]
          • Custom script: set udg_blacksun_dummy[1] = null
        • Else - Actions
          • Custom script: set udg_blacksun_dummy[1] = null
          • Trigger - Turn off (This trigger)
I can't garantee it's leak-less.

I am really not able to guess how to make it MUI, that's why I'm seeking for your help.
I thank you in advance.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Here's some generic advice to help.

One, for MUI you should get rid of Wait commands and replace them with timers. For complicated triggers you can make your own custom timers like this:

Make a repeating trigger that repeats every .1 seconds.

Make two arrayed variables:
1. TimeToNextOrder - a real variable that stores how much time a unit waits until the next stage of the spell takes place.
2. NextOrder - an integer variable that stores what to do next to the unit casting the spell. You'll have to use your own code, e.g. "1 = starting the spell" "2 = finding the units that will be killed" "3 = locking camera and beginning attacks", etc.

The trigger should work like this. Ever .1 seconds the repeating trigger sets TimeToNextOrder = TimeToNextOrder - .1 for every unit casting the spell. If TimeToNextOrder for that unit now equals 0, the repeating trigger will fire the trigger associated with that unit's NextOrder.

I'll give an example. Bob casts your spell. In the initial trigger you'll need to find his array position in the group of units that are casting the spell. Let's say 3. Then set blacksun_caster[3] = bob. Set blacksun_caster_point[3] = bob's position...and so on. But then, rather than waiting for .4 seconds, set TimeToNextOrder[3] = .4, and NextOrder[3] = 2.

Then, as the periodic trigger fires, it will go through all the units casting that spell and reduce their "TimeToNextOrder" variable until it reaches 0. When it reaches 0, the periodic trigger then has a series of If-Then statements, one of which is "If NextOrder[*] = 2 then Run Trigger Second Step" or whatever. Trigger Second Step will then Set the Specter slider to 14, pick all the units in that area and put them in your unit group (which will now need to be an array of course) and so on.

This system basically allows you to avoid timers. You will need to remove all leaks though.

I hope this all makes some sense, there's a lot of details left out of course. Let me know if you have questions.
 
Level 13
Joined
Dec 21, 2010
Messages
541

  • BS Init
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Black sun
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • BS_Mui[0] Equal to 0
      • Then - Actions
        • Trigger - Turn BS_Delay <gen> on
      • Else - Actions
    • Set BS_Mui[0] = BS_Mui[0] + 1
    • Set BS_Mui[1] = BS_Mui[1] + 1
    • Set BS_Caster[udg_BS_Mui[1]] = (Triggering unit)
    • Set BS_Caster_Point[0] = (Position of BS_Caster[udg_BS_Mui[1]])
    • Unit - Pause BS_Caster[udg_BS_Mui[1]]
    • Special Effect - Create a special effect at BS_Caster_Point[0] using war3mapImported\Eclipse1.mdx
    • Set BS_Effect[BS_Mui[1]] = (Last created special effect)
    • Set BS_Delay[udg_BS_Mui[1]] = 0.40
    • Custom script: call RemoveLocation (udg_BS_Caster_Point[0])

  • BS Delay
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (BS_Mui[2]) from 1 to (BS_Mui[1]), do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • BS_Delay[udg_BS_Mui[2]] Greater than 0.00
        • Then - Actions
          • Set BS_Delay[udg_BS_Mui[2]] = BS_Delay[udg_BS_Mui[2]] - 0.03
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BS_Delay[udg_BS_Mui[2]] Less than or Equal to 0.00
            • Then - Actions
              • Set BS_Delay[udg_BS_Mui[2]] = 0.00
              • Unit - Set level of Specter slide for BS_Caster[udg_BS_Mui[2]] to 14
              • Set BS_Caster_Point[1] = (Position of BS_Caster[udg_BS_Mui[2]])
              • Set BS_Group[udg_BS_Mui[2]] = (Random 1 Units within 900.00 of BS_Caster_Point[1] matching (((((Matching unit) is A Hero) Not equal to True) and (((Matching unit) is Alivel) equal to True)) and ((Matching unit) belongs to enemy of BS_Caster[udg_BS_Mui[2]]))
              • -------- 2nd Delay -------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CS_Mui[0] Equal to 0
                • Then - Actions
                  • Trigger - Turn BS_Delay2 <gen> on
                • Else - Actions
              • Set CS_Mui[0] = CS_Mui[0] + 1
              • Set CS_Mui[1] = CS_Mui[1] + 1
              • Set CS_Caster[udg_CS_Mui[1]] = BS_Caster[udg_BS_Mui[2]]
              • Set CS_Delay[udg_CS_Mui[1]] = 1.80
              • Set BS_Caster[udg_BS_Mui[2]] = No Unit
              • Unit Group - Pick every unit in BS_Group[udg_BS_Mui[2]] and do (Actions)
                • Loop - Actions
                  • Set CS_Target[udg_CS_Mui[1]] = (Picked Unit)
              • Set CS_Count[udg_CS_Mui[1]] = (Number of units in BS_Group[udg_BS_Mui[2]])
              • Custom script: call RemoveLocation (udg_BS_Caster_Point[1])
              • Custom script: call DestroyGroup (udg_BS_Group[udg_BS_Mui[2]])
              • Set BS_Mui[0] = BS_Mui[0] - 1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BS_Mui[0] Equal to 0
                • Then - Actions
                  • Trigger - Turn off this trigger
                  • Set BS_Mui[0] = 0
                  • Set BS_Mui[1] = 0
                • Else - Actions
            • Else - Actions
        • Else - Actions



  • BS Delay2
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (CS_Mui[2]) from 1 to (CS_Mui[1]), do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CS_Delay[udg_CS_Mui[2]] Greater than 0.00
        • Then - Actions
          • Set CS_Delay[udg_CS_Mui[2]] = CS_Delay[udg_CS_Mui[2]] - 0.03
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CS_Delay[udg_CS_Mui[2]] Less than or Equal to 0.00
            • Then - Actions
              • Camera - Lock camera target for (Owner of CS_Caster[udg_CS_Mui[2]]) to CS_Caster[udg_CS_Mui[2]], offset by (0.00, 0.00) using Default rotation
              • Camera - Set (Owner of CS_Caster[udg_CS_Mui[2]])'s camera Distance to target to 550.00 over 0.50 seconds
              • Unit - Unpause CS_Caster[udg_CS_Mui[2]]
              • Set CS_Delay[udg_CS_Mui[2]] = 0.00
              • -------- 3rd Delay -------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DS_Mui[0] Equal to 0
                • Then - Actions
                  • Trigger - Turn BS_Delay3 <gen> on
                • Else - Actions
              • Set DS_Mui[0] = DS_Mui[0] + 1
              • Set DS_Mui[1] = DS_Mui[1] + 1
              • Set DS_Caster[udg_DS_Mui[1]] = CS_Caster[udg_CS_Mui[2]]
              • Set DS_Target[udg_DS_Mui[1]] = CS_Target[udg_CS_Mui[2]]
              • Set CS_Caster[udg_CS_Mui[2]] = No Unit
              • Set CS_Target[udg_CS_Mui[2]] = No Unit
              • Set CS_Mui[0] = CS_Mui[0] - 1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CS_Mui[0] Equal to 0
                • Then - Actions
                  • Trigger - Turn off this trigger
                  • Set CS_Mui[0] = 0
                  • Set CS_Mui[1] = 0
                • Else - Actions
            • Else - Actions
        • Else - Actions
  • BS Delay3
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions



I'm very confused in Black sun 2 I don't know whats happening in there.. especially when you use the
"
Wait until ((Distance between (Position of blacksun_target) and (Position of blacksun_caster)) Less than or equal to 80.00), checking every 0.10 seconds"
and you are making a huge leaks here because of the position of the target and the caster plus in Every 0.15 seconds of game time..

can I have the copy of the map so I can fully understand it...
 
Last edited:
Status
Not open for further replies.
Top