Raised This Month: $32 Target: $400
 8% 

[HOWTO] Make a NPC with extra features.


Post New Thread Reply   
 
Thread Tools Display Modes
kovakovi2000
New Member
Join Date: Nov 2015
Old 12-16-2019 , 10:00   Re: [HOWTO] Make a NPC with extra features.
Reply With Quote #71

Hi, i worried about this post is too old, but i need to ask.

How do i detect where i damaged the NPC?

i tried with this but it won't work:
Code:
get_pdata_int( iEnt, 75 ) == HIT_HEAD
I working hard on this think:


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.


Any better solution please?

Last edited by kovakovi2000; 12-16-2019 at 10:01.
kovakovi2000 is offline
kovakovi2000
New Member
Join Date: Nov 2015
Old 01-03-2020 , 10:57   Re: [HOWTO] Make a NPC with extra features.
Reply With Quote #72

Quote:
Originally Posted by kovakovi2000 View Post
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 View Post
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
kovakovi2000 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:28.


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