How do you extend FDamageEvent for use in TakeDamage()?

I want some more values for my TakeDamage() function and I’ve read that you should be able to derive from FDamageEvent and add anything you need, but I haven’t found any examples of this and when I tried to implement it myself it yelled at me, because of course, the TakeDamage() function doesn’t take my new FSomeDamageEvent struct as a parameter when overriding.

And I couldn’t cast from FDamageEvent to my new struct, either.

USTRUCT(BlueprintType)
struct Some_API FSomeDamageEvent : public FDamageEvent
{
	GENERATED_USTRUCT_BODY()

public:
	UPROPERTY()
	int someVar;
};

I suppose you could pass values through damage types, but that feels a bit hacky.

1 Like

Keep the signature for TakeDamage intact, but cast it to your new class inside the TakeDamage method :slight_smile: