Raised This Month: $ Target: $400
 0% 

Speeding up weapon switch animation (m_flPlaybackRate)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LordMarqus
Senior Member
Join Date: Sep 2009
Location: Poland
Old 07-05-2011 , 10:16   Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #1

Hello,

I was trying to speed up a weapon equip in GunGame Turbo mode and it works:

PHP Code:
/* Offsets for weapon equip time change */
Offset_WeaponIdleTime FindSendPropOffs("CBaseCombatWeapon""m_flTimeWeaponIdle");
if (
Offset_WeaponIdleTime == INVALID_OFFSET)
{
    
SetFailState("FATAL ERROR Offset_WeaponIdleTime [%d]. Please contact the author."Offset_WeaponIdleTime);
}
    
Offset_NextAttack FindSendPropOffs("CBasePlayer""m_flNextAttack");
if (
Offset_NextAttack == INVALID_OFFSET)
{
    
SetFailState("FATAL ERROR Offset_NextAttack [%d]. Please contact the author."Offset_NextAttack);
}

...

new 
Float:currentTime GetGameTime();
SetEntDataFloat(entOffset_WeaponIdleTimecurrentTime + (GetEntDataFloat(entOffset_WeaponIdleTime) - currentTime) * EquipTimeMultipliertrue);
SetEntDataFloat(clientOffset_NextAttackcurrentTime + (GetEntDataFloat(clientOffset_NextAttack) - currentTime) * EquipTimeMultipliertrue); 
Second part executes just after player gets a new weapon.

Now the problem is that a weapon switch/equip animation is truncated. Is it possible to speed up that animation in a script? Maybe m_flPlaybackRate could help but when I read it, the value is always 0.0 and changing it does nothing. Maybe because I'm modifying it too late.

Thank you in advance for any help.
__________________
My public plugins: [CS:S/CS:GO] Last Man Standing

Last edited by LordMarqus; 07-05-2011 at 13:12.
LordMarqus is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 07-07-2011 , 00:19   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #2

Yes, that looks right. I posted something like this in the GunGame thread and later I found out blodia had also written something very similar. But why is missing the animation a problem? Are you wanting something that decreases the weapon switch time by half instead of eliminates it?
__________________
databomb is offline
LordMarqus
Senior Member
Join Date: Sep 2009
Location: Poland
Old 07-07-2011 , 06:55   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #3

Yes, I decrease it, because eliminating it is not what I want. And I used your code posted in GG:SM topic, so credits go to you.

Do you think it's even possible to change this animation?
__________________
My public plugins: [CS:S/CS:GO] Last Man Standing
LordMarqus is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 07-07-2011 , 08:41   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #4

Hmm, when I was looking for the ent properties for the weapons, I couldn't get the playback to speedup either. You might want to look at the values for
Quote:
235 CBaseCombatWeapon::SendWeaponAnim(int)
and see if it's possible to select an already existing one that's quicker. I'm not sure how to make a new one and tell it to do it in half the time - maybe there are some files in the GCF that could shed some light on the weapon animations.

Because I think if you set the idle time and next attack to cut off in the middle of the animation it will look jerky to the player, correct?
__________________
databomb is offline
LordMarqus
Senior Member
Join Date: Sep 2009
Location: Poland
Old 07-12-2011 , 04:36   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #5

Sorry for so late answer. The animation is truncated, it ends instantly after defined idle time. Yea, it's jerky.
__________________
My public plugins: [CS:S/CS:GO] Last Man Standing
LordMarqus is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 07-12-2011 , 18:13   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #6

which entity are you trying to change the animation speed on? if you're trying to change the clients viewmodel animation speed you have to use their predicted viewmodel entity which will cause prediction errors for clients with high pings.
blodia is offline
LordMarqus
Senior Member
Join Date: Sep 2009
Location: Poland
Old 07-12-2011 , 20:13   Re: Speeding up weapon switch animation (m_flPlaybackRate)
Reply With Quote #7

Well I actually don't know how to change it
__________________
My public plugins: [CS:S/CS:GO] Last Man Standing
LordMarqus 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 02:59.


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