by 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.
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 [c]DamageFunction DefinedFunctionName();[/c]. 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.