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

MUI Spell Help

Status
Not open for further replies.
Level 4
Joined
Oct 11, 2008
Messages
90
I have an ability that temporary decreases a hero's strength by -10.

  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Curse
  • Actions
    • Set Targetunit = Target unit of ability being cast
    • Hero - Modify Strength of TargetUnit: Substract 10
    • Wait 15.00 seconds
    • Hero - Modify Strength of TargetUnit: Add 10
But this ability can be cast by many heroes and it's not MUI, so it can lead a hero even to 0 Strength. Can anyone help me MUI this spell?

+rep to helper
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Stst Reduce Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Debuff
    • Actions
      • Set Temp_Integer_2 = 5
      • Set Temp_Integer_1 = (Load (Key time) of (Key (Target unit of ability being cast)) from Stat_Reduce_Hash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in Stat_Reduce_Group) Equal to False
        • Then - Actions
          • Hero - Modify Strength of (Target unit of ability being cast): Subtract 10
          • Unit Group - Add (Target unit of ability being cast) to Stat_Reduce_Group
        • Else - Actions
      • Hashtable - Save Temp_Integer_2 as (Key time) of (Key (Target unit of ability being cast)) in Stat_Reduce_Hash
  • Stat Reduce Group
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Stat_Reduce_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Integer_1 = (Load (Key time) of (Key (Picked unit)) from Stat_Reduce_Hash)
          • Set Temp_Integer_1 = (Temp_Integer_1 - 1)
          • Floating Text - Create floating text that reads (String(Temp_Integer_1)) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Hashtable - Save Temp_Integer_1 as (Key time) of (Key (Picked unit)) in Stat_Reduce_Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Integer_1 Equal to 0
            • Then - Actions
              • Floating Text - Create floating text that reads Buff off above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
              • Unit Group - Remove (Picked unit) from Stat_Reduce_Group
              • Hero - Modify Strength of (Picked unit): Add 10
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Stat_Reduce_Hash
            • Else - Actions
The effect does not stack with this method, but the duration resets with each cast. In this spell the reduction is 10, so the attribute won't be reduced by 20 if the spell is cast on the unit twice. If there's one second for example left on the timer, it will go back to the original duration if the spell is cast again.

The duration here is about five seconds due to the one second update rate. You can increase the accuracy by decreasing the update rate. You must also use Temp_real instead of Temp_int to store the time. If you halve the update rate, you must double the time decrement and so on.
 
Status
Not open for further replies.
Top