[Not a ZDoom bug] CheckInventory("Health");

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
User avatar
Posts: 1066
Joined: Tue Jul 15, 2003 5:13 pm
Location: That little island pritch created.


Post by Nanami »

Code: Select all

script 1 ENTER
 HudMessage(s:"Health: ",d:CheckInventory("Health");0,0,CR_GREEN,0.0,0.5,0);
 HudMessage(s:"Armor: ",d:CheckInventory("Armor");0,1,CR_GREEN,0.0,0.525,0);
 HudMessage(s:"Bullets: ",d:CheckInventory("Clip");0,2,CR_GREEN,0.0,0.55,0);
 HudMessage(s:"Shells: ",d:CheckInventory("Shell");0,3,CR_GREEN,0.0,0.575,0);
 HudMessage(s:"Rockets: ",d:CheckInventory("RocketAmmo");1,4,CR_GREEN,0.0,0.6,0);
 HudMessage(s:"Cells: ",d:CheckInventory("Cell");0,5,CR_GREEN,0.0,0.625,0);
The health value will always show 100. Is it just reading the max health value? Or is it broken? Do I need to do something else to read health?

Also, is there any way to read what kind of armor type the player is wearing? It'd be nice to do a check inventory and display ammo type in blue (or whatever) if it's type 2, for custom huds.
User avatar
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA

Post by cccp_leha »

Woulnd't you use getActorProperty(0, APROP_HEALTH) to get the current health? As far as the second one is concerned: IIRC, the armor displays green if it's <= 100%, and blue if it's > 100%; special case being that it is still shown as blue if you go from above 100% to below 100%, after which if a green armor is picked up, it goes back to green. So you can have a check in the script along those lines. So it would... Oh shit, school is being closed due to snow, brb :)
User avatar
Site Admin
Posts: 7731
Joined: Wed Jul 09, 2003 10:30 pm

Post by randi »

The problem is not with CheckInventory("Health") but with your script. You don't give the health HUD message an ID (because 0 is not an ID), so each tic, a new message is created for it and drawn underneath the first one. So the message showing your current health gets covered up by the message showing your health when you started the level.

Return to “Closed Bugs [GZDoom]”