Hello everyone, I would like to know what is the Blueprint logic by which I can enter and exit the houses in the map.
Ex. I put on a map 3 houses (House1, House2 & HouseBuildingL) in front of these houses there are related player start. I also created 3 maps representing the interiors of the above houses. How can I make it so that when I exit the map of an interior of the houses and my character appears in the corresponding PlayerStart? Thank you in advance for the answers
Hello, I think for such system I would create my own “PlayerSpawner” class instead of using PlayerStart. This Spawner would have a variable (HouseID or HouseName, or something like this).
- Place those spawners in front of the buildings and assign correct Names/IDs.
- When user is leaving the house and you change the level use “Options” to send this Name:
You need to have the same ID in the house and in the Spawner. Maybe use level name or whatever is more handy for you. - In your GameMode enable option “StartPlayersAsSpectators” so player is not spawned automatically.
- On BeginPlay of your GameMode check options string and find correct spawner. Then Spawn and Possess player.
Hopefully general idea is understandable, but if you need any more details just let me know Good luck with the system!
1 Like
should the PlayerSpawner variable “HouseName” be of type float ?
In the example I called this HouseID and used FString, but you can use an int if you prefer.
I wouldn’t use float for that, as floats are not reliable to comparing due to their precision. For example you can set float to 2.0, but it could end up 1,999997 and == operation will return false.