Detecting when shield is hit (not just aiming at it)
i searched the forum and found only ways to detect when user is aiming at the shield but not hitting it with the bullet, i want to make an action only when shield is hit not when you just look at it, maybe someone found a way ?
i tried get_tr2( tr, TR_iHitgroup ) in TraceAttack pre and post but traceattack isn't even called for shield |
Re: Detecting when shield is hit
you could rebuild the traceline the engine sends and check yourself whether it hits the shield or not, use FM_EmitSound (bad method) or some better way which hopefully exists ^^
|
Re: Detecting when shield is hit
IIRC the hitgroup of shield is 8.
EDIT:As i knew -> http://forums.alliedmods.net/showpos...57&postcount=5 |
Re: Detecting when shield is hit (not just aiming at it)
for 8th hitgroup TraceAttack isn't called and traceline hooks aiming not shooting (as far as i know)
SchlumPF* i haven't done anything like that yet, could you help me little further? |
Re: Detecting when shield is hit (not just aiming at it)
You can simply modulate TraceLine to detect attack. Just hook CmdStart forward, check Buttons&IN_ATTACK then do a traceline ? There are some other ways too...
|
Re: Detecting when shield is hit (not just aiming at it)
,Owyn. yet, i wont give you the code but i will tell you how you can find out how to do what you want (learn-effect):
- download the hlsdk - search in mp5.dll for the function which is called when the weapon is fired and find the function inside which checks for a hit - the function is located in combat.cpp - understand its code, try to rebuild it in pawn and add your shieldhit detection if its really that hard for you (at least try it) i may help you as soon as i got more motivation + time ;D @Alka i guess you know my knife-distance plugin and how it detects the attack type (tracehandle value), should be possible here too :) also, there is already a tutorial of VEN about this (Owyn search for it in the code snippets section, might be helpful) which does not check pev_buttons or uses cmdstart in general ^^ |
Re: Detecting when shield is hit (not just aiming at it)
Yea, but my idea is a simple way (: i said
Quote:
|
Re: Detecting when shield is hit (not just aiming at it)
There isn't a clean way to do this since when you hit a shield a traceattack doesn't occur and the shield doesn't even exist as an entity. This is the best way I found:
PHP Code:
|
Re: Detecting when shield is hit (not just aiming at it)
you get same result just checking pev button IN_ATTACK in traceline, atm i think hooking shield-hit sound with fakemeta is a nice way
|
Re: Detecting when shield is hit (not just aiming at it)
Quote:
And thinking again, no you don't. You can be pressing IN_ATTACK without attacking. |
All times are GMT -4. The time now is 20:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.