Raised This Month: $ Target: $400
 0% 

EngFunc_WalkMove Sequence Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-28-2014 , 04:11   Re: EngFunc_WalkMove Sequence Problem
Reply With Quote #1

meTaLiCroSS, thank you. I'm done with topic.

1. This code works perfectly but the NPC will be stuck in the edge:
PHP Code:
SetVelocity(iEntFloat:flAngles[3]) 

          static 
Float:Direction[3]; 
          
angle_vector(flAnglesANGLEVECTOR_FORWARDDirection); 
          
xs_vec_mul_scalar(Direction100.0Direction); 
          
entity_set_vector(iEntEV_VEC_velocityDirection); 
          
UTIL_ZombieSeq(iEntSEQ_WALK); 

2. This code works perfectly too but when NPC collides with wall or something else, it can't move diagonally.
PHP Code:
SetVelocity(iEntFloat:flAngles[3]) 

          
engfunc(EngFunc_WalkMoveiEntflAngles[1], 100.0/100.0WALKMOVE_NORMAL); 
          
UTIL_ZombieSeq(iEntSEQ_WALK); 

3. This code solved my problem, I combined first code with the second code above like this and NPC can move diagonally although it collides with wall or something, it won't be stuck at the edge.
PHP Code:
SetVelocity(iEntFloat:flAngles[3]) 

          static 
Float:Direction[3]; 
          
engfunc(EngFunc_WalkMoveiEntflAngles[1], 100.0/100.0WALKMOVE_NORMAL); 
          
angle_vector(flAnglesANGLEVECTOR_FORWARDDirection); 
          
xs_vec_mul_scalar(Direction100.0Direction); 
          
entity_set_vector(iEntEV_VEC_velocityDirection); 
          
UTIL_ZombieSeq(iEntSEQ_WALK); 


But I have another problem, it is about death animation. I want to play death animation when the NPC is killed and I have tested with two methods. Both don't work with EngFunc_AnimationAutomove.

First code. I tried it in Ham_Killed.
PHP Code:
RegisterHam(Ham_Killed"info_target""fwd_Killed");


public 
fwd_Killed(iEntiAttacker)
{
    if (!
is_valid_ent(iAttacker) || !is_valid_ent(iEnt)) return HAM_SUPERCEDE;
    
    new 
szClassname[33];
    
entity_get_string(iEntEV_SZ_classnameszClassnamesizeof szClassname);
    
    if (
equal(ZOMBIE_CLASSNAMEszClassname))
    {
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 5.0);
        
entity_set_int(iEntEV_INT_solidSOLID_NOT)
        
UTIL_ZombieSeq(iEntrandom_num(SEQ_DEATH1SEQ_DEATH10));
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

UTIL_ZombieSeq(iEntiSeq)
{
    if (!
is_valid_ent(iEnt)) return;
    
    
entity_set_int(iEntEV_INT_sequenceiSeq);
    
//entity_set_float(iEnt, EV_FL_animtime, 10.0);
    
entity_set_float(iEntEV_FL_framerate1.0);
    
engfunc(EngFunc_AnimationAutomoveiEnt1.0);

Second code. I tried it by checking entity's health in fwd_Think and neither work.
PHP Code:
register_think(ZOMBIE_CLASSNAME"fwd_Think");

public 
fwd_Think(iEnt)
{
    if (!
is_valid_ent(iEnt))
        return 
FMRES_SUPERCEDE;
    
    new 
Float:flHealth entity_get_float(iEntEV_FL_health);
    
    if (
flHealth <= 0.0)
    {
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 5.0);
        
entity_set_int(iEntEV_INT_solidSOLID_NOT)
        
UTIL_ZombieSeq(iEntrandom_num(SEQ_DEATH1SEQ_DEATH10));
    }
}

UTIL_ZombieSeq(iEntiSeq)
{
    if (!
is_valid_ent(iEnt)) return;
    
    
entity_set_int(iEntEV_INT_sequenceiSeq);
    
//entity_set_float(iEnt, EV_FL_animtime, 10.0);
    
entity_set_float(iEntEV_FL_framerate1.0);
    
engfunc(EngFunc_AnimationAutomoveiEnt1.0);

Any solutions?

Thank you
__________________
What are you looking for here?

Last edited by DavidJr; 01-28-2014 at 04:18.
DavidJr 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 10:15.


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