Raised This Month: $ Target: $400
 0% 

EngFunc_WalkMove Sequence Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-21-2014 , 05:39   EngFunc_WalkMove Sequence Problem
Reply With Quote #1

Hello, I'm trying to make NPC and I've problem with EngFunc_WalkMove to set walk sequence. The sequence is buggy when walk, but when collide with wall or something the animation plays perfectly. I ever read from somewhere to set the velocity but it neither working. Any suggestion?

PHP Code:
register_think(ZOMBIE_CLASSNAME"fwd_Think");

Public 
fwd_Think(iEnt)
{
    if (!
is_valid_ent(iEnt))
        return 
FMRES_SUPERCEDE;
    
    new 
Float:vOrigin[3], Float:pOrigin[3]
    
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"a");
    
    new 
iClosestPlayer 0iFarthestPlayer 0Float:flMinDist 100.0Float:flMaxDist 1000.0;
    new 
iPlayerFloat:flDist;
    
    for (new 
0iNumi++)
    {
        
iPlayer iPlayers[i];
        
entity_get_vector(iPlayerEV_VEC_originpOrigin);
        
entity_get_vector(iEntEV_VEC_originvOrigin);
        
        
flDist entity_range(iPlayeriEnt);
        
        if (
flDist flMinDist)
        {
            
iClosestPlayer iPlayer;
            
flMinDist flDist;
        }
        else if (
flMinDist flDist flMaxDist)
        {
            
iFarthestPlayer iPlayer;
            
flMaxDist flDist;
        }
    }
    
    if (
iClosestPlayer)
    {
        
SetTarget(iEntiClosestPlayer);
        
UTIL_ZombieSeq(iEntSEQ_ATTACK);
        
        
ExecuteHam(Ham_TakeDamageiClosestPlayeriEntiEnt20.0DMG_SLASH);
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 2.0);
    }
    else if (
iFarthestPlayer)
    {
        
SetTarget(iEntiFarthestPlayer);
        
UTIL_ZombieSeq(iEntSEQ_WALK);
        
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.01);
    }
    else
    {
        
UTIL_ZombieSeq(iEntSEQ_IDLE);
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.01);
    }
    return 
FMRES_IGNORED;
}

SetTarget(iEntiPlayer
{
    static 
Float:iOrigin[3], Float:entOrigin[3], Float:iAngles[3];
    
pev(iPlayerpev_originiOrigin);
    
pev(iEntpev_originentOrigin);
    
    
xs_vec_sub(iOriginentOriginiOrigin);
    
xs_vec_normalize(iOriginiOrigin);
    
vector_to_angle(iOriginiAngles);
    
    
iAngles[0] = 0.0;
    
    
entity_set_vector(iEntEV_VEC_anglesiAngles);
    
SetVelocity(iEntiAngles);
}

SetVelocity(iEntFloat:flAngles[3])//Float:flAngles) 
{
    
engfunc(EngFunc_WalkMoveiEntflAngles[1], 2.0WALKMOVE_NORMAL);
    
    
UTIL_ZombieSeq(iEntSEQ_WALK);

__________________
What are you looking for here?

Last edited by DavidJr; 01-21-2014 at 05:41.
DavidJr is offline
 



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 10:15.


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