HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need a formula

09-21-2002, 12:09 AM#1
Athifos
I need a formula that changes the transparency depending on how much the unit is damaged. So far i have

max life(attacked unit) / life(atacked unit) x 100

But this can make the transparency over 100%. What I want to happen is when the unit is at full life, he is 0% transparent and att 1 hp he is 99% transparent. btw he has 500 hp
09-21-2002, 12:19 AM#2
Athifos
nevermind....found the post i saw earlier
09-21-2002, 12:29 AM#3
element_5
Voila! Here is a formula to increase the transparency % by 1 for every 1% of damage:

100 - ((life(attacked unit) / maxlife(attacked unit)) * 100)

In this case, every 5 points of damage will increase his transparency by 1%. Be caureful though, because I don't think the Editor will like Floats (decimal numbers) when dealing with Reals. Good luck, though

EDIT: Typo :o
09-21-2002, 04:57 AM#4
dataangel
Floats = Reals to war3 ;)