Raised This Month: $51 Target: $400
 12% 

[L4D & L4D2] Reload Fix - Max Clip Size (1.5) [21-Apr-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
7275
Plugin Version:
1.5
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
Servers with this Plugin:
68 
Plugin Description:
Fixes glitchy animation when the max clip sized was changed
Old 09-01-2020 , 14:00   [L4D & L4D2] Reload Fix - Max Clip Size (1.5) [21-Apr-2024]
Reply With Quote #1

Fixes:
  • Reload animation glitching when a modified clip size is full.
  • Shotgun animation stopping after reloading 15 bullets.

When using Left4DHooks L4D2_SetIntWeaponAttribute(classname, L4D2IWA_ClipSize, XX);
- OR -
Info Editor to modify "clip_size" key value.
- OR -
some other method to modify the clip size e.g. directly modifying weapon.txt script files (L4D1).


For some reason detouring "CTerrorGun::Reload" using the VTable method kept crashing, so I've gone with using signatures.


Related Plugins:


Cvars:

Saved to l4d_reload_fix.cfg in your servers \cfg\sourcemod\ folder.

PHP Code:
l4d_reload_fix_m60 "0" // 0=Off, 1=Fix the M60 from reload bug issues. 


Changes:
Code:
1.5 (21-Apr-2024)
    - Added cvar "l4d_reload_fix_m60" to control if the M60 should be fixed or not, since I encounter no bug with changed clip size.
    - Fixed the Grenade Launcher and M60 playing the reload animation when a modified clip size is full. Thanks to "chungocanh12" for reporting.

1.4 (07-Nov-2023)
    - Fixed not deleting 2 handles. Thanks to "HarryPotter" for reporting.

1.3a (08-Sep-2021)
    - GameData file updated. Wildcarded "CTerrorGun::Reload" to support other plugins detouring this function.
    - Thanks to "vikingo12" for reporting.

1.3 (05-Jul-2021)
    - L4D2: Added support for the "weapon_smg_mp5" weapon. Thanks to "Alexmy" for reporting.

1.2 (29-Jun-2021)
    - L4D2: Added support for the Magnum "weapon_pistol_magnum" pistol.

1.1b (17-Jun-2021)
    - Compatibility update for L4D2's "2.2.1.3" game update. Thanks to "Crasher_3637" for fixing.
    - GameData .txt file updated.

1.1a (24-Sep-2020)
    - Compatibility update for L4D2's "The Last Stand" update.
    - GameData .txt file updated.

1.1 (05-Sep-2020)
    - Now prevents changing anything when the max clip size is unchanged.
    - Added a fix for shotgun reload animation stopping when reloading >= 15 bullets at one time.
    - Thanks to "fbef0102" for reporting.
    - GameData file updated.

1.0 (25-Aug-2020)
    - Initial release.


Requirements:
  1. SourceMod 1.11 or newer
  2. -OR-
  3. DHooks (Experimental Dynamic Detour support) and manually compiling the plugin
  4. L4D2 only: Left 4 DHooks Direct plugin.


Installation:
DO NOT click 'Get Plugin' or it will fail to compile because this plugin requires DHooks!
  1. Download the .smx file and put into your servers \addons\sourcemod\plugins folder.
  2. Download "l4d_reload_fix.txt" and put the file into your servers \addons\sourcemod\gamedata\ folder.

Updating from 1.0:
  • GameData .txt file must be updated.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_reload_fix.sp - 16 views - 12.9 KB)
File Type: smx l4d_reload_fix.smx (7.2 KB, 13 views)
File Type: txt l4d_reload_fix.txt (1.8 KB, 1184 views)
__________________

Last edited by Silvers; 04-21-2024 at 11:12.
Silvers is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 09-02-2020 , 12:08   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #2

Sorry, will you also fix autoshotgun(including spas) reloading animation glitch?

This glitch only happens when
you start to reload shotgun from 0 to 15 or above.
One day, I used Info Editor to modify autoshotgun "clip_size" key value to 20, and I just found this glitch.
This animation glitch doesn't affect anything, just a question here
__________________

Last edited by HarryPotter; 09-02-2020 at 12:11.
HarryPotter is offline
ReCreator
Member
Join Date: Nov 2017
Location: Ukraine,Kyiv
Old 09-02-2020 , 15:13   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #3

Also, if player has full "edited" clip and try to reload, animation start an break in a second.
__________________
Sorry for my pure English...
ReCreator is online now
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-02-2020 , 18:52   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #4

