• 🏆 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] How to know the percentage of a variable's value?

Status
Not open for further replies.
Level 6
Joined
May 13, 2013
Messages
111
Hello guys, been a long time.. I need help to one of my triggers. I'll explain to you the problem..
I''ve created a trigger that if the player types -g it will show the progress of the unit's growth to the next level... It should appear like this: "Growth Progress: 23/300"
But I want to show the percentage of the the current number from the target number. But it shows this: Growth Progress: 23/300 - 0.001%
I know that it is not its percentage but 7% should appear instead of 0.001%.. I really need everyone's help on this one
 
Here you go, let me know if you have any further questions.
[trigger=]
finding percentage of a vairables value
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Set number = 23
Set number2 = 300
Set number3 = ((Real(number)) / (Real(number2)))
Game - Display to (All players) the text: (String(number3))
Set number = 100
Set number3 = (number3 x (Real(number)))
Game - Display to (All players) the text: ((String((Integer(number3)))) + %)

[/trigger]
 
Level 6
Joined
May 13, 2013
Messages
111
Here you go, let me know if you have any further questions.
[trigger=]
finding percentage of a vairables value
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Set number = 23
Set number2 = 300
Set number3 = ((Real(number)) / (Real(number2)))
Game - Display to (All players) the text: (String(number3))
Set number = 100
Set number3 = (number3 x (Real(number)))
Game - Display to (All players) the text: ((String((Integer(number3)))) + %)

[/trigger]

This one works :) Thanks a lot +rep.. This now solved my problem..:grin:
 
Status
Not open for further replies.
Top