Page 1 of 1

Mikk's ZScript resources [Smooth fire / Universal Headshots]

PostPosted: Fri Aug 04, 2017 1:03 pm
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

Nicely animated (non-particle) fire FX, comes in 2 shapes and 5 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:

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

PostPosted: Thu Sep 28, 2017 9:14 pm
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.

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

PostPosted: Thu Oct 05, 2017 8:31 pm
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)

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

PostPosted: Mon Oct 09, 2017 1:15 pm
by Leon_Portier
It looks very nice and works well!
The code looks complex though, may I ask questions if any come up?

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

PostPosted: Mon Oct 09, 2017 1:50 pm
by Mikk-
Yeah sure. If you have any questions feel free to post them here or message me privately

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

PostPosted: Sun Jan 27, 2019 8:57 am
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 allExpand view
Script warning, "mk-zscr-headshots.pk3:zscript.txt" line 127:
Truncation of floating point value


The bit of code in question is:
Code: Select allExpand view
         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.

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

PostPosted: Sun Jan 27, 2019 10:53 am
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 allExpand view
(self.lastHealth - self.Health)*hsfactor

After the cast:

Code: Select allExpand view
int((self.lastHealth - self.Health)*hsfactor)

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

PostPosted: Sun Jan 27, 2019 11:25 am
by Enjay
Thank you. That seems to be working perfectly.