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

[Help] Entity stuff


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-19-2015 , 07:00   [Help] Entity stuff
Reply With Quote #1

Hi guys, I'm newbie here and I'm sucks at entity
I have a few questions:
- I want the entity to search for a custom radius near it, and move to the nearest player in the radius, how to do that ? (I found find_ent_in_sphere in engine.inc but dunno how to use)
- How to detect if entity died ? and how to make explosions when it die ? (just like HE)
ty <3
__________________
Shiina.Mashiro is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-19-2015 , 07:31   Re: [Help] Entity stuff
Reply With Quote #2

1. http://amxmodx.org/doc/index.html?pa..._in_sphere.htm
Google it for further information.
To find the nearest player/entity, you can use a while loop like this:
PHP Code:
new Float:closest_rangeFloat:rangeclosest_idFoundEntID = -1
closest_range 
Radius
while(FoundEntID find_ent_in_sphere(FoundEntIDOriginRadius))
{
    
range entity_range(YourEntIDFoundEntID)
    if(
range closest_range)
    {
        
closest_range range
        closest_id 
FoundEntID
    
}

2. Try play with Ham_Killed.
For the explosion, there're plenty of plugins in the forum for you to read. Just search.

Last edited by RateX; 01-19-2015 at 07:55.
RateX is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-19-2015 , 09:54   Re: [Help] Entity stuff
Reply With Quote #3

Quote:
Originally Posted by RateX View Post
1. http://amxmodx.org/doc/index.html?pa..._in_sphere.htm
Google it for further information.
To find the nearest player/entity, you can use a while loop like this:
PHP Code:
new Float:closest_rangeFloat:rangeclosest_idFoundEntID = -1
closest_range 
Radius
while(FoundEntID find_ent_in_sphere(FoundEntIDOriginRadius))
{
    
range entity_range(YourEntIDFoundEntID)
    if(
range closest_range)
    {
        
closest_range range
        closest_id 
FoundEntID
    
}

2. Try play with Ham_Killed.
For the explosion, there're plenty of plugins in the forum for you to read. Just search.
yea ok, but how do I make the entity to move (follow) the players?
can I use this ?

entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
__________________
Shiina.Mashiro is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-19-2015 , 10:55   Re: [Help] Entity stuff
Reply With Quote #4

^Yes, but you also have to set aiment as well.
RateX 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 00:01.


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