Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
So i'm using this: GenericBar
The GenericBar has 100 animations, Animation Index 0 representing an empty bar and Index 100 representing a full bar.
And i'm using it in my map to represent how long you must wait before you can take an action. The bar fills up over time and once it reaches 100% you are able to do something (it's turn-based and turns work like the Final Fantasy games).
I have the bar working just fine using the code below. This function runs once every 0.01 seconds:
Now how would I go about adjusting this to take into consideration increases and decreases to the rate at which the bar fills up (i'm calling it CdRate, short for Cooldown Rate).
For example, let's say I want the Cast Bar to fill up from 0 to 100% over 1.00 second by default.
Then I increase CdRate by 20% -> The Cast Bar now fills to 100% over 0.80 seconds.
Any ideas on how to make this work properly? How can I apply that to the Animation Index?
Also, I wanted to use a formula like this to determine the time that it takes for the bar to fill:
(BaseCd / (1 + CdRate)
CdRate would be equal to 0.00 by default, and increase by 0.01 for every 1% increase and decrease by 0.01 for every 1% decrease.
The part I struggle with is getting the Cast Bar (GenericBar) to reflect this using it's Animation Index.
Thanks for taking the time to read this!
The GenericBar has 100 animations, Animation Index 0 representing an empty bar and Index 100 representing a full bar.
And i'm using it in my map to represent how long you must wait before you can take an action. The bar fills up over time and once it reaches 100% you are able to do something (it's turn-based and turns work like the Final Fantasy games).
I have the bar working just fine using the code below. This function runs once every 0.01 seconds:
Lua:
function Example()
--CastBar = The unit using the GenericBar model
--Increment = Integer starting at 0 that determines the animation index of CastBar
if Increment < 100 then
Increment = Increment + 1
SetUnitAnimationByIndex(CastBar, Increment)
end
end
For example, let's say I want the Cast Bar to fill up from 0 to 100% over 1.00 second by default.
Then I increase CdRate by 20% -> The Cast Bar now fills to 100% over 0.80 seconds.
Any ideas on how to make this work properly? How can I apply that to the Animation Index?
Also, I wanted to use a formula like this to determine the time that it takes for the bar to fill:
(BaseCd / (1 + CdRate)
CdRate would be equal to 0.00 by default, and increase by 0.01 for every 1% increase and decrease by 0.01 for every 1% decrease.
The part I struggle with is getting the Cast Bar (GenericBar) to reflect this using it's Animation Index.
Thanks for taking the time to read this!
Last edited: