In the game I am working on, I would like to have the task you need to do to win randomized. Is there a way to have the player pick up a 'to do' list and have it randomly change with every game (maybe 5 tasks to complete out of 20 random). This is my first game and a bit of a green horn, but having soooo much fun trying! Thanks to anyone who can help! Ryan
Sure, you have to script all of this by hand though.
Basically you'd start by creating a String array holding the task descriptions and a flag to mark the task as active, like this:
// Global.ash
import String task[20];
import bool task_active[20];
// top of Global.asc
String task[20];
bool task_active[20];
export task, task_active;
The next step is to select five at random. I'd put that in a custom function and call if from game_start:
// Global.asc, above game_start
function SetUpTasks() {
task[0] = "Win car race";
task[1] = "Plant tree";
task[2] = ...
...
int i, rr;
bool fnd;
while (i < 5) {
fnd = false;
while (!fnd) {
rr = Random(19);
if (!task_active[rr]) {
task_active[rr] = true;
fnd = true;
}
}
i++;
}
}
To check current tasks, go from 0 to 19 and add task[] to a listbox or something if task_active[] == true.
When a task is completed, set its task_active[] to false, then check all 20 for being false. If all are, the game is won.
Depending on what tasks you have in mind, you will probably have to set up your rooms so objects/people from inactive tasks aren't there or don't work/respond.
Thank you soooo much! Sorry if it seemed a stupid question, but I'm full of 'em....since I'm new at doing anything like this! I will try it out and see what happens! Thanks again for your help! Ryan