• 🏆 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] Floating Text randomly doesn't display

Status
Not open for further replies.
Level 28
Joined
Mar 25, 2008
Messages
2,955
So, the following snippet is supposed to randomly pick a point on the map and create units accompanied by a floating text.
Creating units works fine but the FText doesn't work for all of them (sometimes 3, sometimes 4) although it's the exact same "code".
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 2) Equal to 1
      • Then - Actions
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set aura_rnd_pkt = (Random point in region bla <gen>)
            • Unit - Create 1 +MS Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
            • Floating Text - Create floating text that reads |cFF8080C0+Movement... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Set aura_textms[(Integer A)] = (Last created floating text)
            • Floating Text - Show aura_textms[(Integer A)] for (All players)
            • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
      • Else - Actions
        • Set aura_rnd_pkt = (Random point in region bla <gen>)
        • Unit - Create 1 +MS Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
        • Floating Text - Create floating text that reads |cFF8080C0+Movement... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set aura_textms[0] = (Last created floating text)
        • Floating Text - Show aura_textms[0] for (All players)
        • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 2) Equal to 1
      • Then - Actions
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set aura_rnd_pkt = (Random point in region bla <gen>)
            • Unit - Create 1 -AS Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
            • Floating Text - Create floating text that reads |cFF8080C0-Attack S... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Set aura_textas[(Integer A)] = (Last created floating text)
            • Floating Text - Show aura_textas[(Integer A)] for (All players)
            • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
      • Else - Actions
        • Set aura_rnd_pkt = (Random point in region bla <gen>)
        • Unit - Create 1 -AS Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
        • Floating Text - Create floating text that reads |cFF8080C0-Attack S... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set aura_textas[0] = (Last created floating text)
        • Floating Text - Show aura_textas[0] for (All players)
        • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 2) Equal to 1
      • Then - Actions
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set aura_rnd_pkt = (Random point in region bla <gen>)
            • Unit - Create 1 -ATK Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
            • Floating Text - Create floating text that reads |cFF8080C0-Attack D... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Set aura_textatk[(Integer A)] = (Last created floating text)
            • Floating Text - Show aura_textatk[(Integer A)] for (All players)
            • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
      • Else - Actions
        • Set aura_rnd_pkt = (Random point in region bla <gen>)
        • Unit - Create 1 -ATK Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
        • Floating Text - Create floating text that reads |cFF8080C0-Attack D... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set aura_textatk[0] = (Last created floating text)
        • Floating Text - Show aura_textatk[0] for (All players)
        • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 2) Equal to 1
      • Then - Actions
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set aura_rnd_pkt = (Random point in region bla <gen>)
            • Unit - Create 1 +HP Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
            • Floating Text - Create floating text that reads |cFF8080C0+HP Regen... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Set aura_texthp[(Integer A)] = (Last created floating text)
            • Floating Text - Show aura_texthp[(Integer A)] for (All players)
            • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
      • Else - Actions
        • Set aura_rnd_pkt = (Random point in region bla <gen>)
        • Unit - Create 1 +HP Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
        • Floating Text - Create floating text that reads |cFF8080C0+HP Regen... at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set aura_texthp[0] = (Last created floating text)
        • Floating Text - Show aura_texthp[0] for (All players)
        • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 2) Equal to 1
      • Then - Actions
        • For each (Integer A) from 1 to 2, do (Actions)
          • Loop - Actions
            • Set aura_rnd_pkt = (Random point in region bla <gen>)
            • Unit - Create 1 +AR Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
            • Floating Text - Create floating text that reads |cFF8080C0+Armor|r at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Set aura_textarmor[(Integer A)] = (Last created floating text)
            • Floating Text - Show aura_textarmor[(Integer A)] for (All players)
            • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
      • Else - Actions
        • Set aura_rnd_pkt = (Random point in region bla <gen>)
        • Unit - Create 1 +AR Aura for Player 12 (Brown) at aura_rnd_pkt facing Default building facing degrees
        • Floating Text - Create floating text that reads |cFF8080C0+Armor|r at aura_rnd_pkt with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set aura_textarmor[0] = (Last created floating text)
        • Floating Text - Show aura_textarmor[0] for (All players)
        • Custom script: call RemoveLocation(udg_aura_rnd_pkt)
My skills are very very rusty and I may be just blind but I'm thankful for anyone able to point out how it works.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I don't know how many floating texts you have in total, but you can only have 99 or 100 in the map at the same time. Can't remember if it is per player or the total number. If you are facing this issue, try creating the texts locally only for the players that need to see it.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I had a similar issue with floating text. It seems like it doesn't draw it for the player if their screen is not nearby. I don't know the exact problem since I went with a different solution afterwards. I didn't solve the problem either, but at least this may give some insight.

I may look into it later tonight if no solution is found yet.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
One way is to recreate the floating text.



I've made text "follow" a unit in a spell I made but never encountered particular issues with it. I just make sure the floating text is destroyed before it reposition again at certain interval.

My trigger example redraws the floating text at short intervals.
  • Text Movement
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FloatTextGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_Temp_Integer = GetCustomIntValue (GetEnumUnit())
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Integer Greater than 0
            • Then - Actions
              • For each (Integer A) from 1 to IndexCount, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UnitTextIndex[(Integer A)] Equal to (Picked unit)
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has buff Protective Shield ) Equal to False
                        • Then - Actions
                          • Custom script: call SetCustomIntValue(GetEnumUnit(), 0)
                          • Floating Text - Destroy FloatText[(Integer A)]
                          • Set UnitTextIndex[(Integer A)] = No unit
                          • Unit Group - Remove (Picked unit) from FloatTextGroup
                        • Else - Actions
                          • Floating Text - Destroy FloatText[(Integer A)]
                          • Set Temp_Real = (Real(Temp_Integer))
                          • Floating Text - Create floating text that reads (+ + ((String((Integer(Temp_Real)))) + HP)) above UnitTextIndex[(Integer A)] with Z offset 40.00, etc...
                          • Floating Text - Change FloatText[(Integer A)]: Disable permanence
                          • Floating Text - Change the lifespan of FloatText[(Integer A)] to 0.20 seconds
                          • Set FloatText[(Integer A)] = (Last created floating text)
                    • Else - Actions
            • Else - Actions
              • Unit Group - Remove (Picked unit) from FloatTextGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FloatTextGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
132929-albums8269-picture99651.jpg

But I don't know rest of your triggers. Hope this helps a bit. But my example isn't point related but unit related.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Another issue just popped up with a floating text... really... floating - on the map; it popped up a few hundred (600 or so) distance units left to where it was supposed to be created.
I'll try arraying the point variable (cause why not) and check back if the issue's still present I guess.
 
Status
Not open for further replies.
Top