I’m really having trouble with this thing…
I have spent a few weeks trying to work out why it is happening and trying alternative methods to fix it.
Basically:
pick a number 1-21,
was it 1 ? yes.
is 1 in the already used list ? no.
is it currently number 1 already? no.
set name of row to 1.
append list of used numbers with 1.
this number it picks out is used with my data table, 1 would be row 1.
Each row contains a word, some underscores and a phrase.
If row 1 was picked, it will display the underscores and you press letters to guess the letters of the word (all this part is perfect)
It will pick the same word twice, sometimes it will just get stuck one 1 word or sometimes it will not show the underscores so theres no hint. But it will do some words fine, getting random ones and showing the underscores .
This is a really big project and a print screen would not be enough.
If a staff would like to take a look, I can send you it in a private message with a google drive link.
All my sections of blueprints have comments so it won’t be too hard to follow.
instead of making a list of used names, why not make a array of AvailableNames, and use RemoveIndex on the array elements when they are used? that would speed up your search ( by removing the need to search entirely), and if you limit the random integer range to the length of the AvailableNames array, it will guarantee that every random number chosen is a valid index, leading to a unique, unused name.
at the start of the game, to initialize the array of AvailableNames, you can use GetDataTableRowNames.
randomIntegerInRange has a Max input, which you can set based on the length of the AvailableNames array. as you use RemoveIndex to remove options from the array, it will get smaller, and at the same time, the range of your random numbers will get smaller. every random number this produces will be a valid index in the array, and every index will point to a unique Name that has not been used yet.
so, yes, this solution should fix all of the bugs you mentioned.