SetDamageFunction

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

Moderator: GZDoom Developers

Kzer-Za
Posts: 522
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

SetDamageFunction

Post by Kzer-Za »

Currently there is no way no change the damage of an already spawned actor to a fixed, non-random damage amount, since SetDamage randomizes the damage.
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

Re: SetDamageFunction

Post by Gutawer »

In the exact form suggested by the topic title this basically wouldn't be possible since ZScript has no way to pass a function to a function - DamageFunction is a compile time mechanism. This seems quite hard to solve in the general case but in the case that you actually programmed the actors that need this done, keep in mind that DamageFunction is an actual ZScript expression and can do anything they can - including calling a defined function with much more complicated internals, via just DamageFunction DefinedFunctionName();. Then that function can contain if statements, read member variables, etc. This way you can effectively do arbitrary DamageFunction behaviours including just reading your own damage value.
Kzer-Za
Posts: 522
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: SetDamageFunction

Post by Kzer-Za »

Ah, I understand. Actually, I wanted it for one complicated use of altering an existing vanilla projectile, even if it is replaced, but I'll have to do it some other way then (WorldThingDamaged, probably). Thanks for the explanation.
Post Reply

Return to “Feature Suggestions [GZDoom]”