F_Damage

by Flick
Displays damage taken above a player or enemies head.
ID:91641
 
Displays damage taken above a player or enemies head. Text font may be customised with a different icon, and text colour may be customised between calls dynamically. Unlike s_damage, this library can display a large range of numbers, including numbers in scientific notation.


Version 1.0.0:

Notably, icons are cached as required. This means that on a test machine, regular calls to F_Damage to display the same color text go from taking ~20 ms every time, to ~4 ms on average, with times no worse than before. This means compared to the initial release of F_Damage in 2006, performance has been improved for all library users.


Version 1.0.1:

Added two define options:

F_damage_assume_world_size - If set, will simplify icon size calculations.

F_damage_sleep - If set, will sleep(1) in F_Damage, to help long calling procedures to progress.

The first provides a performance improvement if you don't need F_Damage to center perfectly on big icons enemies. The second helps cover you for cases where F_Damage is executed in long procedures, and users may see a delay in flicking the damage numbers.

Version 1.1.0:

Adds a define option:

F_damage_no_scientific - Turns off scientific (1E+40) notation.

Removes two define options from 1.0.1, as their performance difference is negligible. This can be added back if performance regressions occur.

Adds a new option:

Horizontal alignment - Text can be left, center, or right aligned with an optional argument. Pleas see the library for specifics. F_Damage_Horizontal_Alignment can be extended for custom alignment rules.
thanks for sharing
On Login() players of my game (including myself) experience the same number (0 - 9) appearing all over their screen (just the animation 1 time). I've added checks in f_damage to disable if the atom it's centering on isn't a mob but it keeps continuing. Something with the cache?
The cache is literally just an icon cache. It flipping (or not) is independent of that, and involves the atoms it makes for your specific user. Are you somehow managing to save mid-damage flick? That would get those atoms in the savefile, and possibly pull them back out on login.
It's literally on the login screen, nothing loaded there yet. I've been standing on there and see nothing, so it's just the guy logging in.
I'm afraid short of you triggering some of your own logic on login to do this, I can't see how it's possible. F_Damage must first be called to do anything at all, and does not directly associate damage icons to the atoms they are flicked over. They are not overlays, so won't be saved into those atoms, hence why you can hit something and it can move, but the F_Damage display remains at the location the atom was struck.

The cache is purely on icons, not objects, so no location information can ever be cached.
best damage display program out there
It would be nice if it could pop up more than colored numbers. Still, it's great for what it does.
Just tried F_Damage with an isometric test game and it seems to be displaying oddly. It seems to place the damage number far off the actual target.
I have to say I've never checked it with an isometric map mode. Have you got the demo uploaded somewhere?
I just made a quick iso test map and tried it. The problem is that the numbers are stored in a standard icon (I think) and so they get a bit off in iso mode.
SUCK
Darkchrispee wrote:
SUCK

I think you meant to write "I SUCK", don't you?

Nice library, I just noticed there was an Updated. The alignment implementation is really an useful tool, no more annoying numbers appearing randomnly.
BRO OMG THIS IS SO FREAKING SEXY!!!! I LOVE IT!!!! For shore using this & giving u full credit for it. Thx again man, this really helps.
I'm glad you like it!
In response to Stephen001
Stephen001 wrote:
I'm glad you like it!

Me too :) And thanks to Stephen001 for keeping up with and greatly improving this. I appreciate it.
Will there be maptext support?
We can do this as a very basic thing, but I'm still not sure quite what support maptext has for styles at present, so it'd probably be rather limited in use.
I see, thanks for the quick response.