Raised This Month: $ Target: $400
 0% 

Detecting Ground Touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-28-2010 , 21:51   Detecting Ground Touch
Reply With Quote #1

I am trying to find the best way to determine when a weapon touches the ground after it has been dropped. I was thinking about either hooking the "drop" command or forwarding Ham_Item_Drop to know when it drops, but I wasn't sure about the best way to tell when it hits the ground. Any information at all is helpful. Thanks.
RedRobster is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 06-28-2010 , 21:55   Re: Detecting Ground Touch
Reply With Quote #2

PHP Code:
if ( peviEntpev_flags ) & FL_ONGROUND )
{
    
// code 

You can also use engine:
PHP Code:
entity_get_intiEntEV_INT_flags ) & FL_ONGROUND
And take this in account:
PHP Code:
const FL_ONGROUND2 = (FL_CONVEYOR|FL_ONGROUND|FL_PARTIALGROUND|FL_INWATER|FL_FLOAT); 
__________________
"There is no knowledge, that is not power"
fezh is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-28-2010 , 22:00   Re: Detecting Ground Touch
Reply With Quote #3

Quote:
Originally Posted by fezh View Post
And take this in account:
PHP Code:
const FL_ONGROUND2 = (FL_CONVEYOR|FL_ONGROUND|FL_PARTIALGROUND|FL_INWATER|FL_FLOAT); 
About the FL_INWATER: if I remove that, if it is on the bottom of the pool/water, will that be considered on the ground?
RedRobster is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-28-2010 , 22:00   Re: Detecting Ground Touch
Reply With Quote #4

If you really want to do this for a certain weapon drop event, you can enable the Think forward for that weapon once it is dropped, check if it is on the ground in the think, and if it's on the ground, do what you need to do there and then unregister the forward.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-28-2010 , 22:05   Re: Detecting Ground Touch
Reply With Quote #5

Quote:
Originally Posted by wrecked_ View Post
If you really want to do this for a certain weapon drop event, you can enable the Think forward for that weapon once it is dropped, check if it is on the ground in the think, and if it's on the ground, do what you need to do there and then unregister the forward.
How would I enable the think forward?
RedRobster is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-28-2010 , 22:31   Re: Detecting Ground Touch
Reply With Quote #6

Quote:
Originally Posted by RedRobster View Post
How would I enable the think forward?
Ham_Think
RegisterHam()
EnableHamForward()
DisableHamForward()

FM_Think
register_forward()
unregister_forward()
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-28-2010 , 22:32   Re: Detecting Ground Touch
Reply With Quote #7

Quote:
Originally Posted by wrecked_ View Post
Ham_Think
RegisterHam()
EnableHamForward()
DisableHamForward()

FM_Think
register_forward()
unregister_forward()
Muchos gracias. Much appreciated.
RedRobster is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-28-2010 , 22:40   Re: Detecting Ground Touch
Reply With Quote #8

Quote:
Originally Posted by RedRobster View Post
Muchos gracias. Much appreciated.
No problemo.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-28-2010 , 22:48   Re: Detecting Ground Touch
Reply With Quote #9

Why not register_touch ?
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-28-2010 , 23:06   Re: Detecting Ground Touch
Reply With Quote #10

Quote:
Originally Posted by Emp` View Post
Why not register_touch ?
You would
PHP Code:
register_touch"player""func_wall""touch"//I don't know the entity for the floor...I assume that's it o.o 
or could you
PHP Code:
register_touch"player""world""touch"
^Nevermind.

Last edited by RedRobster; 06-28-2010 at 23:14. Reason: *sigh*
RedRobster 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 14:44.


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