AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook an entity's touch of ground (https://forums.alliedmods.net/showthread.php?t=250976)

ezio_auditore 11-03-2014 07:27

Hook an entity's touch of ground
 
Hey. I would like to know that how can we hook the event in which an entity touches the ground.
I know that it can be done by using
Code:

register_touch(...)
.
But what is the entity-name of the ground, i don't know that. So please help.

klippy 11-03-2014 08:27

Re: Hook an entity's touch of ground
 
I think you can do
PHP Code:

register_touch("your_entity""*""your_touch_func"); 

to register touch between your and any other entity.

RateX 11-03-2014 08:46

Re: Hook an entity's touch of ground
 
What about FL_ONGROUND?

ezio_auditore 11-03-2014 12:32

Re: Hook an entity's touch of ground
 
Quote:

Originally Posted by KliPPy (Post 2219577)
I think you can do
PHP Code:

register_touch("your_entity""*""your_touch_func"); 

to register touch between your and any other entity.

I know how to register the touches of an entity, I was asking how can I hook its touch with ground.
And about
Code:
//FL_ONGROUND if (pev(id, pev_flags) & FL_ONGROUND) {...}
I know this method. But this is meant for the players only. Does it have anything to do with entities? :shock:

RateX 11-03-2014 12:45

Re: Hook an entity's touch of ground
 
Instead of asking, why don't you test it yourself?

ezio_auditore 11-03-2014 13:38

Re: Hook an entity's touch of ground
 
I am away right now. Testing would be possible only after a few days.

Xalus 11-03-2014 16:30

Re: Hook an entity's touch of ground
 
PHP Code:

public pfn_touch(entityid)
{
    if(
pev_valid(entity)
    && !
task_exists(entity+16541))
    {
        if(
pev(entitypev_classname) == g_eClassnameid)
        {
            static 
intOwner
            intOwner 
pev(entitypev(entitypev_euser2) ? pev_euser1 pev_owner)
            
            
client_print(0print_chat"Owner %i: id: %i"intOwnerid)
            
            if(!
pev_valid(id))
            {
                
// Entity System
                
static Float:vecOrigin[3], Float:vecOutput[3]
                
pev(entitypev_originvecOrigin)
                
xs_vec_copy(vecOriginvecOutput)
                
vecOutput[2] -= 30.0
                
                
new iTraceHandle create_tr2()
                
engfunc(EngFunc_TraceLinevecOriginvecOutputIGNORE_MONSTERSidiTraceHandle)
                
get_tr2(iTraceHandleTR_vecEndPosvecOutput)
                
free_tr2(iTraceHandle)
                
                new 
intDiff = (floatround(vecOrigin[2]) - floatround(vecOutput[2]))
                
                
            }
        }
    }
    return 
PLUGIN_CONTINUE


Play with this, it checks walls & ground, so check height or something, to find out :)

HamletEagle 11-04-2014 10:03

Re: Hook an entity's touch of ground
 
@Xalus, you don't get what he is asking. If this is what I think, it's for his last plugin, when he force a drop on the weapon and he needs to remove the dropped weapon ent. Also, he is asking how to hook touch for an entity with unknow classname, which is impossible. So, instead of asking this question, explain what's your real problem so we can give you the best way.

ezio_auditore 11-05-2014 01:10

Re: Hook an entity's touch of ground
 
Quote:

Originally Posted by HamletEagle (Post 2220020)
@Xalus, you don't get what he is asking. If this is what I think, it's for his last plugin, when he force a drop on the weapon and he needs to remove the dropped weapon ent. Also, he is asking how to hook touch for an entity with unknow classname, which is impossible. So, instead of asking this question, explain what's your real problem so we can give you the best way.

You mistook me again.
I am asking for a new plugin

HamletEagle 11-05-2014 10:34

Re: Hook an entity's touch of ground
 
Quote:

Originally Posted by ezio_auditore (Post 2220275)
You mistook me again.
I am asking for a new plugin

Actually not, your question doesn't make sense. You want to hook touch for an entity that you don't know ? How you can't know it's classname ? This seems very strange to me, so you should say what are you really trying to do so we can help you. If it's a default map entity you can find it's classname by searching, if it's an ent that you are creating, then you can set it's classname when you create it, so you will know. If this are not the cases, you need to provide more info.


All times are GMT -4. The time now is 17:40.

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