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

SetAnimation dude.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fearAR
Veteran Member
Join Date: Oct 2010
Old 01-20-2013 , 22:25   SetAnimation dude.
Reply With Quote #1

Hi, I am playing with m_szAnimExtention, changing its values to my requirements, and It is working perfect, but I have one dude about the use of it. For example I change the value of m_szAnimExtention to "bow", so the function will search for "ref_aim_bow"/"crouch_aim_bow"/"ref_shoot..." inside the model's sequence list, and then it will work, or it doesn't work that way?

and other dude:

The Engine looks inside the new model for the model's total frame value of each sequence, or it just take it from one variable, so it is saved. I'm asking this because I have some problems when I use a new sequence in place of "mp5" sequences, because this new sequence have a different amount of frames, and the sequence takes an acceleration.

PHP Code:
void GetSequenceInfovoid *pmodelentvars_t *pevfloat *pflFrameRatefloat *pflGroundSpeed )
{
    
studiohdr_t *pstudiohdr;
    
    
pstudiohdr = (studiohdr_t *)pmodel;
    if (! 
pstudiohdr)
        return;

    
mstudioseqdesc_t    *pseqdesc;

    if (
pev->sequence >= pstudiohdr->numseq)
    {
        *
pflFrameRate 0.0;
        *
pflGroundSpeed 0.0;
        return;
    }

    
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr pstudiohdr->seqindex) + (int)pev->sequence;

    if (
pseqdesc->numframes 1)
    {
        *
pflFrameRate 256 pseqdesc->fps / (pseqdesc->numframes 1);
        *
pflGroundSpeed sqrtpseqdesc->linearmovement[0]*pseqdesc->linearmovement[0]+ pseqdesc->linearmovement[1]*pseqdesc->linearmovement[1]+ pseqdesc->linearmovement[2]*pseqdesc->linearmovement[2] );
        *
pflGroundSpeed = *pflGroundSpeed pseqdesc->fps / (pseqdesc->numframes 1);
    }
    else
    {
        *
pflFrameRate 256.0;
        *
pflGroundSpeed 0.0;
    }

I saw this in the SDK, and this gets the value of FrameRate per sequence, and I think it could be changed.

Grettings.

PHP Code:
int CBaseAnimating :: LookupSequence ( const char *label )
{
    
void *pmodel GET_MODEL_PTRENT(pev) );

    return ::
LookupSequencepmodellabel );

PHP Code:
//=========================================================
//=========================================================
void CBaseAnimating :: ResetSequenceInfo ( )
{
    
void *pmodel GET_MODEL_PTRENT(pev) );

    
GetSequenceInfopmodelpev, &m_flFrameRate, &m_flGroundSpeed );
    
m_fSequenceLoops = ((GetSequenceFlags() & STUDIO_LOOPING) != 0);
    
pev->animtime gpGlobals->time;
    
pev->framerate 1.0;
    
m_fSequenceFinished FALSE;
    
m_flLastEventCheck gpGlobals->time;

Edit: I saw this macro on LookUpSequence function:

PHP Code:
#define GET_MODEL_PTR                (*g_engfuncs.pfnGetModelPtr) 
And now the problem is, how to access this engFunc, so it could return me a value that I can set calling LookUpSequence's function with Orpheu.
__________________
~~~~ NPC AI ~~~~

[ Pathfinding - OK ]
[ Citizen AI - OK ]
[ Handle Weapons - --- ]

Last edited by fearAR; 01-20-2013 at 23:33.
fearAR is offline
Send a message via MSN to fearAR
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-22-2013 , 00:07   Re: SetAnimation dude.
Reply With Quote #2

Quote:
Originally Posted by fearAR View Post
Hi, I am playing with m_szAnimExtention, changing its values to my requirements, and It is working perfect, but I have one dude about the use of it. For example I change the value of m_szAnimExtention to "bow", so the function will search for "ref_aim_bow"/"crouch_aim_bow"/"ref_shoot..." inside the model's sequence list, and then it will work, or it doesn't work that way?.
https://forums.alliedmods.net/showpo...70&postcount=7
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
fearAR
Veteran Member
Join Date: Oct 2010
Old 01-22-2013 , 13:48   Re: SetAnimation dude.
Reply With Quote #3

