THE HANDY VANDAL'S ALMANAC
Game Design Resources for Half-Life
Home : Topics : Menu : Reviews
Almanac 2 : Xen Rebels

Site no longer actively maintained ... HV

"Like an Electric Monkey in Frankenstein's Toolbox"
 

CODING MONSTERS
See also: Coding - Mods - Programming - Monsters
Updated June 26, 2001 - 7:08 PM

 

Coding Monsters Using the Half-Life SDK

Monsters in Multiplayer Mode -- You can easily hack the SDK to allow monsters in deathmatch and teamplay games. Open up HL.DSW in Visual C++ (or other C++ compiler). Find the code for the FAllowMonsters method in the CHalflifeMultiplay class.

BOOL CHalfLifeMultiplay :: FAllowMonsters( void )
{
// return ( CVAR_GET_FLOAT( "mp_allowmonsters" ) != 0 );
return TRUE; // KGJ: allow monsters
}

Notice that I have commented out the "return" statement. FAllowMonsters normally returns FALSE, because the CVAR for mp_allowmonsters is set to zero. (This is elsewhere in the code. An alternative approach: set the CVAR to a non-zero value, allow FAllowMonsters to behave normally.)

By adding the "return TRUE" statement, I'm telling the calling function:
"It's true: monsters are allowed in multiplayer."

 
CODING MONSTERS
Handy Vandal's Almanac Logo

"Handy Vandal" and "Handy Vandal's Almanac" copyright 2008 by Karl Gregory Jones
Almanac: Half-Life : Half-Life 2
Xen Rebels
karljones.com
Contact the Handy Vandal

Half-Life © 1998-99 Sierra On-line and Valve L.L.C. All rights reserved. Half-Life and the Half-Life logo are trademarks of Sierra On-Line. Valve and the Valve logo are trademarks of Valve L.L.C. Half-Life images, textures, music, sound effects, and other graphic or audio content © 1998-99 Valve L.L.C. All rights reserved.