SetDamageFunction

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: SetDamageFunction

Re: SetDamageFunction

by 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.

Re: SetDamageFunction

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.

SetDamageFunction

by 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.

Top