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

[Solved] Floating Text/Parts of Trigger Not Consistently Working?

Status
Not open for further replies.
Level 5
Joined
Dec 30, 2022
Messages
36
Hi All,

I have a trigger that displays floating text when a unit reaches a certain HP threshold as well as does a few animations on the caster:
  • D4ShadStrike
    • Events
      • Game - PreDamageEvent becomes Equal to 1.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to D4Boss
              • (Life of D4Boss) Less than or equal to ((Real((Max HP of D4Boss))) x 0.75)
              • D4BossPhase1 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to D4Boss
              • (Life of D4Boss) Less than or equal to ((Real((Max HP of D4Boss))) x 0.50)
              • D4BossPhase2 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to D4Boss
              • (Life of D4Boss) Less than or equal to ((Real((Max HP of D4Boss))) x 0.25)
              • D4BossPhase3 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to D4Boss
              • (Life of D4Boss) Less than or equal to ((Real((Max HP of D4Boss))) x 0.10)
              • D4BossPhase4 Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • D4BossPhase1 Equal to False
        • Then - Actions
          • Set VariableSet D4BossPhase1 = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • D4BossPhase2 Equal to False
            • Then - Actions
              • Set VariableSet D4BossPhase2 = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • D4BossPhase3 Equal to False
                • Then - Actions
                  • Set VariableSet D4BossPhase3 = True
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • D4BossPhase4 Equal to False
                    • Then - Actions
                      • Set VariableSet D4BossPhase4 = True
                    • Else - Actions
      • Floating Text - Create floating text that reads |cff800080Die!!!|r above D4Boss with Z offset 0.00, using font size 20.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.75 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Set VariableSet D4TempInt = (Random integer number between 1 and 2)
      • Unit - Remove All buffs from D4Boss
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • D4TempInt Equal to 1
        • Then - Actions
          • Unit - Make D4Boss face 90.00 over 0.00 seconds
          • Unit - Pause D4Boss
          • Animation - Play D4Boss's channel animation
          • Set VariableSet D4BossStrikeRegion = D4BossUpper <gen>
        • Else - Actions
          • Unit - Make D4Boss face 270.00 over 0.00 seconds
          • Unit - Pause D4Boss
          • Animation - Play D4Boss's channel animation
          • Set VariableSet D4BossStrikeRegion = D4BossLower <gen>
      • Wait 2.00 game-time seconds
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in D4BossStrikeRegion) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) controller) Equal to User
            • Then - Actions
              • Set VariableSet D4TempLoc = (Position of D4Boss)
              • Unit - Create 1 dummy_unit for (Owner of D4Boss) at D4TempLoc facing D4TempLoc
              • Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
              • Unit - Add Shadow Strike D4 Boss to (Last created unit)
              • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
            • Else - Actions
      • Unit - Unpause D4Boss
      • Custom script: call RemoveLocation(udg_D4TempLoc)
      • Custom script: call RemoveRect(udg_D4BossStrikeRegion)
It's about a 50/50 shot that the unit does the full animations and the text stays up for the 1.75 seconds, or the text flashes REALLY quickly and vanishes.. Too fast to read. Is there a leak or something I need to cover here?

Thanks for the help :)
 
Last edited:
Level 5
Joined
Dec 30, 2022
Messages
36
Possible issues:
You're reaching the limit of 100 Floating Texts in the game at once.
You're using (Last created floating text) somewhere else that's interfering with it.
Maybe something to do with the Z offset? (Doubt)
I just updated the post, seems to be an issue with a few pieces. But definitely not a "at once" or another floating text at the same time. Don't think its a Z offset thing because the when it works it works fine
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,516
Nothing is really wrong with your trigger besides a couple of minor mistakes that shouldn't cause any problems, here's a cleaned up version:
  • D4ShadStrike
    • Events
      • Game - PreDamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventTarget Equal to D4Boss
      • Or - Any (Conditions) are true
        • Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Life percentage of D4Boss) Less than or equal to 75.00
              • D4BossPhase1 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • (Life percentage of D4Boss) Less than or equal to 50.00
              • D4BossPhase2 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • (Life percentage of D4Boss) Less than or equal to 25.00
              • D4BossPhase3 Equal to False
          • And - All (Conditions) are true
            • Conditions
              • (Life percentage of D4Boss) Less than or equal to 10.00
              • D4BossPhase4 Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • D4BossPhase1 Equal to False
        • Then - Actions
          • Set VariableSet D4BossPhase1 = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • D4BossPhase2 Equal to False
            • Then - Actions
              • Set VariableSet D4BossPhase2 = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • D4BossPhase3 Equal to False
                • Then - Actions
                  • Set VariableSet D4BossPhase3 = True
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • D4BossPhase4 Equal to False
                    • Then - Actions
                      • Set VariableSet D4BossPhase4 = True
                    • Else - Actions
      • Floating Text - Create floating text that reads |cff800080Die!!!|r above D4Boss with Z offset 0.00, using font size 20.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.75 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Set VariableSet D4TempInt = (Random integer number between 1 and 2)
      • Unit - Remove All buffs from D4Boss
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • D4TempInt Equal to 1
        • Then - Actions
          • Unit - Make D4Boss face 90.00 over 0.00 seconds
          • Unit - Pause D4Boss
          • Animation - Play D4Boss's channel animation
          • Set VariableSet D4BossStrikeRegion = D4BossUpper <gen>
        • Else - Actions
          • Unit - Make D4Boss face 270.00 over 0.00 seconds
          • Unit - Pause D4Boss
          • Animation - Play D4Boss's channel animation
          • Set VariableSet D4BossStrikeRegion = D4BossLower <gen>
      • Wait 2.00 game-time seconds
      • Set VariableSet D4TempLoc = (Position of D4Boss)
      • Unit - Create 1 dummy_unit for (Owner of D4Boss) at D4TempLoc facing Default building degrees
      • Custom script: call RemoveLocation(udg_D4TempLoc)
      • Set VariableSet D4Dummy = (Last created unit)
      • Unit - Add a 0.30 second Generic expiration timer to D4Dummy
      • Unit - Add Shadow Strike D4 Boss to D4Dummy
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in D4BossStrikeRegion) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) controller) Equal to User
            • Then - Actions
              • Unit - Order D4Dummy to Night Elf Warden - Shadow Strike (Picked unit)
            • Else - Actions
      • Unit - Unpause D4Boss
The floating text looks fine. Again, either you're reaching the floating text limit, which sounds very possible if you use it a lot in your map, or somewhere you have an Action that's interacting with the (Last created floating text) without actually Creating a new one before doing so. (Last created floating text) is a global variable so it can interact with the last created text at any given moment.

My fixes:
  • I simplified the Conditions slightly to use less conditions and use Life Percentage instead of Life.
  • I simplified Dummy creation. Only one Dummy unit is needed to cast Shadow Strike on all of the nearby enemies. I also like to track Dummy units in a unit variable so you don't lose track of it. If your single Dummy unit cannot do this then you haven't set it up properly. Dummy units should be based on the Locust with the following necessary stat changes: Attacks Enabled = None, Movement Type = None, Speed Base = 0.
  • I moved the RemoveLocation() custom script so it gets removed the moment it's no longer needed. A useful habit to form when reusing variables.
  • I got rid of the RemoveRect() custom script, I don't think that's necessary.
 
Last edited:
Status
Not open for further replies.
Top