by Cherno » Tue Oct 09, 2018 6:04 pm
I would still like some input on this, if at all possible. Basically:
Why are the things I inserted into my status bar only updating once, while the default stuff like health and ammo is updated as usual?
Code: Select all
protected void DrawMainBar (double TicFrac)
{
//custom code start
int credits = CheckInventory("CE_Credits");
DrawString(mHUDFont, FormatNumber(credits ), (0,0), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);//is only updated once after collecting the first CE_Credits item
//custom code end
//default status bar: ammo etc. gets updated like it should
DrawImage("STBAR", (0, 168), DI_ITEM_OFFSETS);
DrawImage("STTPRCNT", (90, 171), DI_ITEM_OFFSETS);
DrawImage("STTPRCNT", (221, 171), DI_ITEM_OFFSETS);
Inventory a1 = GetCurrentAmmo();
if (a1 != null) DrawString(mHUDFont, FormatNumber(a1.Amount, 3), (44, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
DrawString(mHUDFont, FormatNumber(CPlayer.health, 3), (90, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
DrawString(mHUDFont, FormatNumber(GetArmorAmount(), 3), (221, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
//...
}
I would still like some input on this, if at all possible. Basically:
Why are the things I inserted into my status bar only updating once, while the default stuff like health and ammo is updated as usual?
[code]
protected void DrawMainBar (double TicFrac)
{
//custom code start
int credits = CheckInventory("CE_Credits");
DrawString(mHUDFont, FormatNumber(credits ), (0,0), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);//is only updated once after collecting the first CE_Credits item
//custom code end
//default status bar: ammo etc. gets updated like it should
DrawImage("STBAR", (0, 168), DI_ITEM_OFFSETS);
DrawImage("STTPRCNT", (90, 171), DI_ITEM_OFFSETS);
DrawImage("STTPRCNT", (221, 171), DI_ITEM_OFFSETS);
Inventory a1 = GetCurrentAmmo();
if (a1 != null) DrawString(mHUDFont, FormatNumber(a1.Amount, 3), (44, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
DrawString(mHUDFont, FormatNumber(CPlayer.health, 3), (90, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
DrawString(mHUDFont, FormatNumber(GetArmorAmount(), 3), (221, 171), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
//...
}
[/code]