AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check for two entities (https://forums.alliedmods.net/showthread.php?t=132845)

FEELiFE 07-19-2010 11:46

Check for two entities
 
How can I check that entity is in other entity?
I'm trying to make a plugin that blocks moving block on the barriere (base builder mod). I tried some things and i realized that I can't use touch. I tried with hamsandwitch and origins but it went mess. I save the door (zone) coordinates of the specified map in ini file.

Can someone make the plugin or tell me how to use tracehull. How it works and in which case i can use it?

Thanks..

Spunky 07-19-2010 15:58

Re: Check for two entities
 
If the base has a roof (as it should), you can do:

PHP Code:

static Float:fpOrigin[3]
entity_get_vector(iEntEV_VEC_originfpOrigin)

while (
point_contents(fpOrigin) == CONTENTS_EMPTY)
    
fpOrigin[2] += 5.0

// Check for sky and everything else you think you should check for 


AngeIII 07-19-2010 16:26

Re: Check for two entities
 
can it help to get distance to over head entity[roof] ?

Spunky 07-19-2010 16:37

Re: Check for two entities
 
Yes.

PHP Code:

static Float:fpOrigin[3]
entity_get_vector(iEntEV_VEC_originfpOrigin)

static 
Float:fpSkyOrigin[3]
fpSkyOrigin[0] = fpOrigin[0]
fpSkyOrigin[1] = fpOrigin[1]
fpSkyOrigin[2] = fpOrigin[2]

new 
Float:fpDistance

while (point_contents(fpSkyOrigin) == CONTENTS_EMPTY)
    
fpSkyOrigin[2] += 5.0

fpDistance 
vector_distance(fpOriginfpSkyOrigin

Remove the check to see if it's sky, sorry.

FEELiFE 07-20-2010 06:18

Re: Check for two entities
 
What is point_contents? Where is that function from and what it does?

AngeIII 07-20-2010 06:25

Re: Check for two entities
 
thanks Spunky you realy help me ;)

FEELiFE -> this function check what "content" at a origins what you writen in.

engine:
PHP Code:

point_contents(origins

fakemeta:
PHP Code:

#define fm_point_contents(%1) engfunc(EngFunc_PointContents, %1) 

return this values:
PHP Code:

hlsdk_const.inc
// engfunc(EngFunc_PointContents, Float:origin) return values
#define    CONTENTS_EMPTY                  -1
#define    CONTENTS_SOLID                  -2
#define    CONTENTS_WATER                  -3
#define    CONTENTS_SLIME                  -4
#define    CONTENTS_LAVA                   -5
#define    CONTENTS_SKY                    -6
#define    CONTENTS_ORIGIN                 -7          // Removed at csg time
#define    CONTENTS_CLIP                   -8          // Changed to contents_solid
#define    CONTENTS_CURRENT_0              -9
#define    CONTENTS_CURRENT_90             -10
#define    CONTENTS_CURRENT_180            -11
#define    CONTENTS_CURRENT_270            -12
#define    CONTENTS_CURRENT_UP             -13
#define    CONTENTS_CURRENT_DOWN           -14
#define CONTENTS_TRANSLUCENT            -15
#define    CONTENTS_LADDER                 -16
#define    CONTENT_FLYFIELD                -17
#define    CONTENT_GRAVITY_FLYFIELD        -18
#define    CONTENT_FOG                     -19 


FEELiFE 07-20-2010 08:31

Re: Check for two entities
 
It won't work either.
Is there any other method that doesn't use origins?

FEELiFE 07-24-2010 03:55

Re: Check for two entities
 
Ideas?


All times are GMT -4. The time now is 07:03.

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