Hello back everyone,
Been working on a feature like this:
I’ve spawned some items on the map with a tag “Item”.
In the Gamestate, on the EventBegin i’m loading an array of theese actors with the tag “relic”.
So far, no problem, the array gets loaded fine and i see the items in it.
Now the hard part.
I have a component that has to be “pointing” toward the location of one of theese “relic” actors.
I’ve managed to get it but i’m having a problem applying this logic on my Multiplayer project.
This is what i’m doing:
on event “possessed” i’m getting the game state and calling the function AssignRelic
on the gamestate i have this:
as you can se the “ServerAssignRelic” logic is "run on Server.
AllRelics is Replicated.
my “RelicLocation” variable is Replicated too even if each “controller” will get the vector of the location of the assigned relic.
During every execution i get the first item in the array i can get, and remove it from the array.
Had to insert a small delay becaus the Server-Listener was executing too quickly and was getting None for an empty array.
Now: i think the problem might be that many players accessing the same array at the same time might remove the items during the assign, off each other, and causing some nulls. as if i have 3 Relics and 3 Players, i sometime end up with 1 item still in the array.
if that is the case ( and you dont’ see anything weird with my blueprints) what is a clean way to tell each controller to get his item without conflicting with other player’s?
Thank you and happy Christmas