User:Dutchmega/code: Difference between revisions
| Line 87: | Line 87: | ||
== Bugs found while making a co-op mod ==  | == Bugs found while making a co-op mod ==  | ||
* NPCs don't work with the HL2MP weapons  | |||
* You hear the warning-sound when you spawn without any weapons & ammo.  | * You hear the warning-sound when you spawn without any weapons & ammo.  | ||
* Fallen items/weapons from NPCs respawn.  | * Fallen items/weapons from NPCs respawn.  | ||
| Line 101: | Line 102: | ||
* Hoppers don't work  | * Hoppers don't work  | ||
* You don't see tracers & muzzleflash when a NPC shoots  | * You don't see tracers & muzzleflash when a NPC shoots  | ||
* Flashlight isn't aimed in the right direction if the model has a stunstick/crowbar/grenade.  | |||
* You don't hear tracer-sounds  | |||
* Items/weapons with the SF_NORESPAWN flag move to their original position.  | |||
* You hear the metropolice deathsound (radio) when you kill it with the combine ball.  | |||
* Scanner doesn't find any players when it's only allowed to inspect players.  | |||
* When you die in the water, the underwater-ambientsound never stopts.  | |||
* Combine soldiers don't do hand signals  | |||
* When you kill a combine with the combine ball, the (dropped) items/weapons aren't dissolved.  | |||
* APCs laserdot isn't hidden  | |||
* Grenades float in the air when dropped by an NPC  | |||
* You hear the ammo-warningsound & deathsound when you spawn without any weapons  | |||
* NPCs aren't frozen at an intermission.  | |||
* env_message doesn't work in MP  | |||
* It's possible to turn on the flashlight without the suit.  | |||
Of course, there's a bigger list of missing features. For example: 'Get points when you kill an NPC' or a deathnotice with the name of the NPC that killed you.  | Of course, there's a bigger list of missing features. For example: 'Get points when you kill an NPC' or a deathnotice with the name of the NPC that killed you.  | ||
Revision as of 01:05, 22 May 2006
Making the antlion burn!
Add the following under protected in npc_antlion.h
virtual	bool		AllowedToIgnite( void ) { return true; }
Well, now the damh thing burns but it doesn't visually respond to it. You can use the drown-animation: Add the following piece of code to the top of the function GatherConditions():
if( IsOnFire() )
{
	SetCondition( COND_ANTLION_IN_WATER );
}
UTIL_LoadTexture
Here's a very handy function from the Plan Of Attack source.
int UTIL_LoadTexture(const char *szFile)
{
#ifdef CLIENT_DLL
	char szStr[256];
	// try to pull it
	int iID = vgui::surface()->DrawGetTextureId(szFile);
	// did we get it?
	if(iID >= 0)
		return iID;
	// does the file exist?
	Q_snprintf(szStr, sizeof(szStr), "materials/%s.vmt", szFile);
	if(!vgui::filesystem()->FileExists(szStr))
	{
		DevMsg("UTIL_LoadTexture: texture %s does not exist!\n", szFile);
		return -1;
	}
	// create the new texture
	iID = vgui::surface()->CreateNewTextureID();
	vgui::surface()->DrawSetTextureFile(iID, szFile, true, false);
	return iID;
#else
	return -1;
#endif
}
Disallow players connecting to a server with a different version
Add the file version.h to your game_shared and add it to both projects. Content:
#define VERSION "0.01"
Then add to cdll_client_int.cpp:
void cl_versionCallback_f( ConVar *var, char const *pOldString )
{
	var->Revert();
}
static ConVar	cl_version	( "cl_version", VERSION, FCVAR_USERINFO|FCVAR_CLIENTDLL, "The version of this mod",
				cl_versionCallback_f );
Then open GameInterface.cpp and find the function ClientConnect()
Replace the contents of that function with this:
	// DM: Get the version of the client and compare it with the server's version
	const char* version = engine->GetClientConVarValue( engine->IndexOfEdict( pEdict ), "cl_version" );
	if (stricmp(VERSION, version) == 0)
	{
		return g_pGameRules->ClientConnected( pEdict, pszName, pszAddress, reject, maxrejectlen );
		// Aka true
	}
	else
	{
		char string [256];
		Q_snprintf( string, sizeof(string), "The server runs a different version (%s)", VERSION);
		Q_strcpy( reject, string ); 
		maxrejectlen = strlen(string);
		return false;
	}
Just don't forget to change the define everytime you release a new version
Bugs found while making a co-op mod
- NPCs don't work with the HL2MP weapons
 - You hear the warning-sound when you spawn without any weapons & ammo.
 - Fallen items/weapons from NPCs respawn.
 - APC doesn't aim good
 - Metropolice with stunstick doesn't work
 - Citizens with RPG don't work
 - You don't hear footsteps of NPCs.
 - Crash or 'players not dropping objects' when hit hard and have something picked with the gravity gun.
 - Sceneentity doesn't find 
!player. effects/strider_muzzlenot cached when you spawn an combine with the AR2.- Deaths are not counted at the scoreboard when killed by an NPC.
 filter_damage_type-entity doesn't work- Commanding citizens doesn't work.
 - Hoppers don't work
 - You don't see tracers & muzzleflash when a NPC shoots
 - Flashlight isn't aimed in the right direction if the model has a stunstick/crowbar/grenade.
 - You don't hear tracer-sounds
 - Items/weapons with the SF_NORESPAWN flag move to their original position.
 - You hear the metropolice deathsound (radio) when you kill it with the combine ball.
 - Scanner doesn't find any players when it's only allowed to inspect players.
 - When you die in the water, the underwater-ambientsound never stopts.
 - Combine soldiers don't do hand signals
 - When you kill a combine with the combine ball, the (dropped) items/weapons aren't dissolved.
 - APCs laserdot isn't hidden
 - Grenades float in the air when dropped by an NPC
 - You hear the ammo-warningsound & deathsound when you spawn without any weapons
 - NPCs aren't frozen at an intermission.
 - env_message doesn't work in MP
 - It's possible to turn on the flashlight without the suit.
 
Of course, there's a bigger list of missing features. For example: 'Get points when you kill an NPC' or a deathnotice with the name of the NPC that killed you.