PDA

View Full Version : Quake Done Right (HUD elements)


blacksmith123
06-11-2007, 03:01 PM
Ok, so I'm sort of remaking the first Quake game, but to really replicate it, I want to add two HUD elements:

1. Secret area counter. I've replicated all of the little secret areas from the original Quake levels, but I want to add a little counter in the HUD that shows how many you've found and how many are left (2/5, 3/5, and so on).

2. Monsters killed counter. I'm not going to have any random spawns, just a set number of enemies in a map, so I'd like a counter to show how many enemies have been killed and how many are left.

Really, I don't even need to show how many of either are left for the counters, just a straight 1, 2, 3 counter would work. If anyone could help or point me in the right direction, I would really appreciate it, since I've got no idea where to begin.

Angry Beaver
06-11-2007, 05:40 PM
I'd have a voulmetric entity that triggers the "secret area" message, like maybe func_secretarea. Now if you have that you can simply use your global entity list and count how many func_secretarea there are in the map to get your value. To show how many are left you could add a variable to the player thats something like iSecrets and a function to adjust it. then have the custom enties touch function trigger the increase in the activator which will be the player that found it.

as for NPCS, use the gent list again, but i'd just find anything npc_* as there doesn't sound like there will be many if any allies in your game. if their will be jsut subtract their number from that count. Then theres a fuction thats triggered every time a player kills an NPC, turn on your developer console to something high like 3 and you should see its name ingame.

ts2do
06-11-2007, 06:28 PM
It would have less of an impact if you made it so in enemies' Spawn function you augment the local player's total enemies count by one. Then, in the enemies' Event_Killed function (I think that's the one) you augment the local player's enemies killed by one. The trigger_secretarea entity would be similar except would augment the player's previously mentioned iSecrets by one when touched by player.

blacksmith123
06-16-2007, 05:40 PM
How would I go about making this func_secretarea? In the brush entity tutorial (http://developer.valvesoftware.com/wiki/Authoring_a_Brush_Entity) it only describes how to make a func_physbox-type thing.

Nial
06-19-2007, 11:12 AM
blacksmith123, one possible solution would be creating a class based off of CBaseToggle (Brush Entity (http://developer.valvesoftware.com/wiki/Authoring_a_Brush_Entity)) and within its Touch function use the following code (untested):


void CSecretBrush::BrushTouch( CBaseEntity *pOther )
{
if( pOther->IsPlayer() ) AwardSecret( ToBasePlayer( pOther ) );
}

void CSecretBrush::AwardSecret( CBasePlayer *pPlayer )
{
if( !bHasBeenDiscovered ) {
bHasBeenDiscovered = true;
pPlayer->iSecretsFound++;
}
}


I would give CSecretBrush a boolean value in its DATADESC. When AwardSecret is called, you'd just set it to true (provided it's still false), and up the player SecretsFound count!

That's just guess work. Most of my experience lies in Multiplayer work.