Raised This Month: $7 Target: $400
 1% 

Animation Only working in the Air or Swim.Animation Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
crashbandicoot
BANNED
Join Date: Mar 2012
Location: why will u come XD?
Old 02-14-2018 , 04:51   Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #1

My player model is "models/player/chicken/chicken.mdl"
public client_PreThink(entity) {
if(UserFlags[entity]) {
if(get_user_button(entity) & IN_ATTACK2) {
new atk1 = random_num(10,11)
set_pev(entity,pev_weaponanim,atk1)
set_pev(entity,pev_sequence,atk1)
set_pev(entity,pev_gaitsequence,atk1)
//entity_set_int(entity,EV_INT_sequence,atk1)
set_pev(entity,pev_framerate,1.0)
set_pev(entity,pev_frame, 0.0) //float and all frames start from 0.0
set_pev(entity,pev_animtime, get_gametime()) //float.Animationstartduration-get_gametime() is best for start it by currenttime
}
}
}
Note: Animation working while I am in the air or in the pool while I press IN_ATTACK2 button
Who Can Fix my problem ?
This problem >help me About this:come to skype . my skype : gabrielcrashlogan and help to me for this bug . still my body anim is not working . I do not know why . I think natural preveous default anims of cstrike(or czero) is blocking my body anims. Always it blocking body anim function when I use extra player model(Such as player/chicken/chicken.mdl or TeslaZombi.mdl or etc)i,I thing natural preveous anims of default hl1mod was blocking anims of other models. Please help to me ...and teache me this too : How I Should use dancerAnimation models's animations for my default cstrike models (such as gign....sas.....etc) ...Note:Animations are only WORKING while I fly(Jump in air) or swimming in the pool . Please help to me!
Attached Files
File Type: 7z ChickenModel.7z (12.5 KB, 88 views)
crashbandicoot is offline
Send a message via Skype™ to crashbandicoot
Old 02-14-2018, 06:41
ElooKoN
This message has been deleted by ElooKoN.
Old 02-14-2018, 08:26
crashbandicoot
This message has been deleted by HamletEagle. Reason: Wait 14 days before bumping.
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-14-2018 , 11:53   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #2

if(get_entity_flags(entity) & (FL_ONGROUND|FL_INWATER)) return;
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 02-14-2018 , 12:02   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #3

Quote:
Originally Posted by eyal282 View Post
if(get_entity_flags(entity) & (FL_ONGROUND|FL_INWATER)) return;
how this gona help if he want when he be in ground to work not to retun fast the value
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
crashbandicoot
BANNED
Join Date: Mar 2012
Location: why will u come XD?
Old 02-14-2018 , 12:54   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #4

how I can use this script for my Plugin ? Please go to skype . I want throw full plugin by its converted .AMXX file . Still I have same problem . and I do not know what to do
crashbandicoot is offline
Send a message via Skype™ to crashbandicoot
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 02-14-2018 , 16:38   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #5

I got your PMs and I'm sorry but I have no knowledge of AMX Mod X.
__________________
Psyk0tik is offline
Adam Richard
New Member
Join Date: Jun 2015
Location: Brazil.
Old 02-14-2018 , 17:27   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #6

Hey.

Have you tried to use m_Activity/m_IdealActivity offsets ? it helped me with similar problem sometime ago.
For reference, check this function :

PHP Code:
const ACT_RANGE_ATTACK1         28;
const 
ACT_RELOAD            32;

SetAnimationpPlayerpActivity )
{
    if( 
pev_validpPlayer ) != PDATA_SAFE )
        return;
    
    
#define ACT_SWIM         6
    #define ACT_LEAP         8
    #define ACT_HOVER         50
   
    // CBaseAnimating
    
const m_flFrameRate         36;
    const 
m_flGroundSpeed         37;
    const 
m_flLastEventCheck     38;
    const 
m_fSequenceFinished     39;
    const 
