Posted by: trepid_jon
Date posted: Jan 19 2005 User Rating: 3 out of 5.0 | Number of views: 2003 Number of comments: 3 | Description: A basic fix for stopping the grenade from auto-switching to the next best weapon after you throw one. Also allows more than one grenade to be thrown. |
I've never written an article here on Wavelength, so I figured I'd start with something very basic. I noticed some people here and there have been asking how to fix this "bug" with the grenade, so I figured I'd give a little snippet on how I fixed it for my test mod a week or so ago.
Open weapon_basesdkgrenade.cpp, and go to void CBaseSDKGrenade::ItemPostFrame().
Look for this...
| | | else { pPlayer->SwitchToNextBestWeapon( this ); }
|
And change that to this...
| | | else { //pPlayer->SwitchToNextBestWeapon( this ); m_bRedraw = false; }
|
That's pretty much all there is to it. Like I said, it's very simple. I feel dirty or something for making my first article something that's so incredibly simple, but I guess that's why it's in the snippets section.
Now just change the grenade so it isn't the CS grenade, and you'll earn bonus points for the contest. Wait, what? |
|
User Comments
Showing comments 1-3
|
works, not great, needs more. but thanks none the less :) |
|
thats right the_hat... and here is how i fixed it:
replase this:
CODE
else { //pPlayer->SwitchToNextBestWeapon( this ); m_bRedraw = false; }
with this...
CODE
else { //pPlayer->SwitchToNextBestWeapon( this ); m_bRedraw = false; m_flNextPrimaryAttack = gpGlobals->curtime + 0.5; SendWeaponAnim( ACT_VM_DRAW ); }
And if your 2nd granade dosent trow then replase this:
CODE
void CBaseSDKGrenade::StartGrenadeThrow() { m_fThrowTime = gpGlobals->curtime + 0.0f; }
with this:
CODE
void CBaseSDKGrenade::StartGrenadeThrow() { m_fThrowTime = gpGlobals->curtime + 0.5f; // Modifyed AND fixed from 0.0f }
That should do it :)
btw thx for the idea trepid_jon ;) |
|
|
Oh, very cool additions. That way your grenade draw animation will play, like you pull another grenade out, right? Cool, man. |
|
You must register to post a comment. If you have already registered, you must login.
|