SetDamageFunction

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

Moderator: GZDoom Developers

SetDamageFunction

Postby Kzer-Za » Sun Dec 12, 2021 3:33 am

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.
Kzer-Za
 
Joined: 20 Aug 2017
Operating System: Other Linux 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: SetDamageFunction

Postby Gutawer » Sun Dec 12, 2021 7:40 am

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.
User avatar
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431

Re: SetDamageFunction

Postby Kzer-Za » Sun Dec 12, 2021 8:43 am

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.
Kzer-Za
 
Joined: 20 Aug 2017
Operating System: Other Linux 64-bit
Graphics Processor: nVidia (Modern GZDoom)


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest