Raised This Month: $51 Target: $400
 12% 

NPC Duck problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spamipolito
Junior Member
Join Date: Jun 2018
Old 06-13-2018 , 07:07   NPC Duck problem
Reply With Quote #1

Hi guys. I'm trying to make a perfect npc. I have a problem.

When being crouched, it works perfect, or so I think.. But when standing, the NPC gets on the ground

This is my code:
PHP Code:
        case ACTIVITY_DUCK:
        {
            
NPC_PlayAction(iEntAI_ACTIONS[5][NPC_SEQUENCE], AI_ACTIONS[5][NPC_ANIMTIME], AI_ACTIONS[5][NPC_FRAMERATE])

            
NPC_MoveToTarget(iEntvecVictimOrigin240.0)

            new 
Float:vecMins[3];
            new 
Float:vecMax[3];
            
//new Float:VecSize[3]
    
            
vecMins Float:{-16.0, -16.0, -18.0};
            
vecMax Float:{16.016.032.0};
            
//VecSize = Float:{32.0, 32.0, 50.0};
    
            //entity_set_size(iEnt, vecMins, vecMax);
    
            
entity_set_vector(iEntEV_VEC_minsvecMins);
            
entity_set_vector(iEntEV_VEC_maxsvecMax);

            
client_print(0print_chat"Duck")

            if(
fDistance <= 64.0)
            {    
                
// Sequence Duck And Attack 

                
entity_set_int(iEntEV_INT_sequence81);
                
entity_set_float(iEntEV_FL_animtimeg_animtime);
                
entity_set_float(iEntEV_FL_framerateg_framerate);

                
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.5);
            
                return;    

             }

            
//if( !(pev(iVictim, pev_oldbuttons) & IN_DUCK) )
            //{
                
entity_set_int(iEntZOMBIE_ACTIVITYACTIVITY_STAND)

            
//}

            
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.5);
            
            return;

        }
        case 
ACTIVITY_STAND:
        {
            
NPC_PlayAction(iEntAI_ACTIONS[0][NPC_SEQUENCE], AI_ACTIONS[0][NPC_ANIMTIME], AI_ACTIONS[0][NPC_FRAMERATE])

            new 
Float:vecMins[3];
            new 
Float:vecMax[3];
           
// new Float:VecSize[3]
    
            
vecMins Float:{-16.0, -16.0, -36.0};
            
vecMax Float:{16.016.036.0};
            
//VecSize = Float:{32.0, 32.0, 72.0};
    
            //entity_set_size(iEnt, vecMins, vecMax);
    
            
entity_set_vector(iEntEV_VEC_minsvecMins);
            
entity_set_vector(iEntEV_VEC_maxsvecMax);

            
entity_set_int(iEntZOMBIE_ACTIVITYACTIVITY_RUN)

            
client_print(0print_chat"Stand")

            
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.5);

            return;
        } 
Duck:



Problem:



Sorry for my english, I'm spanish speaking

Last edited by spamipolito; 06-13-2018 at 07:10.
spamipolito is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-13-2018 , 13:38   Re: NPC Duck problem
Reply With Quote #2

PHP Code:

 vecMins 
Float:{-16.0, -16.0, -36.0};
 
vecMax Float:{16.016.016.0}; 
In case ACTIVITY_DUCK
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-13-2018 at 19:02.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
spamipolito
Junior Member
Join Date: Jun 2018
Old 06-14-2018 , 17:24   Re: NPC Duck problem
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
PHP Code:

 vecMins 
Float:{-16.0, -16.0, -36.0};
 
vecMax Float:{16.016.016.0}; 
In case ACTIVITY_DUCK
it did not work
spamipolito is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 06-13-2018 , 16:03   Re: NPC Duck problem
Reply With Quote #4

I think, when NCP stands after ducking, you should set him on origin Z axis half of the duck height (or something like this).
__________________
My English is A0

Last edited by E1_531G; 06-13-2018 at 16:04.
E1_531G is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-13-2018 , 19:04   Re: NPC Duck problem
Reply With Quote #5

Quote:
Originally Posted by E1_531G View Post
I think, when NCP stands after ducking, you should set him on origin Z axis half of the duck height (or something like this).
No he shouldnt because he. Simply can just change the maxsize z vector
And not touch the z minsize
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-13-2018 at 19:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-14-2018 , 17:54   Re: NPC Duck problem
Reply With Quote #6

Try with entity_set_size instead.
__________________








CrazY. is offline
spamipolito
Junior Member
Join Date: Jun 2018
Old 06-14-2018 , 18:43   Re: NPC Duck problem
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
Try with entity_set_size instead.
No bro :/ . I already testing with entity_set_size :/. Anyway, i tried again.

This result:

Use this code in case ACTIVITY_DUCK:

PHP Code:
            new Float:vecMins[3];
            new 
Float:vecMax[3];
            
//new Float:VecSize[3]
    
            
vecMins Float:{-16.0, -16.0, -32.0};
            
vecMax Float:{16.016.018.0};
            
//VecSize = Float:{32.0, 32.0, 50.0};
    
            
entity_set_size(iEntvecMinsvecMax);
    
            
entity_set_vector(iEntEV_VEC_minsvecMins);
            
entity_set_vector(iEntEV_VEC_maxsvecMax); 
And case ACTIVITY_STAND:

PHP Code:
            new Float:vecMins[3];
            new 
Float:vecMax[3];
           
// new Float:VecSize[3]
    
            
vecMins Float:{-16.0, -16.0, -36.0};
            
vecMax Float:{16.016.036.0};
            
//VecSize = Float:{32.0, 32.0, 72.0};
    
            
entity_set_size(iEntvecMinsvecMax);
    
            
entity_set_vector(iEntEV_VEC_minsvecMins);
            
entity_set_vector(iEntEV_VEC_maxsvecMax); 
This result:

Ducking:



Standing up:
spamipolito is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-14-2018 , 20:09   Re: NPC Duck problem
Reply With Quote #8

Quote:
Originally Posted by spamipolito View Post
No bro :/ . I already testing with entity_set_size :/. Anyway, i tried again.

This result:

Use this code in case ACTIVITY_DUCK:

PHP Code:
            new Float:vecMins[3];
            new 
Float:vecMax[3];
            
//new Float:VecSize[3]
    
            
vecMins Float:{-16.0, -16.0, -32.0};
            
vecMax Float:{16.016.018.0};
            
//VecSize = Float:{32.0, 32.0, 50.0};
    
            
entity_set_size(iEntvecMinsvecMax);
    
            
entity_set_vector(iEntEV_VEC_minsvecMins);
            
entity_set_vector(iEntEV_VEC_maxsvecMax); 
Didnt i told you to not change the mins of z vector, mins ducking should be equal to the mins of the standing position.

It shouldbe

vecMins = Float:{-16.0, -16.0, -36.0};
vecMax = Float:{16.0, 16.0, 16.0};
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-14-2018 at 20:15.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-14-2018 , 21:10   Re: NPC Duck problem
Reply With Quote #9

Take a look at Half-Life/ReGameDLL source code.
__________________








CrazY. is offline
spamipolito
Junior Member
Join Date: Jun 2018
Old 07-04-2018 , 14:35   Re: NPC Duck problem
Reply With Quote #10

Dont work guys
spamipolito 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 02:24.


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