Pain chance factor on weapons
Moderator: GZDoom Developers
-
- Posts: 982
- Joined: Wed Mar 06, 2013 5:31 am
Pain chance factor on weapons
I could really use a way to adjust pain chance on weapons, without the need to edit monsters. A setting like PainChanceFactor would work wonders. Currently, if I want a powerful weapon to have a higher chance of stunning, my only recourse is adding a bunch of mini a_explodes to the impact.
-
- Posts: 1288
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
Re: Pain chance factor on weapons
This is a "just" tier solution but here's how you can legally hack it:
Code: Select all
// Do this on a puff or projectile.
override void BeginPlay()
{
Super.BeginPlay();
if(random(1, 100) <= 40) // 40% chance to commit pain, which of course stacks on top of any current painchances. Edit to fit your needs.
{
bFORCEPAIN = true;
}
}
-
- Posts: 982
- Joined: Wed Mar 06, 2013 5:31 am
Re: Pain chance factor on weapons
Appreciate the help.
-
- Posts: 206
- Joined: Mon May 26, 2008 3:24 pm
- Preferred Pronouns: He/Him
- Location: Germany
Re: Pain chance factor on weapons
Is it also possible the opposite way?
So that I can have a faster chaingun, but the painchance stays same/similar?
So that I can have a faster chaingun, but the painchance stays same/similar?
-
- Posts: 1288
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
Re: Pain chance factor on weapons
The PAINLESS flag on your puffs or projectiles can be used to achieve the opposite effect.
-
- Posts: 206
- Joined: Mon May 26, 2008 3:24 pm
- Preferred Pronouns: He/Him
- Location: Germany
Re: Pain chance factor on weapons
But that would disable pain entirely.
-
- Posts: 13794
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Pain chance factor on weapons
The flag can be applied randomly based on chance. In the case of puffs you can use inheritance and swap a painless puff out for another when you need a lower pain chance for the puff.
I know this is far from ideal, it's a bit hacky, but a proper implementation ("fix" if you prefer) for this will require a full flag anyway because it would require overriding behavior that would likely break old mods without it.
I know this is far from ideal, it's a bit hacky, but a proper implementation ("fix" if you prefer) for this will require a full flag anyway because it would require overriding behavior that would likely break old mods without it.
-
- Posts: 255
- Joined: Mon Jan 09, 2023 2:02 am
- Graphics Processor: nVidia (Modern GZDoom)
Re: Pain chance factor on weapons
Aren't there enough questionable pain flags already? The code looks horrendously convoluted to handle all the special exceptions that were added to it.
-
- Posts: 13794
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Pain chance factor on weapons
Actually I agree. There's absolutely *WAY* too much override-of-override-of-override-of-override-of-override cruft in the Actor class as it is and this post reminded me of that.Professor Hastig wrote: ↑Thu Dec 05, 2024 5:37 am Aren't there enough questionable pain flags already? The code looks horrendously convoluted to handle all the special exceptions that were added to it.
-
- Posts: 1288
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
Re: Pain chance factor on weapons
Yes. You do not want to place it in a puff or projectile's default field, but rather randomize whether it is true at the puff or projectile's creation, as per the above post. Just replace bFORCEPAIN with bPAINLESS.
-
- Posts: 206
- Joined: Mon May 26, 2008 3:24 pm
- Preferred Pronouns: He/Him
- Location: Germany
Re: Pain chance factor on weapons
ahh yes that might work. thank you