BOOM Headshots. In DECORATE. Nothing (even remotely) fancy.

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: BOOM Headshots. In DECORATE. Nothing (even remotely) fancy.

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by DoomKrakken » Thu Oct 05, 2017 3:29 am

Liking what I'm seeing... :D

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by phantombeta » Wed Sep 27, 2017 9:41 pm

Nash wrote:but I'm sure many others here have already done it in their ZScript projects
Indeed. There's even an universal ZScript version in the Scripts Library forum.
Here's the forum thread it's in.

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Nash » Wed Sep 27, 2017 8:28 pm

What's even funnier is, 2 years prior to this thread, I offered a more universal - and tl;dr - solution* but yet this thread is still advocating the convoluted, outdated and spaghetti-like spawning-a-hitbox method...




* need to ZScriptify that but I'm sure many others here have already done it in their ZScript projects

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Matt » Wed Sep 27, 2017 4:41 pm

Can we possibly rename this thread? I forgot about this thread and got momentarily excited at the thought of a BOOM-compatible headshot mod, or some obscure such function that already exists and is now ported to Decorate, and I'm all disappointed now.

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by DoomKrakken » Wed Sep 27, 2017 1:06 am

Bump, but it's very relevant.

I've been trying to make a mod for Doom based off of DOOM, and as such, it would need headshots. Wanting to have as much universal compatibility as possible (as I want to be able to play my mod with mapsets such as Ultimate Torment 'N Torture and ZPack, which have custom monsters), I recently succeeded in making a system that worked with EVERY monster. I didn't want to reveal this until I had released my mod, but once I discovered this thread, I figured it should be shared. After all, I'm seeing a hell of a lot of stuff here that already may help me along with my mod in other ways (never knew about functions such as "A_SetSize" or "WorldThingSpawned" until now).

Anyway, what my function does is check to see if the top 1/6 of an actor's height was struck by a specially coded projectile. If so, it will deal 25% damage to the hit actor (and then proceed to deal the actual damage of the projectile).
Spoiler:
What do you think? :D

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Leon_Portier » Thu Jun 01, 2017 12:20 pm

Very good tutorial, the code can be expanded to create helmets, which fly off when shot.

Looks like this:
https://www.youtube.com/watch?v=CJ4w6GKfqwg

I could not figure out how to pass a var to a child actor, so I used a fake inventory actor.

Code(commented):
Spoiler:

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by ZzZombo » Mon May 08, 2017 4:33 am

You don't really have to forcefully remove actors, just have them to end up in a non-negative duration state w/ the stop flow control keyword, for example "TNT1 A 0". So you can simply remove the label after the A_CheckFlag() call, and put here "TNT1 A 0<newline>stop", it will have the same effect as calling the remove function, but cheaper.

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Matt » Fri Mar 03, 2017 8:24 pm

Actor.Spawn("Z_HeadshotHitbox").master = e.Thing;
I had no idea you could squish a master definition in there like that! :shock:

Might want to set the master's height as well.

(In the meantime I've been messing around with CanCollideWith() to see if it could ignore any collisions that are above the "neck height" but still outside the narrower "head radius" of a full-height monster... seems like it could work, but there may be some projectiles that won't work for it, for the same reason why I had to replace the doomimpball.)

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Mikk- » Fri Mar 03, 2017 8:57 am

Funny you mention ZScript because I too, have been making a ZScript version that can work for any game using eventhandlers. can be customised easily enough, modifying the CriticalFactor changes the amount of damage dealt to the master. Doesn't apply for floating monsters or bosses mostly because it's too OP but I'm sure it can be modified to suit other's needs.

Code: Select all

class HeadShotHandler : StaticEventHandler
{
    override void WorldThingSpawned(WorldEvent e)
    {
        if (e.Thing.bIsMonster && !e.Thing.bFLOAT)
        {
            Actor.Spawn("Z_HeadshotHitbox").master = e.Thing;
        }
    }
    
    override void WorldThingRevived(WorldEvent e)
    {
        if (e.Thing.bIsMonster && !e.Thing.bFLOAT)
        {
            Actor.Spawn("Z_HeadshotHitbox").master = e.Thing;
        }
    }    
}

const CriticalFactor = 2;

Class Z_HeadshotHitbox : Actor
    {
    
    Default
        {
        Health     0x7FFFFFFF;
        Mass     0x7FFFFFFF;
        BloodColor "red";
        radius 32;
        height 32;
        +SHOOTABLE; +NODAMAGETHRUST; +NOGRAVITY;
        }
    
    int lastHealth;
    
    override void BeginPlay() 
        {

        self.lastHealth = self.health;
        super.BeginPlay();
        }    
    
    action void blod(int amount)
        {
        while(amount > 0) 
            {
            if(master.bNOBLOOD)
                { return; } 
            A_SpawnItemEx("Blood",xvel: frandom(1.0,2.0),zvel: frandom(4.0,8.0),angle: random(0,359));
            amount--;
            }
        }
    
    override void Tick()
        {
        if (master)
            {
            self.bNOBLOOD = master.bNOBLOOD;
            if(radius != master.radius || height != master.height)
                { A_SetSize(master.radius+2, master.height/3); } 
            
            if(!master.bSOLID || master.bBOSS)
                { Destroy(); } 
            }
        
        if(self.health < self.lastHealth)
            { 
            blod(15);
            A_DamageMaster((self.lastHealth - self.Health)*CriticalFactor,"default"); self.lasthealth = self.health;
            }
            
        setorigin(master.pos+(0,0,master.height - (self.height * 0.5)),true);
        Super.Tick();
        }
    
    States
        {
        Spawn:
            TNT1 A 1;
            loop;
        Death:
            TNT1 A 1;
            stop;
        }
    }
        
todo: make the hitbox and blod function respect the master's blood color

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Matt » Fri Mar 03, 2017 12:26 am

Bump to add a ZScript version. Unfortunately I can't find a way to bypass the head without redefining the missile. :( If anyone knows how to do it (CanCollideWith is not even called, it seems) please add it!
Spoiler:

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by EddieMann » Sat Aug 13, 2016 3:03 pm

What if I wanted to do head armor and implement the "hurt" sounds (bullet striking metal)?

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Carbine Dioxide » Sun Jan 17, 2016 11:50 pm

If I can use projectiles instead of bullet puffs, then I will like this very much.

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by |ndußtrial » Sun Jan 17, 2016 11:47 pm

going to have to remember this

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by SlabOfCheese69 » Sat Aug 29, 2015 11:11 am

thanks! i will be as using this now! thanks for making :)

Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan

by Zanieon » Thu Jul 30, 2015 6:03 pm

Hmm i might implement this into Hunter's Moon, not as a headshot system but can be usefull to make the lazy-aim players actually try lookup to shoot on the taller monsters. (e.g me)

Top