Have only one actor of a level start with a bool set to true

I’m creating a multiplayer game with several minigames spread out through a level. I need one of them to be selected randomly to be infected (a boolean) that then triggers an even on my player once the minigame concludes. Right now, It’s picking one of the games to be infected, but it is choosing a different one for the server and the clients. I’ve tried adding this code to the level blueprint, the game state, and even the game mode, as well as setting replication, and I do not get the same result each time.

Hey there @Apex14291! Welcome back to the community! My recommendation is to have a single object, likely the game state to hold your random function and decide who is infected. Making the variable a RepNotify and using an RPC to send it’s decision to all players should sync that correctly.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

I appreciate the response, I’ve watched nearly all of KekDots videos (He’s incredible!). Unfortunately, a rep notify isn’t exactly going to work for what I’m going for at the moment (I’ve tried and still couldn’t get it to work the way I need it). For more context, The minigame blueprint holds the Bool variable that is currently set to Replicated. When the minigame is completed from the player, it passes through a branch and if that blueprint is marked as infected, it sends an infection message (via an interface). That interface is on My Player Character, that holds the function that changes their color to green (infected). All of the above works perfectly, except that one mini game console shows as infected to the client, and normal to the server, whilst another console shows the opposite of both to each.

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