AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Quick Question: hitzone from get_user_attacker (https://forums.alliedmods.net/showthread.php?t=61782)

Mugwump 10-09-2007 14:18

Quick Question: hitzone from get_user_attacker
 
Hey folks, I just wanted to confirm that hitzone #3 as returned from a call to get_user_attacker is the back, is that correct? I cannot seem to find a reference to where those zones are defined, all I see are these:

* 1 - generic
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg */

I can only seem to get a 3 from hitting the back so I hope thats the answer, but any info or confirmation on this would be appreciated.

Thanks,
Mugwump

purple_pixie 10-09-2007 14:28

Re: Quick Question: hitzone from get_user_attacker
 
3 isn't a bit flag though ..

That would be 2 and 1. A head and generic hit.

The back isn't a hitzone, sadly, you so far as I know you have to calculate that for yourself.

Mugwump 10-09-2007 14:33

Re: Quick Question: hitzone from get_user_attacker
 
Argh, thats not what I was hoping to hear but it makes sense...

Does anyone know of examples that determine if the back is hit? Is there even enough info? My guess would be if I could calculate the direction vector for both myself and my target I could figure that out as we'd both ned to be facing close to the same direction...

Thanks,
Mugwump

fxfighter 10-09-2007 14:58

Re: Quick Question: hitzone from get_user_attacker
 
sry but i wont give you an answer but i think you are trying to do stuf when someone got hit somewhare or something so i post this pice of code and i think you know what to do use dmg event instead.
dont think this works on back-.- like purple pixie sayd
PHP Code:

public Death( ) 
{
 new 
iVictim read_data)
 new 
weaponhitplaceattacker get_user_attacker(iVictim,weapon,hitplace)
if(
hitplace == HIT_CHEST)
 { 
 }
 if(
hitplace == HIT_HEAD)
 {
 }
 if(
hitplace == HIT_RIGHTARM)
 {
 }
 if(
weapon == CSW_KNIFE)
 {
 }



M249-M4A1 10-09-2007 15:03

Re: Quick Question: hitzone from get_user_attacker
 
If you knifed someone in the back, how does HL know its a backstab? Maybe by the way the 2 players were oriented in relation to eachother?

Mugwump 10-09-2007 15:15

Re: Quick Question: hitzone from get_user_attacker
 
I think I have a reasonable guess...

1. Calculate the direction angles for myself
2. Calculate the direction angles for my target
3. We should roughly be facing the same direction (maybe within +-45 in x and y)


Code:

  new Float:angles[3],tangles[3]
  pev( myid, pev_angles, angles ) 
  pev( targid, pev_angles, tangles )
 
  if ( ( floatabs(angles[0] - tangles[0]) < 45 ) && ( floatabs(angles[1] - tangles[1]) < 45 ) ){
      // Back hit
  }

Does that look right?

-Mugwump

Mugwump 10-09-2007 16:09

Re: Quick Question: hitzone from get_user_attacker
 
I have confirmed in game that this is as good an approximation as I'd want to determine the success of landing a backstab, etc ...

Thanks for the help folks.

-K2/Mugwump

M249-M4A1 10-09-2007 16:30

Re: Quick Question: hitzone from get_user_attacker
 
Congrats, and this would be a good guide for those who want to find out how to look for back-attacks too


All times are GMT -4. The time now is 16:12.

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