• 🏆 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] Cast Bar, Trigger help.

Status
Not open for further replies.
Level 3
Joined
Aug 21, 2009
Messages
73
Hey I am having some problems with FLoating Text GUI or MUI idk, atleast so it works for several units at the same time. I'll post the triggers and hopefully, some of you can help me see what's wrong. I have tried to make a castbar. I was very happy when I saw it worked very well for 1 unit. But then, when I tried with 2 units it didn't work. and after working a bit on it I didn't find a way to make it work for several units.
Trigger who launches at ability cast.

  • Frost Bolt CB
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Frost Bolt
    • Actions
      • Set CBt_Duration = 5.00
      • Set CBt_Caster = (Triggering unit)
      • Set CBt_SpellName = (Name of (Ability being cast))
      • Trigger - Run Get Cast Bar Trigger <gen> (checking conditions)
The trigger who "gathers" the info about the spell casted
  • Get Cast Bar Trigger
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CB_Integer[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Cast Bar Loop <gen>
        • Else - Actions
      • Set CB_Integer[1] = (CB_Integer[1] + 1)
      • Set CB_Integer[2] = (CB_Integer[2] + 1)
      • Set CB_Intervals[CB_Integer[2]] = (CBt_Duration / 20.00)
      • Set CB_Duration[CB_Integer[2]] = CBt_Duration
      • Set CB_Caster[CB_Integer[2]] = CBt_Caster
      • Set CB_IntervalReal[CB_Integer[2]] = (CB_Intervals[CB_Integer[2]] / 0.01)
      • Set CB_SpellName[CB_Integer[2]] = CBt_SpellName
      • Set CB_TextSet[CB_Integer[2]] = 0.00
And the loop.

  • Cast Bar Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer CB_Integer[3]) from 1 to CB_Integer[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CB_TextSet[CB_Integer[3]] Equal to 0.00
            • Then - Actions
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads I above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Floating Text - Create floating text that reads ... above CB_Caster[CB_Integer[3]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Set CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] = (Last created floating text)
              • Set CB_FloatinInteger[CB_Integer[3]] = (CB_FloatinInteger[CB_Integer[3]] + 1)
              • Set CB_TextSet[CB_Integer[3]] = 1.00
              • Floating Text - Create floating text that reads (Casting: + CB_SpellName[CB_Integer[3]]) above CB_Caster[CB_Integer[3]] with Z offset 40.00, using font size 8.00, color (100.00%, 30.00%, 30.00%), and 0.00% transparency
              • Set CB_FloatingTextSpellBeingCaste[CB_Integer[3]] = (Last created floating text)
              • (String(CB_FloatinInteger[CB_Integer[3]]))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CB_Caster[CB_Integer[3]] Not equal to No unit
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (CB_Caster[CB_Integer[3]] is dead) Equal to True
                    • Then - Actions
                      • Game - Display to (All players) the text: wtf
                      • Set CB_Caster[CB_Integer[3]] = No unit
                      • Set CB_Integer[1] = (CB_Integer[1] - 1)
                      • Set CB_FinishCounter[CB_Integer[3]] = 0.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CB_Integer[1] Equal to 0
                        • Then - Actions
                          • Set CB_Integer[2] = 0
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CB_ReachedInterval[CB_Integer[3]] Greater than or equal to CB_IntervalReal[CB_Integer[3]]
                        • Then - Actions
                          • Set CB_FinishCounter[CB_Integer[3]] = (CB_FinishCounter[CB_Integer[3]] + 1.00)
                          • Set CB_ReachedInterval[CB_Integer[3]] = 0.00
                          • Floating Text - Change the color of CB_FloatingText[(Integer(CB_FinishCounter[CB_Integer[3]]))] to (0.00%, 100.00%, 0.00%) with 0.00% transparency
                          • -------- ------------------------------------------------ --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • CB_FinishCounter[CB_Integer[3]] Greater than or equal to 22.00
                            • Then - Actions
                              • Floating Text - Change CB_FloatingTextSpellBeingCaste[CB_Integer[3]]: Disable permanence
                              • Floating Text - Change the fading age of CB_FloatingTextSpellBeingCaste[CB_Integer[3]] to 1.00 seconds
                              • Floating Text - Change the lifespan of CB_FloatingTextSpellBeingCaste[CB_Integer[3]] to 1.50 seconds
                              • For each (Integer CB_FloatinInteger[CB_Integer[3]]) from 1 to 20, do (Actions)
                                • Loop - Actions
                                  • Floating Text - Change CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]]: Disable permanence
                                  • Floating Text - Change the fading age of CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] to 1.00 seconds
                                  • Floating Text - Change the lifespan of CB_FloatingText[CB_FloatinInteger[CB_Integer[3]]] to 1.50 seconds
                              • Set CB_FloatinInteger[CB_Integer[3]] = 0
                              • Set CB_ReachedInterval[CB_Integer[3]] = 0.00
                              • Set CB_Caster[CB_Integer[3]] = No unit
                              • Set CB_Integer[1] = (CB_Integer[1] - 1)
                              • Set CB_FinishCounter[CB_Integer[3]] = 0.00
                              • Set CB_TextSet[CB_Integer[3]] = 0.00
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • CB_Integer[1] Equal to 0
                                • Then - Actions
                                  • Set CB_Integer[2] = 0
                                  • Trigger - Turn off (This trigger)
                                • Else - Actions
                            • Else - Actions
                        • Else - Actions
                          • Set CB_ReachedInterval[CB_Integer[3]] = (CB_ReachedInterval[CB_Integer[3]] + 1.00)
                • Else - Actions

Leaks and tips is very appreciated.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
1. Change the inxeding system - this one is too old, and inefficient. Make use of Hanky's indexing system/Bribe's Indexer.
2. There is ton of casting bar's templates in spell section - you can learn from them.
3. DONT NEVER/EVER (whatever) create casting bar via spamming - create text that reads message: 'I'. In your script loop for those actions is life saver BUT
BUT BUT BUT better create one FT that reads whole casting bar message and just change the color of given substrings.

Furthermore.. You can have only 100 floating texts at a time ^^ good luck!
 
Status
Not open for further replies.
Top