Raised This Month: $ Target: $400
 0% 

[L4D2] How to properly detect when an entity has touches the ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thresh0ld
Senior Member
Join Date: Sep 2009
Location: Hell
Old 05-03-2010 , 10:43   [L4D2] How to properly detect when an entity has touches the ground
Reply With Quote #1

Typo: How to properly detect when an entity has touched* the ground

I have a feature in my super-boomer plugin where after a rocket jump, boomer explodes upon landing.

As for my land detection, I am using SDKHook_Touch for this and an additional condition within the callback procedure is added to check if the other flag is 0.

So the problem is...when boomer hits the far "ceiling" of the map, boomer would still explode.. Here is the sample code in my plugin:

Code:
SDKHook(client, SDKHook_Touch, SDKHook_Touch_Callback);

public SDKHook_Touch_Callback(entity, other)
{
	if (IsValidClient(entity))
	{
		if ((other == 0 && g_bIsChargeActivated[entity] == true))
		{
                       //Explode
                }
        }
}
I just want boomer to explode when he touches the ground and nothing else...

Any suggestions?

Last edited by thresh0ld; 05-03-2010 at 10:45.
thresh0ld is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-03-2010 , 10:47   Re: [L4D2] How to properly detect when an entity has touches the ground
Reply With Quote #2

You might want to use StartTouch instead of touch as it will fire less often. When the boomer starts touching world, check the onground ent flag.

PHP Code:
if (GetEntityFlags(boomer) & FL_ONGROUND)
{
    
// boomer is on the ground

psychonic is offline
thresh0ld
Senior Member
Join Date: Sep 2009
Location: Hell
Old 05-03-2010 , 10:49   Re: [L4D2] How to properly detect when an entity has touches the ground
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
You might want to use StartTouch instead of touch as it will fire less often. When the boomer starts touching world, check the onground ent flag.

PHP Code:
if (GetEntityFlags(boomer) & FL_ONGROUND)
{
    
// boomer is on the ground

Thank you!! I will try this.
thresh0ld 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 04:51.


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