• Detect if entity is hit in certain area
    4 replies, posted
Is there a way to detect if a Entity, Eg. Door, is hit in a certain area, Eg. Doorhandle ? If so, how?
Do you mean pressing E on an item? If so, have a hook to run when the player presses the E button (KeyPress), and check if the player is looking at a certain entity.
From what I know entities like that don't have hitgroups unless it's an actual player/npc.
[QUOTE=Author.;46400973]Do you mean pressing E on an item? If so, have a hook to run when the player presses the E button (KeyPress), and check if the player is looking at a certain entity.[/QUOTE] I mean so, If I shoot a door's handle, I can detect that.
Without recompiling the model with the hitboxes that you need, you have a couple of options. You could use a proxy entity that is parented and positioned to where you want. A very hacky way; detour the bullet firing functions and check there. This method has many negative repercussions and won't always work. However, with the newest additions to Garry's Mod, there is a new hook that allows you to get bullet information without detouring any functions. [url]http://wiki.garrysmod.com/page/GM/EntityFireBullets[/url] I'd personally go with the last method as that's the best method.
Sorry, you need to Log In to post a reply to this thread.