Should I loop to wait for other player variable to be set?

Hi Everyone,

In my players characters blueprints I am trying to calculate damage with data resulting from both sides of a ComponentHit event. Ie for each character I want to use the other characters Hit data too to work out the result.

So I’m storing all recent Hit’s in a short list coupled with a sequential running id number for each hit.

Just after that in the Blueprint I want to use that data.

The problem is that for each character I don’t know if the other character has managed to save out its Hit data yet. So I don’t know if I can expect to be able to proceed.

I thought maybe I can use an ‘isSet’ bool and maybe create a loop that continually checks the other character until its set, but that sounds dangerous it might get stuck.

What is the common way of solving this kind of problem?


no need to poll - the hitter and hittee can call each other directly through defined protocol

read up and use built in damage model - use instigator to track who hit who

Yes I can call the other character for sure, but that doesn’t help me if I cannot know which characters’ Hit event gets calculated first by the engine.
I already know who the instigator is, the problem is knowing when both Hit’s have been calculated, inside the OnComponentHit event.