Quote:
Originally Posted by kovakovi2000
At this time i dectect the "headshot" with an another entity. It's on the NPC with MOVETYPE_FOLLOW and it's collision box make the NPC head. If the head entity take damage it's forwarded to the owner NPC.
|
Ok, this is a bullshit. This make's the server crash with "
Segmentation fault" don't do that!
Quote:
Originally Posted by kovakovi2000
Any better solution please?
|
The best solution i found was this:
Decompile the model that you use. (
with Crowbar / MilkShape / Jed )
there will be a .qc file.
Open it with text editor.
Search for things like this:
Code:
$hbox 0 "Bip01 Pelvis" -3.43 -5.9 -7.43 4.484985 5.28 7.13
$hbox 0 "Bip01 Spine" -0.69 -4.92 -6.33 5.642796 4.46 5.82
$hbox 0 "Bip01 Spine1" -0.45 -6.44 -7.58 7.156143 6.01 8.08
$hbox 0 "Bip01 Spine2" -0.43 -5.99 -7.69 7.06 4.91 4.3
$hbox 0 "Bip01 Neck" -3.604496 -3.32 -3.970395 2.18041 3.78 3.970401
$hbox 0 "Bip01 L Clavicle" 0 -3.75 -0.9 6.07 3.17 3.4
$hbox 0 "Bip01 L UpperArm" 0 -2.68 -1.79 8.94 3.5 3.2
$hbox 0 "Bip01 L Forearm" 0 -2.12 -1.96 12.276656 2.31 2.84
$hbox 0 "Bip01 R Clavicle" 0 -3.62 -3.35 6.88 3.14 0.55
$hbox 0 "Bip01 R UpperArm" 0 -2.89 -2.75 8.03 3.17 2.17
$hbox 0 "Bip01 R Forearm" 0 -2.45 -2.81 12.276652 2.32 1.49
$hbox 0 "Bip01 L Hand" -0.37 -2.29 -2.86 6.231386 1.36 1.7
$hbox 0 "Bip01 L Finger0" 0 -0.26 0 2.71 0.97 2.26
$hbox 0 "Bip01 L Finger1" -2.34 -1.98 -2.19 2.04 0.95 1.74
$hbox 0 "Bip01 R Hand" -1.58 -1.96 -1.3 6.231387 1.14 3.22
$hbox 0 "Bip01 R Finger1" -1.75 -1.29 -1.35 1.7 1.63 2.62
$hbox 0 "Bip01 L Thigh" 0 -5.79 -4.31 17.879999 5.91 4.47
$hbox 0 "Bip01 L Calf" 0 -4.13 -3.41 21.382563 4.4 3.83
$hbox 0 "Bip01 L Foot" 0 -2.62 -2.4 4.46 9.9 2.39
$hbox 0 "Bip01 R Thigh" 0 -6.08 -4.58 17.450001 5.95 4.5
$hbox 0 "Bip01 R Calf" 0 -4.57 -3.72 21.382565 4.58 3.87
$hbox 0 "Bip01 R Foot" 0 -2.74 -2.05 4.48 9.94 2.76
$hbox 1 "Bip01 Head" -1.81 -5.28 -4.18 8.02 5.24 3.32
$hbox 0 "Bip01 Ponytail1" 0 -1.06 -2.19 5.3 2.22 1.47
In default case all number after hbox is 0, but i already set the head hitbox to 1.
Any number you set there you get it back if you shot the attached hitbox.
Plugin: (
this is already contains a hitmarker for the attacker and a debug message in server console. )
Code:
public plugin_init()
{
RegisterHam(Ham_TraceAttack, "info_target", "npc_TraceAttack");
}
public npc_TraceAttack(iEnt, attacker, Float: damage, Float: direction[3], trace, damageBits)
{
if(!is_valid_ent(iEnt))
return;
new HEAD = get_tr2(trace, TR_iHitgroup);
console_print(0, "[DEBUG] HITBOX: %i", HEAD);
if(HEAD)
{
set_hudmessage(255, 0, 255, -1.0, 0.52, 0, 6.0, 0.6)
show_hudmessage(attacker, "HEADSHOT");
SetHamParamFloat(3, damage*3.0);
}
}
With that if u shot head then the damage will be 3x stronger.
Credit for: grs4