Raised This Month: $ Target: $400
 0% 

NPC size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-05-2014 , 13:14   Re: NPC size
Reply With Quote #1

If it is going to be 2 times bigger, I think it would be (mins){-32.0, -32.0, -72.0}, (maxs){32.0, 32.0, 72.0}, but this is only for player models. You need to set entity size depending on your needs and your model.
klippy is online now
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 11-06-2014 , 11:38   Re: NPC size
Reply With Quote #2

get a random player min an max size (just get values if you don't know them), aply theses size * 2 on your ent.

Last edited by Fr33m@n; 11-06-2014 at 11:39.
Fr33m@n is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-06-2014 , 12:17   Re: NPC size
Reply With Quote #3

Quote:
Originally Posted by Fr33m@n View Post
get a random player min an max size (just get values if you don't know them), aply theses size * 2 on your ent.
Dont need to, klippy was correct. Already have it working. But the npc isnt moving. Maybe because of map. Movement function is working i guess cuz at least it plays the right animations and hit players when they are at the hit range. I will try a npc map when i am home, if still not working i post here the code. And thanks

Edit:
Well, when i use normal size it works but when i double the size, npc isnt moved:
PHP Code:
public walk(ent)
{
    static 
Float:OriginAhead[3]
    
get_position(Ent300.00.00.0OriginAhead)
                        
    
Aim_To(EntEnemyOrigin
    
hook_ent2(EntOriginAhead120.0)
}

public 
Aim_To(entFloat:Origin[3]) 
{
    static 
Float:Vec[3], Float:Angles[3]
    
pev(entpev_originVec)
    
    
Vec[0] = Origin[0] - Vec[0]
    
Vec[1] = Origin[1] - Vec[1]
    
Vec[2] = Origin[2] - Vec[2]
    
engfunc(EngFunc_VecToAnglesVecAngles)
    
Angles[0] = Angles[2] = 0.0 
    
    set_pev
(entpev_anglesAngles)
}

public 
FindClosetEnemy(entcan_see)
{
    static 
Float:maxdistancemaxdistance 4980.0
    
static indexidindexid 0
    
static Float:current_discurrent_dis maxdistance

    
for(new ;<= g_MaxPlayersi++)
    {
        if(
can_see)
        {
            if(
is_user_alive(i) && can_see_fm(enti) && entity_range(enti) < current_dis)
            {
                
current_dis entity_range(enti)
                
indexid i
            
}
        } else {
            if(
is_user_alive(i) && entity_range(enti) < current_dis)
            {
                
current_dis entity_range(enti)
                
indexid i
            
}            
        }
    }    
    
    return 
indexid
}

public 
bool:can_see_fm(entindex1entindex2)
{
    if (!
entindex1 || !entindex2)
        return 
false

    
if (pev_valid(entindex1) && pev_valid(entindex1))
    {
        new 
flags pev(entindex1pev_flags)
        if (
flags EF_NODRAW || flags FL_NOTARGET)
        {
            return 
false
        
}

        new 
Float:lookerOrig[3]
        new 
Float:targetBaseOrig[3]
        new 
Float:targetOrig[3]
        new 
Float:temp[3]

        
pev(entindex1pev_originlookerOrig)
        
pev(entindex1pev_view_ofstemp)
        
lookerOrig[0] += temp[0]
        
lookerOrig[1] += temp[1]
        
lookerOrig[2] += temp[2]

        
pev(entindex2pev_origintargetBaseOrig)
        
pev(entindex2pev_view_ofstemp)
        
targetOrig[0] = targetBaseOrig [0] + temp[0]
        
targetOrig[1] = targetBaseOrig [1] + temp[1]
        
targetOrig[2] = targetBaseOrig [2] + temp[2]

        
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player
        
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater))
        {
            return 
false
        

        else 
        {
            new 
Float:flFraction
            get_tr2
(0TraceResult:TR_flFractionflFraction)
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
            {
                return 
true
            
}
            else
            {
                
targetOrig[0] = targetBaseOrig [0]
                
targetOrig[1] = targetBaseOrig [1]
                
targetOrig[2] = targetBaseOrig [2]
                
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player
                
get_tr2(0TraceResult:TR_flFractionflFraction)
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                {
                    return 
true
                
}
                else
                {
                    
targetOrig[0] = targetBaseOrig [0]
                    
targetOrig[1] = targetBaseOrig [1]
                    
targetOrig[2] = targetBaseOrig [2] - 17.0
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player
                    
get_tr2(0TraceResult:TR_flFractionflFraction)
                    if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                    {
                        return 
true
                    
}
                }
            }
        }
    }
    return 
false
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    if(!
pev_valid(ent))
        return
        
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_anglesvAngle// if normal entity ,use pev_angles
    
    
vAngle[0] = 0.0
    
    angle_vector
(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock hook_ent2(entFloat:VicOrigin[3], Float:speed)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:fl_Velocity[3], Float:EntOrigin[3], Float:distance_fFloat:fl_Time
    
    pev
(entpev_originEntOrigin)
    
    
distance_f get_distance_f(EntOriginVicOrigin)
    
fl_Time distance_f speed
        
    fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
    fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
    fl_Velocity
[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time

    set_pev
(entpev_velocityfl_Velocity)

Maybe npc cant see player and i must change the angles? i am not sure whats the problem...
__________________

Last edited by Jhob94; 11-06-2014 at 16:58.
Jhob94 is online now
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:29.


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