Named Game of the Year by over 50 publications, Valve's début title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.

Post tutorial Report RSS Using Glowshell

I am writing this tutorial because there are no tutorials on this that I can find and this effect is easy to make if you know what to do. This tutorial will be easy for people who are new to Half-Life Modding.

Posted by on - Basic Server Side Coding

For this tutorial I will show you how to add glowshell to an entity. This effect can be useful for when you want an entity to be obvious to the player, for example, weapons in a dark room.

We will start by adding glowshell to a zombie.
Here is the half-life zombie. He doesn't have glowshell by default.

Now we will look at the zombie code which is zombie.cpp in the dlls folder of the SDK.

There are many parts of zombie.cpp

public:
	void Spawn( void );
	void Precache( void );
	void SetYawSpeed( void );
	int  Classify ( void );
	void HandleAnimEvent( MonsterEvent_t *pEvent );
	int IgnoreConditions ( void );

	float m_flNextFlinch;

	void PainSound( void );
	void AlertSound( void );
	void IdleSound( void );
	void AttackSound( void );

	static const char *pAttackSounds[];
	static const char *pIdleSounds[];
	static const char *pAlertSounds[];
	static const char *pPainSounds[];
	static const char *pAttackHitSounds[];
	static const char *pAttackMissSounds[];

For this tutorial, however, we will only need to change spawn. So go to void CZombie :: Spawn() on line 270
It should look like this:

//=========================================================
// Spawn
//=========================================================
void CZombie :: Spawn()
{
	Precache( );

	SET_MODEL(ENT(pev), "models/system/monsters/zombie.mdl");
	UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );

	pev->solid			= SOLID_SLIDEBOX;
	pev->movetype		= MOVETYPE_STEP;
	m_bloodColor		= BLOOD_COLOR_RED;
	pev->health			= gSkillData.zombieHealth;
	pev->view_ofs		= VEC_VIEW;// position of the eyes relative to monster's origin.
	m_flFieldOfView		= 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
	m_MonsterState		= MONSTERSTATE_NONE;
	m_afCapability		= bits_CAP_DOORS_GROUP;

	MonsterInit();
}

Go to the end of spawn, right after MonsterInit();

add this

pev->renderfx = kRenderFxGlowShell;

Compile the code and the zombie should now look like this:

Congratulations! You now have a glowing zombie!

But wait...

What if we want to make the glow a different color?

It's simple.

You put these under the pev->renderfx = kRenderFxGlowShell; line
pev->rendercolor.x = (NUMBER HERE);
pev->rendercolor.y = (NUMBER HERE);
pev->rendercolor.z = (NUMBER HERE);

These might look confusing, but they're just values for RGB color.
rendercolor.x is red
rendercolor.y is green
rendercolor.z is blue

For example,
pev->rendercolor.x = 255;
would make red glowshell:

pev->rendercolor.y = 255;
would make green glowshell:

pev->rendercolor.z = 255;
would make blue glowshell:

pev->rendercolor.x = 128;
pev->rendercolor.z = 128;
would make purple glowshell:

and so on.

Hope this tutorial helped. If you have any questions or if anything was unclear leave a comment or PM me.

Post comment Comments
Ian50028
Ian50028 - - 571 comments

Nice tutorial, and very well explained, really easy to understand.

Reply Good karma Bad karma+8 votes
Magic_Nipples
Magic_Nipples - - 1,325 comments

Thanks for a tutorial on this!

Reply Good karma Bad karma+3 votes
Demonstrator
Demonstrator - - 36 comments

Is there any way to do this on guns in multiplayer even if only i see it :S ?

Reply Good karma Bad karma+1 vote
OsirisGodoftheDead Author
OsirisGodoftheDead - - 685 comments

You mean v_ models? I'm pretty sure there's a way to do it but I'm not sure how.

Reply Good karma+1 vote
Demonstrator
Demonstrator - - 36 comments

Yep thats what i want to know on v_models

Reply Good karma Bad karma+1 vote
OsirisGodoftheDead Author
OsirisGodoftheDead - - 685 comments

Look in DMC source code, It's somewhere in there. I'll update the tutorial if I find it.

Reply Good karma+2 votes
noRktreSS
noRktreSS - - 142 comments

DMC source code? Is that available?
GIMME GIMME GIMME

Reply Good karma Bad karma0 votes
Demonstrator
Demonstrator - - 36 comments

almost one year later still nothing :D

Reply Good karma Bad karma0 votes
H.
H. - - 36 comments

Good job. I'm going to use it for my mod.

Reply Good karma Bad karma+1 vote
OsirisGodoftheDead Author
OsirisGodoftheDead - - 685 comments

That's great! It's a cool effect that isn't used all that much.

Reply Good karma+1 vote
Guest
Guest - - 688,627 comments

This comment is currently awaiting admin approval, join now to view.

Aynekko
Aynekko - - 652 comments

Works like a charm. I have an addition. Below "pev->renderfx" you can also add a line "pev->renderamt = 25;" which I assume ranges from 0 to 255 (from transparent to opaque). And to my surprise it was not about the transparency of the whole model but only the shell effect! I set it to 25 to have just a little bit of that nice shiny glow and it worked perfectly.

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: