Actor relevancy - event on client when actor becomes relevant again?

In a multiplayer game I have actors that are not always relevant.

Is there any client-side event that gets triggered if the actor is being replicated again?

Or a server event that could trigger a client-side event?

My imagined program flow:

Players spawns, actor is present
Player leaves area, actor is not relevant anymore
Player enters area again, actor is relevant again (I need an event here!)

I couldn’t find anything about this.

Any suggestions welcome!

I can use the PlayerState’s OnPawnSet event in my case. Not exactly what I was looking for, but works for my specific problem.

Solved.

On clients, when a replicated actor is no longer relevant it is destroyed on the clients sim.
When it becomes relevant again the “client” spawns a new instance based on freshly replicated data.

Use the End Play Event to see this in action.

That being said you should be able to store relevant states on the servers actor instance per client. So when the actor is spawned again locally you can fire specific events/functions.

Add a sphere collision the same radius as netcull distance. You can scale this via construct if needed.

Use OnBeginOverlap event to RPC the server.
Disable this collision Immediately though. EndPlay takes a few seconds to destroy the actor. Leaving it enabled will skew overlap updates.

You can technically leave netcull distance and re-enter. this will keep the actor alive.

image

1 Like

OK thanks that’s a clever way to do it!

Working demo. Everything is managed in the cube actor class. Nothing in any other class.

1 Like

Yep, that’s really working well!

I think it would be worth to introduce an extra collision channel for the relevancy to prevent unwanted overlap events, too.

Thanks for the great idea!

In my struct I have a LastUpdate float I check against before iterating. If I had a purpose for this code I’m sure I’d have a different conditional criteria.

1 Like

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