Horus | Date: Thursday, 25-02-2016, 1:01 PM | Message # 1 |
Generalissimo
Group: Administrators
Messages: 14
Status: Offline
| 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).
thewavelength.net
|
|
| |