Raised This Month: $32 Target: $400
 8% 

Solved L4D2 Custom Weapon Reload Animation Bug (Any Fix?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SEGA EMPRESS ERIS
Senior Member
Join Date: Sep 2010
Location: THE-MILKY-WAY-GALAXY
Old 02-16-2021 , 22:40   L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #1

https://www.youtube.com/watch?v=tozEBkBGD50

had this bug for a while after a VALVe update bugged some custom weapons of mine anyone know a fix?

example if u need to see 1 in the workshop and see if its reload is bugged for you.

search left 4 dead 2 workshop:

Remington MSR Camo (Replaces Steyr Scout)

camo'ed steryr scout. let me know if it has the reload skip animation as seen in this video for yours.

i verified game cache, reinstalled game, even reformatted windows. bug is still there after a valve update. before the update, this was not present on ANY custom weapons i had in forever. this is the first time ive ever seen this bug on anything in l4d2.
__________________

Last edited by SEGA EMPRESS ERIS; 02-26-2021 at 17:04.
SEGA EMPRESS ERIS is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 02-17-2021 , 05:52   Re: L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #2

The issue you are having is the server and client reload animation duration are not matching.
any change you make to correct this server side to match your addons will cause the same issue with vanilla reloading.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D

Last edited by Lux; 02-17-2021 at 05:54.
Lux is offline
SpaceWashingMachine
Junior Member
Join Date: Nov 2016
Old 02-18-2021 , 11:02   Re: L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #3

I remember fixing this myself ages ago so apologies for old/sloppy code, feel free to fix it yourself, but this should work. If it doesn't try tinkering the + 2.0. Place the HookEvent in OnPluginStart. This used to happen to basically every weapon before Last Stand if the weapon playback rate was changed during reload.

PHP Code:
HookEvent("weapon_reload"ReloadAnimFix);

public 
ReloadAnimFix(Handle:hEventString:sName[], bool:bDontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    new 
weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    
CreateTimer(0.1timerFixReloadAnimEntIndexToEntRef(weapon), TIMER_FLAG_NO_MAPCHANGE TIMER_REPEAT);
}

public 
Action:timerFixReloadAnim(Handle:timerany:ref)
{
    new 
weapon EntRefToEntIndex(ref);
    if(
weapon == INVALID_ENT_REFERENCE || weapon <= MaxClients || !IsValidEntity(weapon))
        return 
Plugin_Stop;

    if(
GetEntProp(weaponProp_Send"m_bInReload") == 0)
    {
        
SetEntPropFloat(weaponProp_Send"m_flTimeWeaponIdle"GetGameTime() + 2.0);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;


Last edited by SpaceWashingMachine; 02-18-2021 at 11:05.
SpaceWashingMachine is offline
SEGA EMPRESS ERIS
Senior Member
Join Date: Sep 2010
Location: THE-MILKY-WAY-GALAXY
Old 02-25-2021 , 03:52   Re: L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #4

Quote:
Originally Posted by SpaceWashingMachine View Post
I remember fixing this myself ages ago so apologies for old/sloppy code, feel free to fix it yourself, but this should work. If it doesn't try tinkering the + 2.0. Place the HookEvent in OnPluginStart. This used to happen to basically every weapon before Last Stand if the weapon playback rate was changed during reload.

PHP Code:
HookEvent("weapon_reload"ReloadAnimFix);

public 
ReloadAnimFix(Handle:hEventString:sName[], bool:bDontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    new 
weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    
CreateTimer(0.1timerFixReloadAnimEntIndexToEntRef(weapon), TIMER_FLAG_NO_MAPCHANGE TIMER_REPEAT);
}

public 
Action:timerFixReloadAnim(Handle:timerany:ref)
{
    new 
weapon EntRefToEntIndex(ref);
    if(
weapon == INVALID_ENT_REFERENCE || weapon <= MaxClients || !IsValidEntity(weapon))
        return 
Plugin_Stop;

    if(
GetEntProp(weaponProp_Send"m_bInReload") == 0)
    {
        
SetEntPropFloat(weaponProp_Send"m_flTimeWeaponIdle"GetGameTime() + 2.0);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;

it didnt compile with latest sourcemod. let me know if u fix it would love to try it. post here if u do! thx <3
__________________
SEGA EMPRESS ERIS is offline
SpaceWashingMachine
Junior Member
Join Date: Nov 2016
Old 02-25-2021 , 04:19   Re: L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #5

Right yeah sorry I just extracted the code from another plugin of mine, here try this:
PHP Code:
#include <sourcemod>

public Plugin:myinfo 
{
    
name "[L4D2] Reload Animation Fix",
    
author "SpaceWashingMachine",
    
description "Fixes reload animations sometimes playing again after reload ends.",
    
version "1.0",
    
url ""
}

public 
OnPluginStart()
{
     
HookEvent("weapon_reload"ReloadAnimFix); 
}

public 
ReloadAnimFix(Handle:hEventString:sName[], bool:bDontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    new 
weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    
CreateTimer(0.1timerFixReloadAnimEntIndexToEntRef(weapon), TIMER_FLAG_NO_MAPCHANGE TIMER_REPEAT);
}

public 
Action:timerFixReloadAnim(Handle:timerany:ref)
{
    new 
weapon EntRefToEntIndex(ref);
    if(
weapon == INVALID_ENT_REFERENCE || weapon <= MaxClients || !IsValidEntity(weapon))
        return 
Plugin_Stop;

    if(
GetEntProp(weaponProp_Send"m_bInReload") == 0)
    {
        
SetEntPropFloat(weaponProp_Send"m_flTimeWeaponIdle"GetGameTime() + 2.0);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;

Attached Files
File Type: sp Get Plugin or Get Source (reloadanimfix.sp - 254 views - 1.0 KB)
SpaceWashingMachine is offline
SEGA EMPRESS ERIS
Senior Member
Join Date: Sep 2010
Location: THE-MILKY-WAY-GALAXY
Old 02-25-2021 , 20:20   Re: L4D2 Custom Weapon Reload Animation Bug (Any Fix?)
Reply With Quote #6

Quote:
Originally Posted by SpaceWashingMachine View Post
Right yeah sorry I just extracted the code from another plugin of mine, here try this:
PHP Code:
#include <sourcemod>

public Plugin:myinfo 
{
    
name "[L4D2] Reload Animation Fix",
    
author "SpaceWashingMachine",
    
description "Fixes reload animations sometimes playing again after reload ends.",
    
version "1.0",
    
url ""
}

public 
OnPluginStart()
{
     
HookEvent("weapon_reload"ReloadAnimFix); 
}

public 
ReloadAnimFix(Handle:hEventString:sName[], bool:bDontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    new 
weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    
CreateTimer(0.1timerFixReloadAnimEntIndexToEntRef(weapon), TIMER_FLAG_NO_MAPCHANGE TIMER_REPEAT);
}

public 
Action:timerFixReloadAnim(Handle:timerany:ref)
{
    new 
weapon EntRefToEntIndex(ref);
    if(
weapon == INVALID_ENT_REFERENCE || weapon <= MaxClients || !IsValidEntity(weapon))
        return 
Plugin_Stop;

    if(
GetEntProp(weaponProp_Send"m_bInReload") == 0)
    {
        
SetEntPropFloat(weaponProp_Send"m_flTimeWeaponIdle"GetGameTime() + 2.0);
        return 
Plugin_Stop;
    }

    return 
Plugin_Continue;

Thanks this one worked. is there a plugin for custom weapon reload animations too? to match custom reload speeds or the default if they arent sychronized?

thank you for your time. <3
__________________
SEGA EMPRESS ERIS 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 02:28.


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