NW3 Health Modifier issue

Search, find and discuss about Mutators!
User avatar
Feralidragon
Godlike
Posts: 5489
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: NW3 Health Modifier issue

Post by Feralidragon »

Aldebaran wrote:Thank you very much for your help Feralidragon!
It works fine now, also I have no teammate healing because of my configuration.
The health modifier now simply prevents self damage only (with the weapon in use) and the flametracker is no problem anymore...

EDIT: The Miner seems to be little bit problematic, because you can place mines and you can get hurt later if they explode if you have not the weapon active anymore with the health modifier. Same can happen with rockets I think if they fly afterwards of an object that comes in your closeness. You mentioned such situations already. So it's not perfect but better than nothing.

EDIT2: Hmm, if I use the boltrife in water with the health modifier I die immediately (normal shot, alt fire is ok).

EDIT3: If I use my mutator with the health modifier, you lose all your armor when shooting. So there exist some issues why this mutator isn't useful at this time.
Yeah, forgot about the mines, although with a bit more work they could still be accounted for: every NW3 projectile stores whether or not it has the health modifier active, through a property with the same name (HealthGiver).
That along with the custom damage type they have ('MineExplosion'), you could somehow detect if you're being damaged by a nearby mine you placed or not.

As for the boltrifle, I am not sure what's going on there, the code clearly accounts for the health modifier as well.
You're using the mutator MutatorTakeDamage function to prevent damage, I would imagine?

As for the armor, assuming that MutatorTakeDamage is what you're using, the game seems to call it only afterwards it runs the damage through the inventory (armor).
One turnaround for this is if you create your own dummy armor, something that does not actually extend from any armor, but is inventory the player may carry, and upon the player spawn you give this "armor" to them.
This "dummy armor" could do essentially the same checks discussed about and such, and even if you got armor in the game, it would be added to the end of the inventory list, so the armor wouldn't be drained if the first "dummy actor" reduced the damage to zero.
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: NW3 Health Modifier issue

Post by Aldebaran »

Function MutatorTakeDamage has these parameters:

Code: Select all

function MutatorTakeDamage(out int ActualDamage, Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType)
So I think it is not possible to conclude from these parameters to the projectile's properties, only the projectile type in general is known via DamageType and even here no difference exist between a landmine or seamine...
I don't know how the miner issue can be solved then.

What the boltrife concerns I have to investigate what config line is the reason for that behaviour. It seems my config differs in many ways from standard ones.
User avatar
Feralidragon
Godlike
Posts: 5489
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: NW3 Health Modifier issue

Post by Feralidragon »

Aldebaran wrote:Function MutatorTakeDamage has these parameters:

Code: Select all

function MutatorTakeDamage(out int ActualDamage, Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType)
So I think it is not possible to conclude from these parameters to the projectile's properties, only the projectile type in general is known via DamageType and even here no difference exist between a landmine or seamine...
I don't know how the miner issue can be solved then.
Indeed, that's why I said:
"That along with the custom damage type they have ('MineExplosion'), you could somehow detect if you're being damaged by a nearby mine you placed or not."

What I meant with this is that you can check DamageType to see if it's MineExplosion.
From there you know a mine exploded at least, all you need to do next is to find which one, and while you cannot know exactly which one was it if there's more than 1 in range, you can go the heuristic route and just choose the one which was more likely to do so: the one nearest you.

For this you can do a VisibleCollidingActors iteration I believe, if not then a VisibleActors would also work, although it's more expensive in this case.
From here, you could go a step further and also exclude any mines which belong to other players/teammates, for a more accurate result.

Now, this is super dirty, I know, and since it uses a simple heuristic to "guess" which mine is exploding, it may not work 100% of the time, but should work for most use cases. :)

I may still like and enjoy the weapon pack itself, but certainly not the code underneath it, kinda hurts my eyes whenever I look at it, if I did it all over again nowadays I would do it in a radically different way, but it wasn't until about 2-3 years ago when I finally got around in properly structuring my code so things like these wouldn't happen in the first place.
And while I won't redo this one of course, I intend to do something new in the future and I won't be committing the atrocities I committed in this pack. :lol2:
Aldebaran wrote: What the boltrife concerns I have to investigate what config line is the reason for that behaviour. It seems my config differs in many ways from standard ones.
Even configuration-wise that shouldn't happen, from what I have checked, but I may also be missing or forgetting something.
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: NW3 Health Modifier issue

Post by Aldebaran »

Feralidragon wrote:I may still like and enjoy the weapon pack itself, but certainly not the code underneath it
Your weapon pack is awesome, I have tried so many things that can be configured with it. There are only a few minor things that should be fixed in my opinion, but altogether I could implement my ideas and I am very happy with it.
User avatar
Feralidragon
Godlike
Posts: 5489
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: NW3 Health Modifier issue

Post by Feralidragon »

While the pack does a lot indeed (most of which is unused by the community even), the main reason is not because the code itself is flexible, it's only because those were the thousands of use-cases I imagined and developed them all into a single pack.

This means that the underlying code does not have that much flexibility as it may look at first, and it's relatively hard to be extended or modified without recompiling the whole thing into a new release, and that is the sign of poorly structured code right there.
And I didn't realize this then, I only realized this years later as I developed myself as a developer over the years.

Don't take me wrong, to this date I am still happy with it, and quite proud that I was actually able to do something like this (that's why I still use it in my signature), and the whole thing is very stable and does a lot, and even I have some fun with them myself times to times, be it online or against bots.
But technically, the code quality isn't that great, at least by my own standards nowadays, and it shows in cases like this which should be simple to tackle.

No worries though, it was what I was able to do back then, and naturally a developer only gets better over the years to the point of looking at past code with frustration, disdain at times even :lol2: , but that's all part of the process of being a developer. :)
Post Reply