Oh, and what I thought of just before I sent the mail (grr huh?) is that
if you don't want to use pev->message you could just use classname, and
strip off the "monster_" part (look at how the deathnotice is done where
monsters are concerned)

-omega
http://www.frontline2.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tony "omega"
Sergi
Sent: September 18, 2003 12:43 PM
To: [EMAIL PROTECTED]
Subject: RE: [hlcoders] Displaying enemy name on HUD

It doesn't USE targetname. What that is, is the ENTITY INDEX of the
player; the client dll can read all players names from their entity
index. Monsters don't _have_ names. So you'll have to change the whole
id system so it sends the classname of the entity, but NOT as an entity
index.

Did you look at the code on the client side that processes it?

Here is how I do it in FLF (based on Pink's original code, I optimized
it to allow you to ID any monster (mainly for turrets here) in one if
statement.

First, inside the monsters spawn function, I fill pev->message (I use
message because I'm already using netname for something else, but if
you're not, you can use netname respectively)
IE:
pev->message = MAKE_STRING("Turret");

Then inside the ID function:

//omega; modified to only allow you to id team-mates (you could use it
to aim //over distances at the enemy, and in some cases see people who
were //camouflaged)
if (pEntity->Classify() == CLASS_PLAYER && pEntity->pev->team ==
pev->team)
{
Regular player id stuff;
}
//find out if it's a monster of any kind, if it is, then id it from its
//"message" (set in the "monster" spawn function)
else if (strstr(STRING(pEntity->pev->classname), "monster"))
{
CBaseTurret *pTur = (CBaseTurret *)pEntity;

if (pTur->IRelationship(this))
sprintf (sbuf0, "%s[ Enemy %s ]", "%r", STRING(pTur->pev->message));
else
sprintf(sbuf0, "%s[ Friendly %s ]", "%g", STRING(pTur->pev->message));
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
}

I removed all tabs so that it fits inside the size restriction of plain
text.
-omega
http://www.frontline2.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tuomo
Virtanen
Sent: September 18, 2003 6:15 AM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Displaying enemy name on hud

Ok maybe i should clear somethings up a bit the code is actually in the
original SDK and it does send data to client.dll so it can display the
data that is Name, Health and Armor
here is the original code:
if (pEntity->Classify() == CLASS_PLAYER )
{
newSBarState[ SBAR_ID_TARGETNAME ] = ENTINDEX( pEntity->edict() );
strcpy( sbuf1, "1 %p1\n2 Health: %i2%%\n3 Armor: %i3%%" );
// allies and medics get to see the targets health
if ( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
{
newSBarState[ SBAR_ID_TARGETHEALTH ] = 100 * (pEntity->pev->health /
pEntity->pev->max_health);
newSBarState[ SBAR_ID_TARGETARMOR ] = pEntity->pev->armorvalue; //No
need to get it % based since 100 it's the max.
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
}
so i need to change this code to make it so that it sends the monster
targetname as name i already made another copy of this code and changed
the CLASS_PLAYER to CLASS_PLAYER_ALLY



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to