I saw the SDK, but I'm not referring to that part, because I saw LookUpSequence function too, but I tried adding a new animation to the player, named:

ref_aim_bow
ref_shoot_bow

and I set the value of m_szAnimExtention to "bow", but It doesn't found the sequence and then It sets in "dummy" sequence, It seems to get the values in the precache list, from the original players, and then when LookUpSequence is used, It looks up inside an array.

For that reason I'm looking for a way to acces to GET_MODEL_PTR macro.

PHP Code:
int CBaseAnimating :: LookupSequence ( const char *label )
{
    
void *pmodel GET_MODEL_PTRENT(pev) );

    return ::
LookupSequencepmodellabel );

Greetings.
__________________
~~~~ NPC AI ~~~~

[ Pathfinding - OK ]
[ Citizen AI - OK ]
[ Handle Weapons - --- ]

Last edited by fearAR; 01-22-2013 at 13:55.
fearAR is offline
Send a message via MSN to fearAR
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-22-2013 , 14:11   Re: SetAnimation dude.
Reply With Quote #4

Quote:
and I set the value of m_szAnimExtention to "bow", but It doesn't found the sequence and then It sets in "dummy" sequence
just set the model index
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
fearAR
Veteran Member
Join Date: Oct 2010
Old 01-22-2013 , 15:21   Re: SetAnimation dude.
Reply With Quote #5

I tried setting the value that returns EngFunc_ModelIndex, to pev_modelindex of id, but it doesn't work, I think it is because EngFunc_GetModelPtr isnt the same as EngFunc_ModelIndex.

Directives from enginecallback.cpp;
PHP Code:
#define MODEL_INDEX        (*g_engfuncs.pfnModelIndex)
#define GET_MODEL_PTR                (*g_engfuncs.pfnGetModelPtr) 
Edit:

I'm using the way to prevent SVC_BAD error:

PHP Code:
public fm_set_user_modeltaskid )
{    
    if( 
is_valid_playerID_MODEL ) )
    {
        
set_user_info(ID_MODEL"model"g_player_modelID_MODEL ]);
        
        new 
szModel128 ];
        
        
formatexszModelsizeof szModel 1"models/player/%s/%s.mdl"
        
g_player_modelID_MODEL ],
                
g_player_modelID_MODEL ] );
        
        new 
indexMdl engfuncEngFunc_ModelIndexszModel );
        
client_printID_MODELprint_chat"%d"indexMdl );
        
set_pevID_MODELpev_modelindexindexMdl );
    }

__________________
~~~~ NPC AI ~~~~

[ Pathfinding - OK ]
[ Citizen AI - OK ]
[ Handle Weapons - --- ]

Last edited by fearAR; 01-22-2013 at 15:23.
fearAR is offline
Send a message via MSN to fearAR
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-22-2013 , 20:16   Re: SetAnimation dude.
Reply With Quote #6

What about the modelindex offset
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
fearAR
Veteran Member
Join Date: Oct 2010
Old 01-22-2013 , 21:27   Re: SetAnimation dude.
Reply With Quote #7

It worked, thank you. Now I have a new problem, the sequence seems to be found, but when it has to be played it isn't, it stays like in the first frame.

* I added the two new sequences at the end of the QC Script, Could it be the problem?

Edit:

It is working fine with the Offset m_iModelIndex = 496.

* It gets the correct framerate per sequence.
* It founds the sequence correctly.

I added the animation before the die sequences. I didn't test with more than 111 sequences ( it is the max animation default for each player model in CS ), I deleted some sequences that I didnt use.
Now, I have a problem with the DIE sequences, I'm trying to fix it, ( the problem is that the sequence plays good except the legs, they stays like in dummy sequence ). If I have changes, I'll notice here.
__________________
~~~~ NPC AI ~~~~

[ Pathfinding - OK ]
[ Citizen AI - OK ]
[ Handle Weapons - --- ]

Last edited by fearAR; 01-23-2013 at 22:37.
fearAR is offline
Send a message via MSN to fearAR
Bos93
Veteran Member
Join Date: Jul 2010
Old 04-23-2013 , 08:11   Re: SetAnimation dude.
Reply With Quote #8

I can set animation with offset CBaseAnimating ? I want to set the animation at a random time of death. I have a new model with new animations.
__________________

Last edited by Bos93; 04-23-2013 at 08:12.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
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 01:32.


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