m_fSequenceLoops         40;
   
    
// CBaseMonster
    
const m_Activity         73;
    const 
m_IdealActivity         74;
    
    new 
iAnimDesirediActivity get_pdata_intpPlayerm_Activity);

    if( 
iActivity == ACT_SWIM || iActivity == ACT_LEAP || iActivity == ACT_HOVER )   
    {
        return;
    }
   
    new 
szAnim64 ], Float:flFrameRateFloat:tTime
    get_pdata_string
pPlayerm_szAnimExtentionszAnimcharsmaxszAnim ), 020 );
    
    
tTime get_gametime( );
    
    if( 
pActivity == ACT_RANGE_ATTACK1 )
    {
        
formatszAnimcharsmaxszAnim ), ( entity_get_intpPlayerEV_INT_flags ) & FL_DUCKING ) ? "crouch_shoot_%s" "ref_shoot_%s"szAnim );
    }
    else if( 
pActivity == ACT_RELOAD )
    {
        
formatszAnimcharsmaxszAnim ), ( entity_get_intpPlayerEV_INT_flags ) & FL_DUCKING ) ? "crouch_reload_%s" "ref_reload_%s"szAnim );
    }
    
    if( ( 
iAnimDesired lookup_sequencepPlayerszAnimflFrameRate ) ) == -)
    {
        
iAnimDesired 0;
    }
    
    
entity_set_floatpPlayerEV_FL_frame0.0 );
    
entity_set_floatpPlayerEV_FL_framerate1.0 );
    
entity_set_intpPlayerEV_INT_sequenceiAnimDesired );
    
entity_set_floatpPlayerEV_FL_animtimetTime );
   
    
set_pdata_intpPlayerm_fSequenceLoops0);
    
set_pdata_intpPlayerm_fSequenceFinished0);
    
set_pdata_intpPlayerm_ActivitypActivity);     // that's how we do set player's internal activities
    
set_pdata_intpPlayerm_IdealActivitypActivity);     // that's how we do set player's internal ideal activities
   
    
set_pdata_floatpPlayerm_flGroundSpeed0.0);
    
set_pdata_floatpPlayerm_flFrameRateflFrameRate);
    
set_pdata_floatpPlayerm_flLastEventChecktTime);

You can find a list of some useful activities below.

HTML Code:
/Half-Life SDK/Player Models/Modeling Tutorial.doc 

1	ACT_IDLE
2	ACT_GUARD,
3	ACT_WALK,
4	ACT_RUN,
5	ACT_FLY,				// Fly (and flap if appropriate)
6	ACT_SWIM,
7	ACT_HOP,				// vertical jump
8	ACT_LEAP,				// long forward jump
9	ACT_FALL,
...
Please, download full sdk for more informations
[edited]

Just decided to bring a working contextual-example.

PHP Code:
// some offsets
stock const m_flAnimationTimeDummy 105;
stock const m_Activity 73;

// chicken.mdl internal informations
stock const iIdleAttack 10// attack1 sequenceID
stock const iJumpAttack 11// attack2 sequenceID
stock const Float:fIdleAttackTime 0.58// 14 frames divided per 24fps ( should also be multiplied by pev_framerate )
stock const Float:fJumpAttackTime 1.20// 29 frames divided per 24fps ( should also be multiplied by pev_framerate )

// internal half-life activies
stock const ACT_RUN 4// running ?
stock const ACT_HOP 7// jumping ?
stock const ACT_LEAP 8// jumping forward ?

new Float:g_fNextAttack33 ]; // stores minimum possible time to exec next attack based in the animation time per player

public fm_PlayerPreThinkid )
{
    if ( 
g_bAliveid ] && ( pevidpev_button ) & IN_ATTACK2 ) )
    {
        new 
Float:fTime get_gametime();
        new 
iActivity get_pdata_intidm_Activity);
        new 
