• Hey! Register here to create your account, engage with the community, and talk about what is new!

Variable problem

Fghj240

Active member
Joined
Jun 5, 2021
Messages
53
Reaction score
8
I want to add a cooldown in my game shown in the actionbar. After unlocking the code thing I added it to my game. How it works is when you click/shift click if the variable %default is below 0, it fires the projectile and sets the %default variable to above 0, and it slowly ticks down. Cool, right?

so it started getting tricky when I wanted to add a cooldown to a "shadowstep" ability. how it works is you have fly perms, then you start flying and it takes off your armor and makes you invis and plays a sound and all that stuff, then 60 ticks later it puts all that back on, stops your fly, takes away your fly perms, and sets the variable %defaultflycd to a high number. When that variable ticks all the way down you get your fly perms back.

Now the problem I'm having is the cooldown should only START when the ability ends, you don't want it ticking down early, but at the same time, I want the action bar to show that the ability is unusable as soon as you activate it, because obviously you can't use the ability if you are already using it.

I created a variable called %defaultflycdfake, and made it get set to a high number as soon as you start the ability, then it starts ticking down but it's higher than the %defaultflycd variable so that they match up once %defaultflycd starts ticking down as well. This meansthat if %defaultflyd is >= 0, I can display the cooldown as ready to activate, and if it's above 0, I can display it as not ready to use.

The problem is it ALWAYS displays as ready to use. I tried debugging by placing sendchatmessage with the variable inside it and the wierd thing is that I have a block of code (quintiple-checked) that sets a new variable, called "display %defaultflycd" to a red X if the variable is above 0.... and the send chat message block TELLS me it's above 0.... but the action bar still says green check. It's not an update problem since the action bar ALSO displays a cooldown for another ability and that one works perfectly. The action bar also updates every tick.

Does anyone know what's going on? If you wanna check it out yourself you're welcome to do so.
 
Top Bottom