How to Apply Damage without instigator?

There is an other function to Apply Damage?
If the damage is applied by an actor (it is not a Pawn), Then it has not controller, then instigator is NULL.

static float ApplyDamage
(
AActor * DamagedActor,
float BaseDamage,
AController * EventInstigator,
AActor * DamageCauser,
TSubclassOf< class UDamageType > DamageTypeClass
)

Thank you so much!!

2 Likes

I have never used Apply Damage because I don’t approve of violence in video games, but what is the actual question or problem? Do you need an instigator?

1 Like

I haven’t tested this, but try just creating local variable AController* EventInstigator = nullptr; and pass this variable to the function. You can pass null Intigator in BP, so I assume it will work the same way in C++.

4 Likes

Hahaha!! Nice philosophy!!
Ok, I’m sorry… i feel like a idiot…
the instigator can be leave nullptr… it does works like this!!
But, i think the documentation must I should say that.
Normaly a get a crash when a NULL pointer is used.

Thank you very much for trying to help!!

Yes you are right, I just did that and it worked.
Thank you very much for your help!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.