Raised This Month: $ Target: $400
 0% 

NPC size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-05-2014 , 12:13   NPC size
Reply With Quote #1

When i create an npc, will the size match to the size of model i set to the npc or do i need to change entity size?
__________________
Jhob94 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-05-2014 , 12:29   Re: NPC size
Reply With Quote #2

No, it will not, you have to specify the size by yourself. Otherwise, I think it will just be non-solid. Although, there seems to be some cool new natives in 1.8.3(fakemeta I think) which may succeed to achieve that.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-05-2014 , 12:37   Re: NPC size
Reply With Quote #3

(^ Probably not recommended to use them, some changes are planned around them.)
__________________
Arkshine is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-05-2014 , 13:04   Re: NPC size
Reply With Quote #4

Idk much about modeling and setting sizes.
Give me an example please. Let's say i want to edit GIGN model and set it 2x bigger than normal. How i edit the model and what size i must put on the code?
__________________
Jhob94 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-05-2014 , 13:14   Re: NPC size
Reply With Quote #5

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 offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 11-06-2014 , 11:38   Re: NPC size
Reply With Quote #6

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 #7

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 offline
skz
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 11-08-2014 , 08:34   Re: NPC size
Reply With Quote #8

Why don't you try in a map larger than the map that you used? The npc could been stuck in some part of the map
__________________
skz is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-08-2014 , 08:40   Re: NPC size
Reply With Quote #9

Quote:
Originally Posted by skz View Post
Why don't you try in a map larger than the map that you used? The npc could been stuck in some part of the map
Thought about that too but isnt that the problem. I think it is at can_see_fm. Since npc is bigger, maybe cant find the player. But idk how much should i reduce the vision.
__________________

Last edited by Jhob94; 11-08-2014 at 08:40.
Jhob94 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 06:22.


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