Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/sites/a/ on line 20
Wavelength | Your Game Editing Resource | Non-Exploding Snarks
Welcome, Guest! Login | Register

Non-Exploding Snarks [Print this Article]
Posted by: The Evil One
Date posted: Feb 13 2003
User Rating: 4 out of 5.0
Number of views: 4961
Number of comments: 0
Description: Just for fun
This tutorial explains how to have snarks that don't explode after 15 seconds in your mod.

Open up the server dll project for Half-Life, and open the file squeakgrenade.cpp.
Starting at the CSqueakGrenade::HuntThink function, comment out the next two lines after

g_vecAttackDir = pev->velocity.Normalize( );

so they look like this:

//pev->health = -1;
//Killed( pev, 0 );

Now below that last line, add the line:

m_flDie = gpGlobals->time + SQUEEK_DETONATE_DELAY;

You must put this line here, or else really weird stuff will happen when you play, which I will explain in a moment.
Compile mp.dll, and instead of exploding after 15 seconds, the snarks should hang around until you kill them.

The line you add below the now commented lines is VERY important!

There is some code that calculates the pitch of the snark's squeal. The closer to the snark's explosion time (m_flDie) the higher the pitch ('urgency') of it's squeal is. Without that modification, the squeal would be inaudible (seeing as the time left until death is a negative figure, it starts playing the squeal so quickly that you cant hear it.
Also as time goes on, the client's computer has to process the small squeal of all the snarks, and do all the normal things, which gets a bit ugly). So basically, this line resets the time till death (which is only being used for the squeal now) every SQUEEK_DETONATE_DELAY seconds. This sounds a tad unnatural at the default 15 seconds (SQUEEK_DETONATE_DELAY is defined on line 86), so I usually set it to 120 seconds (2 minutes).

Rate This Article
This article is currently rated: 4 out of 5.0 (1 Votes)

You have to register to rate this article.
User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005

Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
knock knock
General | News
By: omega | Dec 22 2016
knock knock
General | News
By: MIFUNE | Oct 10 2015
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
knock knock
General | News
By: Whistler | Nov 05 2011
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (3 guests)
About - Credits - Contact Us

Wavelength version:
Valid XHTML 1.0! Valid CSS!