This will work nicely on my server.

A few observations. While this does fix the constant animation glitch there is still some room for improvement. I have reduced ammo for the shotguns on my server, so clip size is 8 and 9 for Spaz and autoshotgun. The animation glitch still happens when you try to reload on full clip. Again its just visual, but it does happen. I'll provide more feedback as I do more testing.
__________________

Last edited by Spirit_12; 09-02-2020 at 19:03.
Spirit_12 is offline
Alex101192
Senior Member
Join Date: Aug 2018
Old 09-04-2020 , 13:37   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #5

Are there any issues that could come up when using this plugin while there was no modification to the clip size?
Alex101192 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-04-2020 , 14:32   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #6

Quote:
Originally Posted by fbef0102 View Post
Sorry, will you also fix autoshotgun(including spas) reloading animation glitch?

This glitch only happens when
you start to reload shotgun from 0 to 15 or above.
One day, I used Info Editor to modify autoshotgun "clip_size" key value to 20, and I just found this glitch.
This animation glitch doesn't affect anything, just a question here
Have fixed reload animation stopping on shotguns when reloading >= 15 in one go. Sent PM test version before releasing.


Quote:
Originally Posted by ReCreator View Post
Also, if player has full "edited" clip and try to reload, animation start an break in a second.
That's the best the plugin can do due to client side prediction, without this fix the animation would constantly spaz out trying to start for a few seconds.


Quote:
Originally Posted by Spirit_12 View Post
This will work nicely on my server.

A few observations. While this does fix the constant animation glitch there is still some room for improvement. I have reduced ammo for the shotguns on my server, so clip size is 8 and 9 for Spaz and autoshotgun. The animation glitch still happens when you try to reload on full clip. Again its just visual, but it does happen. I'll provide more feedback as I do more testing.
Shotguns don't trigger the function being detoured, but also don't spaz out constantly trying to reload for several seconds like other weapons.


Quote:
Originally Posted by Alex101192 View Post
Are there any issues that could come up when using this plugin while there was no modification to the clip size?
No it shouldn't affect anything, but in the next version will ignore doing anything when the clips stock size.
__________________

Last edited by Silvers; 09-04-2020 at 14:36.
Silvers is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-04-2020 , 20:02   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #7

Quote:
Originally Posted by Silvers View Post
Shotguns don't trigger the function being detoured, but also don't spaz out constantly trying to reload for several seconds like other weapons.
I looked it up and apparently Ladder Rambos had the same issue. Maybe add it for shotguns as well? I'll see if I can provide windows signature.

PHP Code:
"CBaseShotgun::Reload"
{
    
"library"    "server"
    "linux"    "@_ZN12CBaseShotgun6ReloadEv"
    "windows"    ""

__________________
Spirit_12 is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 09-04-2020 , 20:40   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #8

Should be the windows sig, already had some shotgun functions reversed for windows, i'v never tested to be 100% sure.
PHP Code:
"CBaseShotgun::Reload"
{
    
"library"    "server"
    "linux"    "@_ZN12CBaseShotgun6ReloadEv"
    "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x56\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x8B\xF8\x85\xFF\x0F\x84\x2A\x2A\x2A\x2A\x8B\x87\xD4\x1C\x00\x00"
    
/* ? ? ? ? ? ? 56 57 8B F1 E8 ? ? ? ? 8B F8 85 FF 0F 84 ? ? ? ? 8B 87 D4 1C 00 00 */

__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-04-2020 , 21:35   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
Reply With Quote #9

I actually went ahead and tried the shotgun thing and it doesn't seem to work. I'll leave the source here if anyone want to tinker with it.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_reload_fix.sp - 340 views - 6.6 KB)
File Type: txt l4d_reload_fix.txt (1.2 KB, 260 views)
__________________
Spirit_12 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-05-2020 , 15:02   Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1) [05-Sep-2020]
Reply With Quote #10

Updated:

Code:
1.1 (05-Sep-2020)
    - Now prevents changing anything when the max clip size is unchanged.
    - Added a fix for shotgun reload animation stopping when reloading >= 15 bullets at one time.
    - Thanks to "fbef0102" for reporting.
    - GameData file updated.

I don't see an issue with shotguns when a modified clip size is full, the animation glitches once and stops (unlike the other guns which repeatedly glitch for several seconds). The same would happen if the fix was applied to the shotgun so it's not necessary. If this is wrong show me a video of the issue.
__________________
Silvers is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode