Raised This Month: $61 Target: $400
 15% 

[L4D & L4D2] Reload Fix - Max Clip Size (1.4) [07-Nov-2023]


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.4
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
Servers with this Plugin:
15 
Plugin Description:
Fixes glitchy animation when the max clip sized was changed
Old 09-01-2020 , 15:00   [L4D & L4D2] Reload Fix - Max Clip Size (1.4) [07-Nov-2023]
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:


Changes:
Code:
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 - 127 views - 12.2 KB)
File Type: smx l4d_reload_fix.smx (6.9 KB, 188 views)
File Type: txt l4d_reload_fix.txt (1.8 KB, 1103 views)
__________________

Last edited by Silvers; 11-07-2023 at 03:47.
Silvers is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 09-02-2020 , 13: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 13:11.
HarryPotter is offline
ReCreator
Member
Join Date: Nov 2017
Location: Ukraine,Kyiv
Old 09-02-2020 , 16: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 offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-02-2020 , 19: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 20:03.
Spirit_12 is offline
Alex101192
Senior Member
Join Date: Aug 2018
Old 09-04-2020 , 14: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 , 15: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 15:36.
Silvers is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-04-2020 , 21: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: Brexit
Old 09-04-2020 , 21: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 , 22: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 - 273 views - 6.6 KB)
File Type: txt l4d_reload_fix.txt (1.2 KB, 240 views)
__________________
Spirit_12 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-05-2020 , 16: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


Thread Tools
Display Modes

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 10:40.


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