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

Is it possible to convert a real value to an integer for displaying in a string?

Status
Not open for further replies.
Level 5
Joined
May 20, 2008
Messages
138
What the title says really. I'm making a system with floating combat text and obviously the (Damage taken) event response is a Real value since String((Damage taken)) displays a value with three decimals, like 100.000.

  • Floating Text - Create floating text that reads (String((Damage taken))) above (Triggering unit) with Z offset -50.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Is it possible to make this number show up in the floating text as an integer value ("100"), since all those unecessary 0:s makes the text harder to read. I'd really just want the damage to be displayed without any decimals.

Thanks for any help :)
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
  • Floating Text - Create floating text that reads (String((Integer((Damage taken))))) above (Triggering unit) with Z offset -50.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Do it like that ^
First use function to convert Integer to String,and for the integer,use convert Real to Integer,and the Real is Damage Taken.
Or for better understanding: Convert damage taken (Real) to Integer,and convert Integer to String.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
first you must set the value of your Damage taken

  • Set Damage Taken = (damage amount)
  • Floating Text - Create floating text that reads (String((Damage taken))) above (Triggering unit) with Z offset -50.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - set last created floating text permanace to disable
  • Floating Text - change last created floating text lifespan to (whatever #of seconds you want)
 
Status
Not open for further replies.
Top