Mikk's ZScript resources [Smooth fire 2.0!]

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Mikk's ZScript resources [Smooth fire 2.0!]

Post by Mikk- »

I've been tinkering away at some small resources as a practice for ZScript modding

Here's what I've come up with:

Smooth Fire v2.0

Nicely animated (non-particle) fire FX, comes in 2 shapes and almost unlimited colours! - massively customisable!!
Spoiler: Things to note:
Universal Headshots

Simple mod which adds headshot hit-boxes to all enemy types, also includes an enemy blacklist for those that shouldn't take headshot damage.
Spoiler: Things to note:
Last edited by Mikk- on Tue Jan 19, 2021 8:13 am, edited 3 times in total.
User avatar
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: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Matt »

Nice! I didn't even realize you could do that with eventhandlers! [apparently I had completely glossed over that fact when you posted it on the other thread -_-]
Revenant shoots own hitbox, so it has been blacklisted.
I take it that there's no precaution against when an imp is shooting at a target at a very steep pitch upwards? That's always been the reason why I've tended to avoid headshot actors.
This does not currently transfer ownership of kills to the player
If you use master.DamageMobj() instead of A_DamageMaster() (and use the hitbox's DamageMobj() instead of constantly polling hitpoints) you can specify the inflictor and source so that the monster is recorded as being damaged by whatever hit the headbox.

anyway, bumping because this deserves more attention than the other spaghetti headshot thread.
User avatar
Ryuhi
Posts: 368
Joined: Tue Feb 21, 2017 11:00 pm

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Ryuhi »

Loving this system, but a quick question:

Is there a way to set the headshot hitbox to take on the species of the monster that calls it? If so, you could theoretically use mthruspecies to allow its own projectiles to pass through it to avoid enemies from hitting themselves (especially when aiming upward) I don't think you can do it in decorate, but I was wondering if it was maybe possible with zscript?

edit: Giving the headshot hitbox +Spectral did the trick, but its a bit hacky since it means the player will need to apply +Spectral to any projectiles that can score a headshot (and no enemy projectiles will be able to use the flag in the process, lest they repeat the problem)
User avatar
Leon_Portier
Posts: 62
Joined: Sun Feb 12, 2017 3:30 pm
Location: Dark side of Bavaria

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Leon_Portier »

It looks very nice and works well!
The code looks complex though, may I ask questions if any come up?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Mikk- »

Yeah sure. If you have any questions feel free to post them here or message me privately
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Enjay »

Sorry to necro this one but does anyone know why this mod flags this warning and what can be done about it?

Code: Select all

Script warning, "mk-zscr-headshots.pk3:zscript.txt" line 127:
Truncation of floating point value
The bit of code in question is:

Code: Select all

			if(self.health < self.lastHealth)
				{ 
				hs_SpawnBlood(10);
				A_DamageMaster((self.lastHealth - self.Health)*hsfactor,"default"); self.lasthealth = self.health;
				}
and the relevant line is the one with A_DamageMaster

I'm going to assume that it's because (from the wiki) the amount of damage done is an int...
A_DamageMaster (int amount...
but that (self.lastHealth - self.Health) is a float. However, I don't know how to address that.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Blue Shadow »

I'm assuming 'hsfactor' is a float/double. Multiplying an integer with a double produces a double still. Casting the following expression to an integer should silence the warning:

Code: Select all

(self.lastHealth - self.Health)*hsfactor
After the cast:

Code: Select all

int((self.lastHealth - self.Health)*hsfactor)
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Enjay »

Thank you. That seems to be working perfectly.
DoomedRabbit
Posts: 31
Joined: Sun Jul 14, 2019 1:13 pm
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by DoomedRabbit »

Hi,

Sorry for the bump but the Smooth Fire resource does not seem to be working properly on my end.
When I put the resource into my GZDoom Builder Game Config Resources it gives me this error:

"Failed to apply MAPINFO DoomEdNum override "10101 = zfire": failed to find corresponding actor class..."
"Failed to apply MAPINFO DoomEdNum override "10102 = zfire2": failed to find corresponding actor class..."

I don't know what this is all about but if anyone can help me with this I would appreciate it.
User avatar
vólentiæn
Posts: 101
Joined: Fri Mar 25, 2016 10:44 pm
Location: Neuss, Germany

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by vólentiæn »

sorry for the bump but it seems gzdoom wont reconise decorate actors when i add them to the exclusion area (its a custom flying lost soul type enemy)
really wish it could considering they end up killing them selves

Code: Select all

Script error, "’.K 2.1.wad:ZSCRIPT" line 15:
Unknown class name 'AgroPropeller' of type 'Actor'

is what i get back
i honestly know nothing about zscript to rewrite it in zcsript instead
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by Mikk- »

vólentiæn wrote:sorry for the bump but it seems gzdoom wont reconise decorate actors when i add them to the exclusion area (its a custom flying lost soul type enemy)
really wish it could considering they end up killing them selves

Code: Select all

Script error, "’.K 2.1.wad:ZSCRIPT" line 15:
Unknown class name 'AgroPropeller' of type 'Actor'

is what i get back
i honestly know nothing about zscript to rewrite it in zcsript instead
I can take a look into this, at some point.

in other news I've updated the Smooth Fire to be even more modular, it can now take the colour value set in your UDMF editor of choice! Also some code improvements here and there have been made over the past few years. Check it out in the main post
XLightningStormL
Posts: 384
Joined: Mon May 09, 2016 1:38 am
Location: Anywhere but here
Contact:

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by XLightningStormL »

Ryuhi wrote: edit: Giving the headshot hitbox +Spectral did the trick, but its a bit hacky since it means the player will need to apply +Spectral to any projectiles that can score a headshot (and no enemy projectiles will be able to use the flag in the process, lest they repeat the problem)
Sounds like a great bypass in theory, but you are screwed if you use hitscans, since they don't care if either the weapon or the puff has +Spectral or not, it just won't allow the damage to be dealt.
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: Mikk's ZScript resources [Smooth fire 2.0!]

Post by Mikk- »

Adding the +SOLID flag and a CanCollideWith override can alleviate the Revenant issue all together, something I didn't know 3 years ago when making this simple resource.

Code: Select all

    override bool CanCollideWith(actor other, bool passive)
        {
        // if the potential collision is with the master, or the master's projectile do not collide.
         if((other.target && (other.target == master)) || (other == master))
            return false;
            
        return super.CanCollideWith(other, passive);
        } 
Here's a small updated version of the actor-based headshots. It's not intended to be used as a gameplay mod, so some tweaking may be required.
The T_W_C
Posts: 14
Joined: Tue Dec 01, 2020 9:24 am

Re: Mikk's ZScript resources [Smooth fire / Universal Headsh

Post by The T_W_C »

Mikk- wrote:Yeah sure. If you have any questions feel free to post them here or message me privately

How would I change the damage of the headshots so it does insta kill enemies
Post Reply

Return to “Script Library”