Page 1 of 1

Pain chance factor on weapons

Posted: Thu May 02, 2024 12:20 am
by Rowsol
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.

Re: Pain chance factor on weapons

Posted: Thu May 02, 2024 8:59 pm
by Zhs2
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;
	}
}

Re: Pain chance factor on weapons

Posted: Thu May 02, 2024 10:16 pm
by Rowsol
Appreciate the help.

Re: Pain chance factor on weapons

Posted: Fri Nov 29, 2024 3:22 pm
by De-M-oN
Is it also possible the opposite way?
So that I can have a faster chaingun, but the painchance stays same/similar?

Re: Pain chance factor on weapons

Posted: Sun Dec 01, 2024 11:39 am
by Zhs2
The PAINLESS flag on your puffs or projectiles can be used to achieve the opposite effect.

Re: Pain chance factor on weapons

Posted: Mon Dec 02, 2024 10:26 am
by De-M-oN
But that would disable pain entirely.

Re: Pain chance factor on weapons

Posted: Tue Dec 03, 2024 3:58 am
by Rachael
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.

Re: Pain chance factor on weapons

Posted: Thu Dec 05, 2024 5:37 am
by Professor Hastig
Aren't there enough questionable pain flags already? The code looks horrendously convoluted to handle all the special exceptions that were added to it.

Re: Pain chance factor on weapons

Posted: Thu Dec 05, 2024 8:23 am
by Rachael
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.
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.

Re: Pain chance factor on weapons

Posted: Fri Dec 06, 2024 8:45 pm
by Zhs2
De-M-oN wrote: Mon Dec 02, 2024 10:26 am But that would disable pain entirely.
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.

Re: Pain chance factor on weapons

Posted: Mon Dec 09, 2024 12:18 pm
by De-M-oN
ahh yes that might work. thank you