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

Floating Text And waits

Status
Not open for further replies.
Level 7
Joined
Mar 5, 2009
Messages
254
Hello everyone,in my map i have a craft system,but i want to make it more fun,my idea is when the hero is making item to create a floating text at the points where the hero is creating the item and show 1%,2%,3% and change this very fast so on till 100% and then show succes or fail.I know how to do this but with using 100 waits.... 1 wait for every 1%... etc start with 1%,wait 0.10 seconds and then destroy this and create another floating text with 2%.I know it is bad to use that much waits so i need another way of creating this trigger.Any ideas guys how to do this without using so many waits? I will give credit and rep.Thanks in advance :wink:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Waits are very unreliable.
You THINK you created a wait that lasts 0.10 seconds, but in truth is probably lasts 0.20 seconds or something.
And if you do want to use waits, learn how to use loops (loops are in the top-5 most useful actions in coding, really - if you don't know them, you will have a lot more trouble with triggering).

Either way, use this method:


  • Actions
    • Set Point = (Position of (Triggering unit))
    • Floating Text - Create floating text that reads 0% at Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Custom script: call RemoveLocation(udg_Point)
    • Set FloatingText = (Last created floating text)
    • Set Timer = 0
    • Trigger - Turn on Loop <gen>
Initially off!
  • Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Timer Equal to 100
        • Then - Actions
          • Floating Text - Destroy FloatingText
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set Timer = (Timer + 1)
          • Floating Text - Change text of FloatingText to ((String(Timer)) + %) using font size 10.00
 
Status
Not open for further replies.
Top