Closed jinc0930 closed 2 years ago
I don't know if it's intended, but every character is always in the same room. Only the rooms position are random, but the room name is always paired with the same character, that also pairs with the same item.
The solution is probably shuffle every single array. Maybe even a better solution is using our already created Pool structure.
// make a pool (characters) using our existing function
// -1 is the index we want to exclude which is none
// 9 is size of the pool
// 1 is how many times an item should be taken to be removed from the pool
struct pool = makePool(-1, 9, 1);
// loop 9 times, getting a random index
for (size_t i = 0; i < 9; i++) {
// takes a random index from the pool
int rnd_idx = poolGet(pool, 1);
addChar ( charrarr[rnd_idx] );
}
as the title suggests, the character needs to spawn more randomized.