PDA

View Full Version : HP Bars...


projectigi
01-09-2007, 11:23 PM
Hi,

I'm trying to make a Health Bar :P
Well
a) is there a way to hide serv-side shown images(index under 100 or something like this) from certain players?
b) how much would it lag if ~50% of the players would change one of their attr vars every 0.05 secs?
c) how much would it lag if ~80% of the players would read a attr var of ~25% of the players every 0.05 secs?

Admins
01-09-2007, 11:29 PM
Why do you need to change it each 0.05 seconds? Most hp-bar system just set the attr(s) when the hp is changing, and some gani script is then displaying it
(one attr for the gani script, one for the value to display)

projectigi
01-09-2007, 11:48 PM
Well the HP Bar only shows if you hover on the player
Now this wouldnt be a Problem
but i want to have 2 bars
You know Like the curretn bar is



<=================>

= means first bart
- means seconds bar
_ mean empty

now it player gets hurt so it would be like this
<==============___>
but i want it like this:
<==============--->
<==============--_>
<==============-__>
<==============___>

now the prob is when rehovering the old info gets deleted :P
So either that second bar has to be saved in the attr string, then it would be needed to modify that string every 0.05 secs to make it decreasing

or i will make an object/array holding the information of the hp bars that were gathered while hovering and after the decreasing/whatever finished the info gets deleted(would require reading out the new player data, so read-access on the attr vars of all players that are in the array)

OR writing it in the attr var itself(read/write access from the player to change his/her own attr var)

and if there are any other ways to do this, please tell me :x

Angel_Light
01-10-2007, 12:52 AM
It could be almost lagless if your using a graal gui. If you use clientr.foo it wont lag if you update 0.05 also.

napo_p2p
01-10-2007, 03:09 AM
It could be almost lagless if your using a graal gui. If you use clientr.foo it wont lag if you update 0.05 also.

He wants other people to be able to see the bar when they hover their mouse. I am pretty sure you can't read other people's client(r). flags clientside. Plus, updating 0.05 serverside isn't a nice idea ...

cheatbobb
01-10-2007, 03:41 AM
a) Have a gani script always active, but only show the information if the mouse is in the right position.
b) It hasn't created any lag in my experience, but I haven't had the chance to try with many players at once.
c) Reading variables shouldn't create lag, as they're readily accessible and you don't have to "request" them or anything. Looping through all the players would give you as much lag as a custom chat system would, namely about none. If reading them does actually take a "request" or whatever, then the answer to b) would most likely be none.

projectigi
01-10-2007, 06:57 PM
huh
what exactly do you mean by that

Falcor
01-11-2007, 12:02 AM
huh
what exactly do you mean by that

He means, put a script in a gani to show the HP bar, but only show the images when the mouse is over the player.. EG



...

function update_bar() { ...some code to draw the HP Bars... }
function hide_bar() { ...some code to hide the HP Bars... }
function onTimeout() {
if(... some code to check if the mouse is on the player...) {
update_bar();
} else {
hide_bar();
}
setTimer(0.05);
}

...