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

[L4D2]Any hook about viewmodel anim?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LinLinLin
Senior Member
Join Date: Sep 2021
Old 09-07-2022 , 04:27   [L4D2]Any hook about viewmodel anim?
Reply With Quote #1

"left4dhooks.l4d2.cfg" show some viewmodel sequence like "ACT_VM_HITRIGHT".
But i only get the thirdperson sequence when hook a client.
Is there some way that plugins can get or change the viewmodel sequence ?
PHP Code:
public void OnPluginStart()
{
    
RegConsoleCmd("sm_anim",Cmd_AnimHookEnabel);
}
public 
Action Cmd_AnimHookEnabel(int clientint args)
{
    if(
IsValidClient(client))
    {
        
AnimHookEnable(client,AnimHook_Callback);
    }
    return 
Plugin_Continue;
}
public 
Action AnimHook_Callback(int client,int &sequence)
{
    if(
IsValidClient(client) && sequence == 1176)
    {
        
sequence 1123;
        
PrintToChat(client,"change to sequence %d",sequence);
        return 
Plugin_Changed;
    }
    
// static int index;
    // if(IsValidClient(client) && index != sequence)
    // {
    //     PrintToChat(client,"change to sequence %d ",sequence);
    //     index = sequence;
    // }
    
return Plugin_Continue;


Last edited by LinLinLin; 09-08-2022 at 12:23.
LinLinLin is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 09-08-2022 , 12:38   Re: [L4D2]Any hook about viewmodel anim?
Reply With Quote #2

PHP Code:
int ent_view GetEntPropEnt(clientProp_Send"m_hViewModel"); 
ent_view maybe a CBaseViewModel.
I have get and set m_nLayerSequence prop, it can change the anim which define in weapon.txt;such as push or attack1.
But i still can't change the anim to other melee.If you try to set it in a different num,viewmodel will disapper.
Another thing is that you can set m_nModelIndex to change the viewmodel;such as knife to fireaxe.

Something fun is that when you using a fireaxe and change the m_nModelIndex to knife, you can get the cs1.6 animation of knife.I don't know why this happen.
LinLinLin is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 09-12-2022 , 18:10   Re: [L4D2]Any hook about viewmodel anim?
Reply With Quote #3

weapon sequence is the viewmodel sequence .

PHP Code:
    int active_weapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");
    if(
active_weapon == -1)
        return 
Plugin_Handled;
    
int m_nSequence GetEntProp(active_weapon,Prop_Send,"m_nSequence");//this is viewmodel sequence , can find in v_model.mdl in modelviewer 
Now i am sure that weapon can't play an undefined activity in v_model.mdl , such as knife play an axe slah animate .

If want to change the animate , simpliy do that

PHP Code:
    int viewmodel GetEntPropEnt(clientProp_Send"m_hViewModel");
    
SetEntProp(viewmodel ,Prop_Send,"m_nLayerSequence",index);//index is not the m_nSequence above , you need get prop first , and then select an animate you want and set prop. 
PS : Valve Developer Commuity show that : Come from this
  • All CBaseAnimating entities can play an animation.

So the other way is that detour SelectWeightedSequence(Activity) like AnimHookEnable() do in left4dhook .
It should be include weapon entity . (use cl_pdump entity to see an entity prop , melee_weapon is inherits from CBaseAnimating )

And I have another question is that can we invert an animate which has been defined and make it play ?
need some help!

Last edited by LinLinLin; 09-12-2022 at 18:12.
LinLinLin 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 15:01.


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