iGateSequence;
        
        if ( 
fTime g_fNextAttackid ] )
        {
            return 
FMRES_IGNORED;
        }
        if ( 
iActivity == ACT_RUN || iActivity == ACT_HOP || iActivity == ACT_LEAP )
        {
            
// exec attack2 if player is running or jumping
            
iGateSequence iJumpAttack;
            
fTime += fJumpAttackTime;
        }
        else
        {
            
// else, exec attack1
            
iGateSequence iIdleAttack;
            
fTime += fIdleAttackTime;
        }
        
g_fNextAttackid ] = fTime;
        
        
// sequence to display
        
set_pevidpev_gaitsequenceiGateSequence );
        
// next activity check
        
set_pdata_floatidm_flAnimationTimeDummyfTime);
    }
    return 
FMRES_IGNORED;

Attached Files
File Type: sma Get Plugin or Get Source (chickenAttackTest.sma - 521 views - 2.6 KB)

Last edited by Adam Richard; 02-15-2018 at 01:06. Reason: Adding a working example.
Adam Richard is offline
crashbandicoot
BANNED
Join Date: Mar 2012
Location: why will u come XD?
Old 03-01-2018 , 08:16   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #7

I don't want use get/set_pdata . Becasue Some pdatas are different between ConditionZero and cs16. Also only I want use pev_anime ........ still nobody answered my actual question . Why Animation not playing on the ground ? why only it works while user jump or fall in the air ..... or in swim ....... why animations not playing on the ground by pev_anime ? what was my mistake ?
if(get_user_button(entity) & IN_ATTACK2) { //Don't forget! usermodel is player/chicken/chicken.mdl
new atk1 = random_num(10,11)
set_pev(entity,pev_weaponanim,atk1)
set_pev(entity,pev_sequence,atk1)
set_pev(entity,pev_gaitsequence,atk1)
set_pev(entity,pev_framerate,1.0)
set_pev(entity,pev_frame, 0.0) //float and all frames start from 0.0
set_pev(entity,pev_animtime, get_gametime())
}

and who can hlep to this topic for block audio by Sound MSG register_message( get_user_msgid( "SendAudio" ), "MessageSendAudio","a") https://forums.alliedmods.net/showth...26#post2580826

Last edited by crashbandicoot; 03-01-2018 at 08:33.
crashbandicoot is offline
Send a message via Skype™ to crashbandicoot
crashbandicoot
BANNED
Join Date: Mar 2012
Location: why will u come XD?
Old 03-01-2018 , 08:17   Re: Animation Only working in the Air or Swim.Animation Problem
Reply With Quote #8

Quote:
Originally Posted by Adam Richard View Post
Hey.

Have you tried to use m_Activity/m_IdealActivity offsets ? it helped me with similar problem sometime ago.

I don't want use get/set_pdata . Becasue Some pdatas are different between ConditionZero and cs16. Also only I want use pev_anime ........ still nobody answered my actual question . Why Animation not playing on the ground ? why only it works while user jump or fall in the air ..... or in swim ....... why animations not playing on the ground by pev_anime ? what was my mistake ?
if(get_user_button(entity) & IN_ATTACK2) { //Don't forget! usermodel is player/chicken/chicken.mdl
new atk1 = random_num(10,11)
set_pev(entity,pev_weaponanim,atk1)
set_pev(entity,pev_sequence,atk1)
set_pev(entity,pev_gaitsequence,atk1)
set_pev(entity,pev_framerate,1.0)
set_pev(entity,pev_frame, 0.0) //float and all frames start from 0.0
set_pev(entity,pev_animtime, get_gametime())
}

and who can hlep to this topic for block audio by Sound MSG register_message( get_user_msgid( "SendAudio" ), "MessageSendAudio","a") https://forums.alliedmods.net/showth...26#post2580826

Last edited by crashbandicoot; 03-01-2018 at 08:33.
crashbandicoot is offline
Send a message via Skype™ to crashbandicoot
Reply


Thread Tools
Display Modes

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 05:14.


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