Raised This Month: $ Target: $400
 0% 

[TF2] Detecting if an Object Enters a Region


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LolCakeLazors
Junior Member
Join Date: Feb 2010
Old 02-09-2010 , 16:25   [TF2] Detecting if an Object Enters a Region
Reply With Quote #1

I was trying to make a small mod in TF2. However, the only main problem I have is the implementation. Is there anyway to detect if an object enters a certain region in the map? (Ex. Sandman ball, rocket, etc)

Thanks.
LolCakeLazors is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 02-09-2010 , 16:43   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #2

The only approach is sort of nasty. On a timer, every 0.3 seconds or so, loop through all the entities (FindEntityByClassname), determine if its a sandman ball or projectile, and then compare its location to your predetermined region.

If you need anymore help getting started, just ask.
pheadxdll is offline
LolCakeLazors
Junior Member
Join Date: Feb 2010
Old 02-09-2010 , 16:59   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #3

Like what my idea is, is that when the sandman ball (or object) goes into "hole" then the person gets a point.
It's like those sack toss games that you play when you were little.
LolCakeLazors is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 02-09-2010 , 17:11   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #4

Neat, if you were making your own map for this there might be a smarter, yet more complicated way.

You could use the SDKHooks extension and hook the projectile entity's Touch function to tell when it collides with another entity. This means that you'll have to mark the region with another entity and test for it. Can't say off hand which entity would work. trigger_hurt maybe? You just have to play around and see.
pheadxdll is offline
LolCakeLazors
Junior Member
Join Date: Feb 2010
Old 02-09-2010 , 17:23   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #5

The only problem is:
Can the collision be restricted to the Sandman ball?
LolCakeLazors is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 02-09-2010 , 17:38   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #6

Yeah, just make the region solid, or put it above a solid object.
pheadxdll is offline
LolCakeLazors
Junior Member
Join Date: Feb 2010
Old 02-09-2010 , 18:24   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #7

1. How would I make the region? Would I have to apply a special texture on a rectangle block?
2. What do you mean by "solid"?
3. Can anyone give me an example touch trigger?

Last edited by LolCakeLazors; 02-09-2010 at 18:32.
LolCakeLazors is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 02-09-2010 , 19:40   Re: [TF2] Detecting if an Object Enters a Region
Reply With Quote #8

What about using env_beam and hooking OnTouchedByEntity output? Use just enough to cover your "hole" and if they are touched by sandman balls ~~~> SCORE!
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
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 09:34.


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