size dependence on health
#1

Hello,

could anyone tell me how could I make such thing:

I've got a textdraw box which size is 601 when the vehicle health is 1000.
The box size should keep getting smaller as the vehicle health is going down.
The minimum size that the box can go down is from 601 to 541.

Now I've done this,

I subtracted max from min ( 601 - 541 ) and received 60.

According to me, 250/60=0.24 < 250 is the vehicle health as I consider it 0. The 0.24 should be the multipler that the box size should stick to and go down, in other words:

601(Box size) - ((1000maximum vehicle health - Current vehicle health) * 0.24 )

This results 601-60 only when vehicle health is 250, it reduces the box size more than 60 whenever it's above 250.. Can anyone tell me whats' wrong?
Reply
#2

Ahh, I really can't understand when you like to write in such I'd call diplomatic writing, can you tell me this in other, for me understandable words. I am not familiar with English so well..
Reply
#3

I've tried searching "operator precedence" in ******, but all I found was basic known functions or commands used in programming.


EDIT: I've tried doing another way, I've received almost accurate numbers : 0.0363754771135975 . But the problem is that the bar is going down too slow. I've remember doing this calculation in the past, I've re-done the formula and re-calculated the answer in another script I've done in past and the numbers matched.. tho, I'm still not sure why the bar goes down a little bit slower than it should go.
Reply
#4

help
Reply
#5

****** gave me an advice to use his y_zonepulse code, but can anyone tell me how do I match it to my vehicle health settings?

pawn Код:
r = ((to >>> 24) - (from >>> 24)) * stage / time + (from >>> 24),
            g = ((to >>> 16 & 0xFF) - (from >>> 16 & 0xFF)) * stage / time + (from >>> 16 & 0xFF),
            b = ((to >>> 8 & 0xFF) - (from >>> 8 & 0xFF)) * stage / time + (from >>> 8 & 0xFF),
I know with what I'd need to replace to and from, but what about stage and time? I've fixed the size box I was talking about earlier, but a similar thing I need to colors now.

Red must go from 25 to 235
Green must go from 158 to 17
Reply
#6

So basically:

pawn Код:
carred[carid] = ((235 >>> 24) - (25 >>> 24)) * vHealth[carid] / 1000 + (25 >>> 24);
?

Tho, i get a tag mismatch because of the carred[carid] it is defined as:

new carred[MAX_VEHICLES];
Reply
#7

It prints me those variables as 0, I've only added floatround around vHealth[carid], what could be wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)