I have created an overlap event which counts how many time people have entered it to prevent giving additional experience after the first time.
What I want to do now is get a reference to whom entered and the counter entered variable only effects them.
[ EXAMPLE ]
Step 1: Player 1 comes along and triggers the event, gains experience and the counter entered is set for them.
Step 2: Player 2 comes along and triggers the event and ALSO gains experience and the count entered is now set for them too. etcetc.
Basically I want any player to enter and gain the experience once, but no duplication experience for reentering if you have already gained experience. Any ideas?
Thanks for your reply mate, I adapted my own code and wrote yours in.
It still is not working, I am not ovely familar with arrays yet either so I am hoping the part I highlighted is the correct pathing method as I need to input a reference into my custom event for the actor.
No problem, try to use Add Unique and see if works. Another option, from Other Actor, get controller and create an array of player controllers or player states. If you are targeting multiplayer, also double-check the replication logic for the variables. And the actor itself should replicate.
I played around since you advised about making arrays with the player controllers. Issue is when I use a GET and then pass that into the Update Experience Server node. It does not find either player (testing with 2 ATM) So neither gain experience, I know there is something small I am missing but I am not sure what
Great, you are almost done. it has to do with replication. Perhaps, you should call an event replicated on server, then call another one replicated type of multicast. Another option is server + owning client.
Another possible area is sending this event to the (EDIT) game state and then let this class call server + multicast. From there, you can get all connected controllers and check consistency. Game state exists only on server and replicates.
This is what I have at the moment, it is not a replication issue I am sure. I just don’t really know how to store the player controller and actor both to use to figure out individual players ← If I can figure that out then I am set. Thanks for your help anyway, gave me a few ideas
When Player 1 enters they are given experience. When they re-enter they do not get
experience and it prints their display name for proof.
When Player 2 enters they are NOT given experience, but the print does not display until they have left and re-entered meaning the array is storing correctly. So what is the issue with player 2 not recieving experience?
I believe is more a replication issue, and it all depends on your game logic. Generally speaking, you want to check if the player controller is a “local controller” and is a “local player controller” (not AI). This prevents the host player (on server) to overwrite other players. Also check replication of the array variable and the actor blueprint itself.
Kind of, if I remember correctly player controller is null for online clients. I know you can get the player’s pawn with Get Pawn and that’s replicated. Tying that into your system however would go a bit differently.
The clients do not get experience from entering at all even if they are first.
Get null error.
I have also tried changing the Character input coming out of the Update Experience nodes from actor to controller and back and forth and neither work. Everything is ticked for replication, the same as the blueprint.
Have you tried running an actual event or something, maybe a print string to test if it is working for yourself too? I know my experience system is completely replicated so it has to do with this blueprint somehow lol