Add parameter to SetDamage() to disable randomization.

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Guest

Add parameter to SetDamage() to disable randomization.

Post by Guest »

Use case: A projectile is deflected by a shield and has its damage increased. Shield overrides CanCollideWith and sets projectile's damage to (damage * 2). Ok, for vanilla projectiles that works wonderfully, but once the projectiles start having expressions or other static numbers that require a lack of randomization, things get complicated.

That said, would it be possible to add a bool to disable randomization for damage changed by SetDamage()?
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: Add parameter to SetDamage() to disable randomization.

Post by Matt »

Seconded... on the proviso that if someone knows a better way to set this stuff that already exists I'd like to know (and make a note somewhere on the wiki where people can actually see it).

That said:
Shield overrides CanCollideWith and sets projectile's damage to (damage * 2)
Please do not do this. It should be a lot better documented, but doing things that change or affect actors in the playsim with a data function like CanCollideWith can lead to a lot of bad things happening because a lot of different things will be relying on this check and it can happen many more times than you might think.
Guest

Re: Add parameter to SetDamage() to disable randomization.

Post by Guest »

Oh right, thanks for the reminder. I did read about that in the wiki, multiple times in fact, but forgot it was quite problematic. Will fix it.
Accensus
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Add parameter to SetDamage() to disable randomization.

Post by Accensus »

OP here. This can be closed because I realized a while ago that I could just make a variable and use it in DamageFunction, rendering this feature suggestion unnecessary. For my goals at least. Maybe someone else can find an actual use for it.
Post Reply

Return to “Feature Suggestions [GZDoom]”