This is the status of my Blueprints:
On my GameMode i have:
On my Gamestate i’ve generated the Array i load in the GameMoad and i’ve set it to Replicated.
On my Character Blueprint i have this:
Now the explaination:
I wanted to have one Progress bar to work as a “Healthbar” for my current player, and up to 3 little bars ( it’ll be a 4 player game ) just beneath it. Thoose bars have to show Health and Name.
I’ve made an array of controllers, and i’m looping into them, whenever i get My own controller, i just add to viewport the Default Hud, whereas i get another one, i’ll get that Controller Pawn, pass it to the Widget and get Health and name out of it like this:
At this moment i have an issue and some questions:
If i remove the node “isValid” after the ForEach, i get a red error
PIE: Error: Blueprint Runtime Error: “Accessed None trying to read property CallFunc_Array_Get_Item”. Node: Create Widget Graph: EventGraph Function: Execute Ubergraph BP Top Down Character Blueprint: BP_TopDownCharacter
But even with the errore the widget appear ( without the correct bindings to hp and Name)
If i do add a “isValid” node, the widger appears only on the first player (which is the server-listener).
So far i think the problem lies in how i’m using the Array, and i feel like it’s getting out of replication, for the error makes me suppose the second player is getting an empty array.
still, the bar pops out, so it’s not getting an empty array, just one with wrong values.
I’ve been trying to fix this for a couple hours at the moment and i’ll be back at it tomorrow, but in the meantime, if someone notices something it’d be really great.
Also another question:
I’m using a “delay” function after my “onPosses”, because the first player spawns immediately while the others require a few istants. i think i’ll have to make a custom event that gives an “ok” whenever every player has loaded in ( if something like that doesn’t already exist as a default).
might that be part of the problem? does a solution to the “delay” exist that’s more functional and elegant?
Thank you.