AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to hook animation ? (https://forums.alliedmods.net/showthread.php?t=196756)

Bos93 09-25-2012 09:33

How to hook animation ?
 
PHP Code:

enum 
{
    
KNIFE_IDLE 0,
    
KNIFE_SLASH1,
    
KNIFE_SLASH2,
    
KNIFE_DRAW,
    
KNIFE_STAB,
    
KNIFE_STAB_MISS,
    
KNIFE_MIDSLASH1,
    
KNIFE_MIDSLASH2


Emit_Sound ?

Is there a better idea?

Or

Draw anim - Ham_Item_Deploy

SLASH - Ham_Weapon_PrimaryAttack

But,how to hook STAB , MISS , MIDSLASH ?

I blocked all the animations,I need to play new animations

Arkshine 09-25-2012 10:55

Re: How to hook animation ?
 
You would need to hook CBasePlayerWeapon::SendWeaponAnim(), with either Hamsandwich (the updated version), or Orpheu/Rage.

Bos93 09-25-2012 11:09

Re: How to hook animation ?
 
Arkshine,thanks.

csoldjb 09-26-2012 07:57

Re: How to hook animation ?
 
you can also try register_message(SVC_WEAPONANIM,"Message_Weap onAnim") and use get_msg_arg_int to get animation.

Bos93 09-26-2012 08:46

Re: How to hook animation ?
 
csoldjb, get_msg_arg_int( number ? )

How do I know all the arguments?

.Dare Devil. 09-26-2012 13:17

Re: How to hook animation ?
 
Quote:

Originally Posted by Bos93 (Post 1806827)
csoldjb, get_msg_arg_int( number ? )

How do I know all the arguments?

Did you know that that the animatsions are numbers.
Example in player model we have
dummy = 0
idle = 1
run = 2
...

with this get_msg_arg_int you get all information what do you need.
in there we have
PHP Code:

enum  

    
KNIFE_IDLE 0// int 0
    
KNIFE_SLASH1,  // int 1
    
KNIFE_SLASH2,   // int 2
    
KNIFE_DRAW,  // ...
    
KNIFE_STAB
    
KNIFE_STAB_MISS
    
KNIFE_MIDSLASH1
    
KNIFE_MIDSLASH2  // int 7


// use format
value = get_msg_arg_int()

NiHiLaNTh 09-26-2012 15:20

Re: How to hook animation ?
 
Quote:

Originally Posted by csoldjb (Post 1806810)
you can also try register_message(SVC_WEAPONANIM,"Message_Weap onAnim") and use get_msg_arg_int to get animation.

I remember that I tried to hook SVC WEAPONANIM, but it even didnt printed the debug results, so I am not sure if it can be hooked :?

Arkshine 09-26-2012 15:22

Re: How to hook animation ?
 
It can be hooked. It's a message sent from the game, it will work but it would be more simple and efficient to hook the virtual function SendWeaponAnim instead. (Ham or Orpheur/Rage)


All times are GMT -4. The time now is 08:10.

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