How would I transfer a message between an unloading object and a loading object?

In my game, each room is an collection, with the player as a sub-collection object, when a loading transition is hit, the screen loads the new collection, this functions fine, the issue is that a room has multiple entry points, depending on which object was used to enter the room the player needs to be Infront of a different entrance, I thought of teleporting the player while the screen was still loading but I ran into an issue where I need to then send a message between an object and the player, of which are in different collections loading in at different times.

I tried using timer.delay, but the timer seems to stop when the object is unloaded

is there anyway to send message between these two objects?

Why not store this information in a lua module instead? On exit store which transition point was used, and on load access this to check which entry point to use.

4 Likes

I tried this today and the issue is that I need it on a time because the transition isn’t immedate, using timer.delay still seems to stop when the collection is deloaded, even when the lua script is ouside of the game accested with require

I might be misunderstanding your scenario description, but my guess is that if you have a persistent controller collection to drive the game then it all should fall into place.

image
this is my main collection, where I load in each level, after testing I know for sure Its always active

pcTransition is where the teleport script is located, however the timer is still being broken between screens, probably because the caller de-loads

I’ve tried a msg post as well but then I can’t find the player (pc) that I put in the level collections

I fixed the issue, what I did that ended up working is using a variable in the loader collection being returned by the players init which then updates the position