Page 1 of 1

Easy headshots in decorate

PostPosted: Sun Mar 28, 2021 12:15 am
by RubenMelo
so i don't know if someone already posted this before also this is my first post so I don't know if this is the right place to post it basically is a very simple hitbox trick to simulate headshots or head hitboxes

First, you create a simple actor that will be your hitbox
example:

ACTOR Headhitbox
{
health 30
Radius 22 //supossing your main actor has 20 radius
Height 16
Damagetype Headshot // not necessary unless you want to do some custom death states
scale 0.8 // just for debug to see if the "hitbox" is in the correct place
-SOLID
+SHOOTABLE
+NODAMAGETHRUST // make so when the hitbox explodes it doesn't thrust the main actor AKA monster
States
{
Spawn:
TNT1 A 1 A_WARP(AAPTR_Master,0,0,40,0,WARPF_ABSOLUTEANGLE|WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
loop
Death:
TNT1 A 0 A_EXPLODE(60,4,0,0,0,0,0,0,"Headshot")//this is a very tiny explosion with just enough damage too kill the main actor it's attached to
HITB A 0 A_NoBlocking
stop
}
}

then next thing is on the actor/monster you hant the hit box to be attached, all you need to do is a custom spawn state
example:

Spawn:
TNT1 A 0
TNT1 A 0 a_SpawnItemEx("HEADHITBOX",0,0,0,0,0,0,0,SXF_SETMASTER) // spawn the hitbox and set as master
Goto Idle // new "spawn" state

Idle:
SCZA AB 10 A_Look // standard spawn actions
loop

so is a very simple trick and work very well, if you want your hitbox to be smaller than the Monster diameter you can, but normal hitscan won't reach it they will collide with the actor hitbox first, to counter that you can use railguns instead of normal hitscan, and limiting the penetration to 2 so it goes thru the actor hitbox and hit the fake head hitbox, and you can do all sorts of stuff like custom damage types and pain states, etc of even multiple hitboxes in a single actor like legs, torso, and head. is up to your creativity, also you may have to tweak where the hitbox spawn inside the actor or it heigh and radios to work better with your custom sprites or monsters my example is based on an imp size and radius