BOOM Headshots. In DECORATE. Nothing (even remotely) fancy.
Moderators: GZDoom Developers, Raze Developers
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.
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.
-
- Posts: 6
- Joined: Tue Aug 25, 2015 7:22 am
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
thanks! i will be as using this now! thanks for making
- |ndußtrial
- Posts: 398
- Joined: Sat Aug 17, 2013 11:39 am
- Graphics Processor: Intel (Modern GZDoom)
- Location: Ivy Mercy Lyons
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
going to have to remember this
- Carbine Dioxide
- Posts: 1927
- Joined: Thu Jun 12, 2014 3:16 pm
- Location: Anywhere.
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
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
What if I wanted to do head armor and implement the "hurt" sounds (bullet striking metal)?
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
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
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.
todo: make the hitbox and blod function respect the master's blood color
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;
}
}
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
I had no idea you could squish a master definition in there like that!Actor.Spawn("Z_HeadshotHitbox").master = e.Thing;
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
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.
- Leon_Portier
- Posts: 62
- Joined: Sun Feb 12, 2017 3:30 pm
- Location: Dark side of Bavaria
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
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):
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:
- DoomKrakken
- Posts: 3482
- Joined: Sun Oct 19, 2014 6:45 pm
- Location: Plahnit Urff
- Contact:
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
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).
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?
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
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
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
* need to ZScriptify that but I'm sure many others here have already done it in their ZScript projects
- phantombeta
- Posts: 2089
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
Indeed. There's even an universal ZScript version in the Scripts Library forum.Nash wrote:but I'm sure many others here have already done it in their ZScript projects
Here's the forum thread it's in.
- DoomKrakken
- Posts: 3482
- Joined: Sun Oct 19, 2014 6:45 pm
- Location: Plahnit Urff
- Contact:
Re: BOOM Headshots. In DECORATE. Nothing (even remotely) fan
Liking what I'm seeing...