Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Team Side HP/AP colors

Newbie Spellweaver
Joined
Aug 31, 2020
Messages
36
Reaction score
3
HP FIX - Team Side HP/AP colors - RaGEZONE Forums
if (ZGetGame()->GetMatch()->IsTeamPlay())
{
ZCharacter* pTargetCharacter = GetTargetCharacter();
if (pTargetCharacter == NULL) return;
float texty = 0.75000f;
float x = 0.024f;
float ysub = 0.05000f;

for(ZCharacterManager::iterator itor = ZGetGame()->m_CharacterManager.begin();
itor != ZGetGame()->m_CharacterManager.end(); ++itor)
{
rvector pos, screen_pos;
ZCharacter* pCharacter = (*itor).second;
if (!pCharacter->IsVisible()) continue;
if (pCharacter->IsDie()) continue;
if (pCharacter->GetTeamID() != pTargetCharacter->GetTeamID()) continue;
if (pCharacter==pTargetCharacter) continue;

MCOLOR tmpColor = pDC->GetColor();
pDC->SetColor(MCOLOR(0xFFffd700));
MFont* pFont = GetGameFont();
pFont = MFontManager::Get("FONTa10_O2Wht");
pDC->SetFont(pFont);
pDC->Text(x * MGetWorkspaceWidth(), texty * MGetWorkspaceHeight() - 16, pCharacter->GetUserNameA());

pDC->SetColor(MCOLOR(0x901C1C1C));
pDC->FillRectangleW((x * MGetWorkspaceWidth()), texty * MGetWorkspaceHeight() + 1, 0.08 * MGetWorkspaceWidth(), 7);

float fHP = 0.08 * pCharacter->GetHP() / pCharacter->GetMaxHP();
if (fHP == 1.0f)pDC->SetColor(MCOLOR(0xFF0080FF));
else if (fHP > 0.7f) pDC->SetColor(MCOLOR(0xFF45B1BA));
else if (fHP > 0.3f) pDC->SetColor(MCOLOR(0xFFE7DC22));
else pDC->SetColor(MCOLOR(0xFFE92C16));
pDC->FillRectangleW((x * MGetWorkspaceWidth()), texty * MGetWorkspaceHeight() + 1, fHP * MGetWorkspaceWidth(), 7);

pDC->SetColor(MCOLOR(0x901C1C1C));
pDC->FillRectangleW((x * MGetWorkspaceWidth()), texty * MGetWorkspaceHeight() + 9, 0.08 * MGetWorkspaceWidth(), 7);

float fAP = 0.08 * pCharacter->GetAP() / pCharacter->GetMaxAP();
pDC->SetColor(MCOLOR(0xFF44C13E));
pDC->FillRectangleW((x * MGetWorkspaceWidth()), texty * MGetWorkspaceHeight() + 9, fAP * MGetWorkspaceWidth(), 7);
pDC->SetColor(tmpColor);
texty -= ysub;

i need some help for fix color same is not work.. :/
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Jul 25, 2013
Messages
20
Reaction score
9
float fHP = 0.08 * pCharacter->GetHP() / pCharacter->GetMaxHP();
if (fHP == 1.0f)pDC->SetColor(MCOLOR(0xFF0080FF));
else if (fHP > 0.7f) pDC->SetColor(MCOLOR(0xFF45B1BA));
else if (fHP > 0.3f) pDC->SetColor(MCOLOR(0xFFE7DC22));
else pDC->SetColor(MCOLOR(0xFFE92C16));
if we suppose you can get this: fHP = 0.08 * 1, always the value will be 0.08,
pCharacter->GetHP() / pCharacter->GetMaxHP()
if this value was less, even it isnt result in 1, alawys be less than 0.08, you need fix your maths.
 
Upvote 1
Back
Top