Detect headshot in hl2dm w/crossbow
Hello!
I'm new to scripting in Sourcepawn and am quite enjoying it. :bacon!: I'm trying to track headshots made by the crossbow using an SDKHook_TraceAttackPost event, but the hitgroup always comes back as 0. My understanding is the crossbow does not use hitscan so I figure this approach won't work. I've also tried GetEventInt(event, "hitgroup") in a player_hurt event. It comes back as 0 too. How can I detect a headshot made with a crossbow? [foo] bar |
Re: Detect headshot in hl2dm w/crossbow
Sourcemod has a TON of plugins and is currently considered the best plugin for any Source Dedicated Server. The main issue with Mani is the lack up update support. Sourcemod is frequently updated and new plugins are always coming out. In fact, many bugs are often fixed with Sourcemod plugins before they are fixed my Valve.
|
Re: Detect headshot in hl2dm w/crossbow
Quote:
But how does this help me figure out if a crossbow_bolt hit someone in the head? ;) |
Re: Detect headshot in hl2dm w/crossbow
if its a projectile it should have an entity for the bolt in which case you could hook touch and compare its coordinates with the players eye coordinates on touch.
|
Re: Detect headshot in hl2dm w/crossbow
Are you trying to block the damage or just figure out when it's a headshot?
Either way, SDKHooks OnTakeDamage is probably a better method of detecting it. |
Re: Detect headshot in hl2dm w/crossbow
Take a look at a SuperLogs for HL2MP, may be helpful in your case
|
Re: Detect headshot in hl2dm w/crossbow
Thanks blodia, Powerlord and root.
I switched over to SDKHooks' OnTakeDamage and OnTakeDamagePost, but the weapon being passed in is -1 ("unspecified"). I'm not sure if I'm doing something wrong with the call or not, though. It does pass in the damagePosition which makes it pretty simple to tell if the hit was approximately head level. I'm trying to specifically animate a different effect if a player is headshot by a crossbow bolt. root: I did take a look at superlogs but it's unclear to me how exactly their crossbow support works. I don't see my superlogs-hl2mp triggering a headshot with a crossbow either, so I wonder if they really have it working. [foo] bar |
Re: Detect headshot in hl2dm w/crossbow
I just checked the Superlogs support for HL2DM, and it does check the hitgroup using TraceAttack to see if it's equal to 1 (HITGROUP_HEAD from wstatshelper.inc).
Are you sure headshots are returning hitgroup 0? Alternately, make sure you're using the correct arguments in your callbacks: PHP Code:
|
Re: Detect headshot in hl2dm w/crossbow
Quote:
Here's some test code I've been using to see what TraceAttackPost is seeing. In superlogs-hl2mp.sp (Version 1.1.3) I've changed OnTraceAttack to: PHP Code:
Quote:
Quote:
Note that there is no "triggered headshot" log from superlogs on the crossbow hit either, but there is for the 357. A much simpler test yields the same result: PHP Code:
Quote:
Now I do see that superlogs-hl2mp is doing some mangling in OnTakeDamage but hitgroup starts out 0, and ends up being set to 7. PHP Code:
Quote:
[foo] bar |
Re: Detect headshot in hl2dm w/crossbow
As far as I know, it's impossible to properly detect headshots with crossbow bolts, being projectiles rather than hitscan traces, they ignore hitboxes and uses the player's bounding box as the basis for hit detection. Someone correct me if I'm wrong.
|
| All times are GMT -4. The time now is 13:46. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.