Page 1 of 1

Add parameter to SetDamage() to disable randomization.

PostPosted: Fri May 31, 2019 5:45 pm
by Jarvis Wesslefoot
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()?

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

PostPosted: Fri May 31, 2019 7:57 pm
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.

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

PostPosted: Sat Jun 01, 2019 2:06 am
by Jarvis Wesslefoot
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.