> I checked out the tutorial at http://hlpp.telefragged.com/tuts/money.htm
> for a money system, but it doesn't fit what i need. Any ideas how to have
> it so when you kill a monster (maybe the base monster class?) you get
> money for it?
Stick something like this in CBaseMonster::Killed() (in combat.cpp)...
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pevAttacker);
// is it a player (and not a grenade, hornet, rocket, etc.)?
if (pPlayer->IsPlayer())
{
pPlayer->m_Money += m_MosterMoneyValue;
}
...where m_Money is a member variable in the CBasePlayer class and
m_MonsterMoneyValue is a member variable in the CBaseMonster class (assuming
different monsters are worth different amounts of money).
Note: Some monsters override the ::Killed() function and you will have to
handle those cases separately (i.e. in that specific monsters ::Killed()
function).
Jeffrey "botman" Broome
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders