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

give player npc animations


Post New Thread Reply   
 
Thread Tools Display Modes
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-04-2010 , 02:04   Re: give player npc animations
Reply With Quote #11

Quote:
Originally Posted by Mecha the Slag View Post
does the above work for TF2 also?
I've heard that TF2 player animations are client-side.
__________________
FaTony is offline
Andersso
Member
Join Date: Nov 2009
Location: E8 2A 2A 2A 2A
Old 12-04-2010 , 11:03   Re: give player npc animations
Reply With Quote #12

Unsure if it's useful for anyone, but I tested out the PlayerAnimEvent tempent today in DoD:S and I was able to set animations such as jump, shoot, reloading. I guess it's the same as the PLAYER_ANIM enum. I'm unsure if it works in other games, but it should atleast in some others, most of the games have this tempent.

PHP Code:
#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
AddTempEntHook("PlayerAnimEvent"OnPlayerAnimEvent);
    
    
RegConsoleCmd("test_playeranimevent"Command_TestPlayerAnimEvent);
}

public 
Action:OnPlayerAnimEvent(const String:te_name[], const Players[], numClientsFloat:delay)
{
    new 
client    TE_ReadNum("m_hPlayer");
    new 
event    TE_ReadNum("m_iEvent");
    new 
data    TE_ReadNum("m_nData");
    
    
PrintToChatAll("AnimEvent: Player: %i, Event: %i, Data: %i"clienteventdata);
}

public 
Action:Command_TestPlayerAnimEvent(clientargs)
{
    
decl String:arg1[64], String:arg2[64], String:arg3[64];
    
    
GetCmdArg(1arg1sizeof(arg1));
    
GetCmdArg(2arg2sizeof(arg2));
    
GetCmdArg(3arg3sizeof(arg3));
    
    
TE_Start("PlayerAnimEvent");
    
    
TE_WriteNum("m_hPlayer"StringToInt(arg1));
    
TE_WriteNum("m_iEvent"StringToInt(arg2));
    
TE_WriteNum("m_nData"StringToInt(arg3));
    
    
TE_SendToAll();

Andersso is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-15-2010 , 18:00   Re: give player npc animations
Reply With Quote #13

okay i have done some messing around and stuff. how would i set an animation for a model then?

more spesificly "models/zombie/classic.mdl" model and these are the animations
Code:
ACT_IDLE
ACT_RUN
ACT_WALK
ACT_RANGE_ATTACK1
__________________
Master(d)



Master53 is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-15-2010 , 18:48   Re: give player npc animations
Reply With Quote #14

i i think i have worked out how to use the offset. but nothing still hapening


Code:
296    CHL2MP_Player::SetAnimation(PLAYER_ANIM)
PHP Code:
static Handle:hSetAnimation;
static 
Handle:hGameConfig;

    
//Handle:
    
hGameConfig LoadGameConfigFile("ZombieMod.gamedata");

    
//Not File Found:
    
if(hGameConfig != INVALID_HANDLE)
    {
        
hGameConfig LoadGameConfigFile("ZombieMod.gamedata");
        
StartPrepSDKCall(SDKCall_Player);
        
PrepSDKCall_SetFromConf(hGameConfigSDKConf_Virtual"SetAnimation");
        
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
        
hSetAnimation EndPrepSDKCall();

        
//Not Failed:
        
if(hSetAnimation == INVALID_HANDLE)
        {

            
//Print Fail State:
            
SetFailState("|ZM| - Failure Loading 'hSetAnimation' Offset");
        }

        
//Close:
        
CloseHandle(hGameConfig);
    } 
Code:
"Games"
{
    "#default"
    {
        "#supported"
        {
            "game"        "hl2mp"
        }

        "Offsets"
        {

            "SetAnimation"
            {
                "windows"    "296"
                "linux"        "297"
            }
        }
    }
}
__________________
Master(d)



Master53 is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-17-2010 , 07:09   Re: give player npc animations
Reply With Quote #15

so is the code above wrong or something because its not doing anything
__________________
Master(d)



Master53 is offline
Andersso
Member
Join Date: Nov 2009
Location: E8 2A 2A 2A 2A
Old 12-17-2010 , 09:11   Re: give player npc animations
Reply With Quote #16

Quote:
Originally Posted by Andersso View Post
I'm unsure if it works in other games
By the way it's the same as your SDKCall.
Andersso is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-17-2010 , 09:33   Re: give player npc animations
Reply With Quote #17

iv tryed
PHP Code:
TE_Start("PlayerAnimEvent"); 
but it returms am error

Code:
L 12/17/2010 - 15:27:29: [SM] Native "AddTempEntHook" reported: Invalid TempEnt
ty name: "PlayerAnimEvent"
L 12/17/2010 - 15:27:29: [SM] Displaying call stack trace for plugin "ZombieSur
ival.smx":
L 12/17/2010 - 15:27:29: [SM]   [0]  Line 373, ZombieSurvival.sp::OnMapStart()
__________________
Master(d)




Last edited by Master53; 12-17-2010 at 10:28.
Master53 is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 12-17-2010 , 10:46   Re: give player npc animations
Reply With Quote #18

i try not to reply to any of your threads master53 since you make simple things extremely complicated and don't seem to understand simple things that people tell you when trying to help. also you reply with nonsense most of the time in other people help threads.

anyway, you don't need an sdkcall for playing animations, setting "m_nSequence" to the enum value of the animation you want will play it. BUT you can't play animations on player entities because they mainly use pose parameters to change the way the model appears depending on the clients actions e.g crouch, look around etc, this is checked every gameframe and will override any animations played on the model.
blodia is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 12-17-2010 , 11:50   Re: give player npc animations
Reply With Quote #19

Yeah.....if you will make it right you have to store the animations in the model......
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 12-18-2010 , 11:26   Re: give player npc animations
Reply With Quote #20

In a mod I worked on before I was able to use SetAnimation(PLAYER_ANIM) to set the basic things like Andersso did with the tempent, but I was never able to set frame by frame animation.
__________________
CrimsonGT 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 17:40.


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