How can I do this? Help please...
dragoncymru
11 Jun 2009, 17:31Two questions:
1. How can I set up a room that is the hub. In it you can set controls to go to another room. There are X rooms available, but everytime I show the 'control' menu, I only want it to show Y options, where Y is a random subset of X (say 4 out of 10)? Plus if you've been to room Z before, it stops it being allowed in future selections?
2. When I go to a room, M random objects appear out of a selection of N objects (where again M is less than N). And how do I stop an object being selected twice and therefore getting less than M objects appearing?
I hope I've explained it clearly enough...
Thanks in advance
1. How can I set up a room that is the hub. In it you can set controls to go to another room. There are X rooms available, but everytime I show the 'control' menu, I only want it to show Y options, where Y is a random subset of X (say 4 out of 10)? Plus if you've been to room Z before, it stops it being allowed in future selections?
2. When I go to a room, M random objects appear out of a selection of N objects (where again M is less than N). And how do I stop an object being selected twice and therefore getting less than M objects appearing?
I hope I've explained it clearly enough...
Thanks in advance
Overcat
12 Jun 2009, 09:47Are you scripting this in a text editor, or are you using the QDK?
Question One:
1) Put all the rooms in a Rooms list.
2) Create another list initially empty: the Control Menu list.
3) Randomly select a room from the Rooms list, remove it from that list, and add it to the Control Menu list. Do this as many times as are necessary (say, five times if you want a selection of five random rooms).
4) Use the Control Menu list to let the player choose a room to travel to.
5) When the player returns to the control room, move all the rooms in the Control Menu list back into the Rooms list, except for the room they just visited.
6) Repeat from step 3.
Question Two:
1) Hide all the objects in a room, upon entry to that room.
2) Put all the objects in the room in a RoomObjects list.
3) Randomly select an object from the RoomObjects list, remove it from that list, and unhide it. Do this as many times as you want objects to appear.
Quest doesn't have built-in list structures, so you'll have to create them yourself. Alternately, if you're not afraid of hand-scripting in a text editor, you can use my List Library Lite. You'll have to read the documentation to see how to use it. The full version of the list library has a bit more functionality (including a GetRandom function to return a random item in a list), but I have yet to write the documentation for it.
The above is just one solution (and is how I would attempt to do it). Others may have different (even better!) ideas.
Question One:
1) Put all the rooms in a Rooms list.
2) Create another list initially empty: the Control Menu list.
3) Randomly select a room from the Rooms list, remove it from that list, and add it to the Control Menu list. Do this as many times as are necessary (say, five times if you want a selection of five random rooms).
4) Use the Control Menu list to let the player choose a room to travel to.
5) When the player returns to the control room, move all the rooms in the Control Menu list back into the Rooms list, except for the room they just visited.
6) Repeat from step 3.
Question Two:
1) Hide all the objects in a room, upon entry to that room.
2) Put all the objects in the room in a RoomObjects list.
3) Randomly select an object from the RoomObjects list, remove it from that list, and unhide it. Do this as many times as you want objects to appear.
Quest doesn't have built-in list structures, so you'll have to create them yourself. Alternately, if you're not afraid of hand-scripting in a text editor, you can use my List Library Lite. You'll have to read the documentation to see how to use it. The full version of the list library has a bit more functionality (including a GetRandom function to return a random item in a list), but I have yet to write the documentation for it.
The above is just one solution (and is how I would attempt to do it). Others may have different (even better!) ideas.
dragoncymru
12 Jun 2009, 16:27Thanks for the advice.
How can I generate this list? And then select randomly from it? And then add to a menu?
And can an object be given a property by another object that can then be called by a third object?
EG An NPC has a henchman, so he gives another object the property 'minion' when the NPC appears. If a third event say 'attacked' appears, could it call any object with the property 'minion'??
i'd love to know how to do this!
Thanks in advance - i'll look at your list library
How can I generate this list? And then select randomly from it? And then add to a menu?
And can an object be given a property by another object that can then be called by a third object?
EG An NPC has a henchman, so he gives another object the property 'minion' when the NPC appears. If a third event say 'attacked' appears, could it call any object with the property 'minion'??
i'd love to know how to do this!
Thanks in advance - i'll look at your list library
Overcat
13 Jun 2009, 13:25You're asking for a lot to be explained, which takes time and some thinking on the part of any would-be helper. I would suggest reading the ASL documentation and playing with scripting for a while to see if you can answer some of your own questions first.
dragoncymru
13 Jun 2009, 16:53Okay I will thanks - i think I've already answered the last one!
dragoncymru
14 Jun 2009, 06:48Okay, sorted out the object problem, but still can't quite nail down the room issue.
Could I instead of creating a menu (still don't know how to change that), what about creating random exits from my hub, that create 'goto' exits?
Then use the 'visited' function to stop going back twice? e
Could I instead of creating a menu (still don't know how to change that), what about creating random exits from my hub, that create 'goto' exits?
Then use the 'visited' function to stop going back twice? e