H
hacktually
Guest
Hi everybody,
I'm trying to go to create a random list of rooms based on what the player selects on a menu. The list of rooms could potentially be huge (200+) since there are various options that could be selected. I've tried messing around with ds_lists for this, but I haven't had any luck. Here's what I tried on a small scale for testing once the player hits continue on the menu:
The idea here is to add rooms to the list if certain variables = 1 (these rooms will be used the rest of the game until there are no rooms left), pick a random number, delete that entry to shrink the list size and keep rooms from showing up twice, and then go to that room. Can anyone explain where I'm going wrong? Is there a more efficient way to do this? This is the only thing holding up my project so any help would be appreciated.
I'm trying to go to create a random list of rooms based on what the player selects on a menu. The list of rooms could potentially be huge (200+) since there are various options that could be selected. I've tried messing around with ds_lists for this, but I haven't had any luck. Here's what I tried on a small scale for testing once the player hits continue on the menu:
Code:
testList = ds_list_create();
if Spells = 1
{
ds_list_add(testList, "2");
ds_list_add(testList, "3");
ds_list_add(testList, "4");
ds_list_add(testList, "5");
}
if !ds_list_empty(testList)
{
randomRoom = random_range(1, ds_list_size(testList));
ds_list_delete(testList, randomRoom);
room_goto(randomRoom);
}