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

Handy guides on how to do things, written by users for users.
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.

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

Postby SlabOfCheese69 » Sat Aug 29, 2015 12:11 pm

thanks! i will be as using this now! thanks for making :)
SlabOfCheese69
 
Joined: 25 Aug 2015

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

Postby |ndußtrial » Mon Jan 18, 2016 12:47 am

going to have to remember this
User avatar
|ndußtrial
please excuse my comprehension issues
 
Joined: 17 Aug 2013
Location: Ivy Mercy Lyons

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

Postby Carbine Dioxide » Mon Jan 18, 2016 12:50 am

If I can use projectiles instead of bullet puffs, then I will like this very much.
User avatar
Carbine Dioxide
True force, all the king's men could not put it back together again.
 
Joined: 12 Jun 2014
Location: Anywhere.

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

Postby EddieMann » Sat Aug 13, 2016 4:03 pm

What if I wanted to do head armor and implement the "hurt" sounds (bullet striking metal)?
User avatar
EddieMann
 
Joined: 18 May 2014
Location: Arizona

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

Postby Matt » Fri Mar 03, 2017 1: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:
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

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

Postby Mikk- » Fri Mar 03, 2017 9: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 allExpand view

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
User avatar
Mikk-
yooooooooooo
 
Joined: 30 Jun 2009
Location: Somewhere off Kanagawa
Discord: Mikk0451#3922

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

Postby Matt » Fri Mar 03, 2017 9: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.)
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

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

Postby ZzZombo » Mon May 08, 2017 5: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.
ZzZombo
 
Joined: 16 Jul 2012

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

Postby Leon_Portier » Thu Jun 01, 2017 1: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:
User avatar
Leon_Portier
 
Joined: 12 Feb 2017
Location: Dark side of Bavaria
Discord: Leon Portier#2527

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

Postby DoomKrakken » Wed Sep 27, 2017 2: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
User avatar
DoomKrakken
Avidly Anonymous Suggester. Hardcore Catholic Gamer. Problem? PM me.
 
Joined: 19 Oct 2014
Location: Plahnit Urff
Discord: DoomKrakken#2719

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

Postby Matt » Wed Sep 27, 2017 5: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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

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

Postby Nash » Wed Sep 27, 2017 9: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
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

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

Postby phantombeta » Wed Sep 27, 2017 10: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.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

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

Postby DoomKrakken » Thu Oct 05, 2017 4:29 am

Liking what I'm seeing... :D
User avatar
DoomKrakken
Avidly Anonymous Suggester. Hardcore Catholic Gamer. Problem? PM me.
 
Joined: 19 Oct 2014
Location: Plahnit Urff
Discord: DoomKrakken#2719

Previous

Return to Tutorials

Who is online

Users browsing this forum: Paar and 2 guests