Code: Select all
//The Hud I am accessing the ShieldItem Var from
class MyStandaloneGameHUD : BaseStatusBar
{
HUDFont mHUDFont;
SendirPlayer pmo;
ShieldItem shield;
bool shieldStatus;
override void Init(void)
{
Super.Init();
SetSize(0, 320, 200);
Font fnt = SmallFont;
mHUDFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), Mono_CellLeft, 1, 1);
Self.shieldStatus = shield.hasUsedShield; //error is located here from what the logs have told me.
}
override void Draw(int state, double TicFrac)
{
if (CPlayer && CPlayer.mo)
{
pmo = SendirPlayer(CPlayer.mo);
}
BaseStatusBar.Draw(state, TicFrac);
if (state == HUD_StatusBar || state == HUD_Fullscreen)
{
BeginHUD(forcescaled: true);
DrawHUD();
}
}
void DrawHUD()
{
//DrawBar("barfull","barblank",pmo.player.health,100,(99, -20),0,SHADER_VERT,
//DI_ITEM_CENTER | DI_SCREEN_LEFT_BOTTOM );
DrawString(mHUDFont, StringTable.Localize("$TXT_HUD_HEALTH") .. FormatNumber(pmo.player.health, 3), (22, -30));
DrawString(mHUDFont, StringTable.Localize("RAGE:") .. FormatNumber(pmo.rage, 3), (22, -20));
DrawString(mHUDFont, StringTable.Localize("Arcane Shells:").. pmo.CountInv("Shell") , (260, -20)); //.. CheckInventory("Shell")
DrawString(mHUDFont, StringTable.Localize("Shield:").. getShieldStatus() , (260, -20));
}
String getShieldStatus()
{
if (!shieldStatus) return "Ready!";
else return "Not Ready";
}
}
Code: Select all
//The Inventory Class that contains the hasUsedShield variable..
class ShieldItem : CustomInventory {
bool hasUsedShield;
property hasUsedShield : hasUsedShield;
Default {
Inventory.PickupMessage "Picked up the Shield!";
Inventory.Amount 1;
Inventory.DefMaxAmount 1;
Self.hasUsedShield false;
}
}