I’m trying to implement function that picks random names from an array and assign it to characters.
All names are fed from external txt file and stored in array. Array is part of a player blueprint. Then I’ve got other actors calling this array and picking random names, while every time name is picked, it is also removed from array, to prevent duplicate use of the name.
This is how blueprint inside BPRandomCharacter looks like. At event start, names are assigned to each character, then on key press it will execute whole code again and randomize characters. It will return current name back to the array first, then pick random name again and remove it from array. Everthing works as it is supposed to, characters picking random names and none of the names are used twice. Issue is that sometimes some random characters are assigned no name at all. Array itself is updating as it is supposed to, so it will not probably be an issue inside player blueprint. Also PrintString says nothing when this issue occurs. While it prints name and array index properly on the screen for characters with name, it shows no name or array index for affected characters. I’ve spent all day trying to figure out why it happens, but I’m out of ideas.