Giving choices
Skypioneer
31 May 2011, 14:57Hello everyone, I've just started making games with this wonderful program! I've tackled the introductory tutorial and completed it but now I have a problem which I'm not sure is possible.
I want to give the player a few choices when they encounter certain events. For example, in my game, there's a homeless man, and I want to give the player to choose whether they want to
[1] - Spare him some money (I've set this up using a status variable)
[2] - Ask him what he's using it for
[3] - Ignore him and be about your business
...and obviously every choice leads to different dialogue.
Is there any way I could do this? To prompt the player for an answer like this, maybe even have them type out a number in response.
I have been working on this game for about a week and I would really appreciate the help
I want to give the player a few choices when they encounter certain events. For example, in my game, there's a homeless man, and I want to give the player to choose whether they want to
[1] - Spare him some money (I've set this up using a status variable)
[2] - Ask him what he's using it for
[3] - Ignore him and be about your business
...and obviously every choice leads to different dialogue.
Is there any way I could do this? To prompt the player for an answer like this, maybe even have them type out a number in response.
I have been working on this game for about a week and I would really appreciate the help

RedTulip
01 Jun 2011, 00:54You could use a Select Case script.
As the variable, you could type '#answer#'.
Then, you add cases.
The first case, maybe, would be '1; Spare him some money'. So, if the answer variable is either 1 or Spare him some money, then it would run the same script.
Click OK. The script editor might pop up. If it doesn't, click the case you made earlier and click the 'Edit...' button beside the empty script box.
Now, you could pick some scripts. Maybe, you'd print a message saying, say, "You hand the man some cash.". The next script could reduce the amount of money the player currently has.
Click OK and add more cases, the second case could be '2; Ask him what he's using it for' and the third would be '3; Ignore him and be about your business'. The scripts for those are your choice now.
The variable, #answer#, could be the variable that is the answer.
Maybe, when you print a message saying the choices, you add another script that would copy the player's command to the variable, you put '#answer#' as that variable.
I hope this helps and is understandable.
As the variable, you could type '#answer#'.
Then, you add cases.
The first case, maybe, would be '1; Spare him some money'. So, if the answer variable is either 1 or Spare him some money, then it would run the same script.
Click OK. The script editor might pop up. If it doesn't, click the case you made earlier and click the 'Edit...' button beside the empty script box.
Now, you could pick some scripts. Maybe, you'd print a message saying, say, "You hand the man some cash.". The next script could reduce the amount of money the player currently has.
Click OK and add more cases, the second case could be '2; Ask him what he's using it for' and the third would be '3; Ignore him and be about your business'. The scripts for those are your choice now.
The variable, #answer#, could be the variable that is the answer.
Maybe, when you print a message saying the choices, you add another script that would copy the player's command to the variable, you put '#answer#' as that variable.
I hope this helps and is understandable.
Skypioneer
01 Jun 2011, 02:14Oh snap, I didn't even consider case statements. Well, I have just one more question.
After you choose '[2] Ask him what he's going to use it for' I plan to give another set of options to the player.
Firstly, I want the man to to give a response, and then perhaps point out something in the environment. I'm pretty sure I can do this with the print command, so that's not an issue.
For example,
(player inputs 2)
"Well yer see, I need this money to go out 'n git me some medication, it's mighty expensive."
The homeless man shuffles around uncomfortably, and you notice a few empty bottles of alcohol by his feet.
Will you
[1] Spare him some money
[2] Offer to buy him some alcohol
[3] Wish him well and move on
And after choosing 2, there would be another scene in which the homeless man joins you (I plan to do this by setting a flag or boolean variable, which is checked at various points in the game to see if you have him with you).
I really appreciate the help.
After you choose '[2] Ask him what he's going to use it for' I plan to give another set of options to the player.
Firstly, I want the man to to give a response, and then perhaps point out something in the environment. I'm pretty sure I can do this with the print command, so that's not an issue.
For example,
(player inputs 2)
"Well yer see, I need this money to go out 'n git me some medication, it's mighty expensive."
The homeless man shuffles around uncomfortably, and you notice a few empty bottles of alcohol by his feet.
Will you
[1] Spare him some money
[2] Offer to buy him some alcohol
[3] Wish him well and move on
And after choosing 2, there would be another scene in which the homeless man joins you (I plan to do this by setting a flag or boolean variable, which is checked at various points in the game to see if you have him with you).
I really appreciate the help.
RedTulip
01 Jun 2011, 05:37I don't really know what you mean...
Maybe the empty bottles are hidden, at first, but when the player sees them, they are visible?
The options can be, again, select case.
The first case could be the same as the one earlier, but the second and third would need changes.
If I said this wrongly, please tell
Maybe the empty bottles are hidden, at first, but when the player sees them, they are visible?
The options can be, again, select case.
The first case could be the same as the one earlier, but the second and third would need changes.
If I said this wrongly, please tell

Skypioneer
01 Jun 2011, 05:53Thank you for your quick response. No, I actually want that to be part of what is shown in print. Never mind it, it's not going to be an actual examinable object.
What I want is to be able to ask a different set of questions after the player has chosen an option. But I guess I could just put a case within case (inception!). lol.
By the way, I'm having a bit of difficulty with CASE statements. What I've done is this:
under commands, I've made a command called "choose #answer#" with no script.
Then, I've presented the case statement. For 'Select Case' I've put in #answer#.
For case, I've put '1; [1]'. But it doesn't run the script.
What am I doing wrong? Sorry for asking such basic questions.
What I want is to be able to ask a different set of questions after the player has chosen an option. But I guess I could just put a case within case (inception!). lol.
By the way, I'm having a bit of difficulty with CASE statements. What I've done is this:
under commands, I've made a command called "choose #answer#" with no script.
Then, I've presented the case statement. For 'Select Case' I've put in #answer#.
For case, I've put '1; [1]'. But it doesn't run the script.
What am I doing wrong? Sorry for asking such basic questions.
RedTulip
01 Jun 2011, 06:49The Select case script is supposed to be in the 'choose #answer#' command.
Skypioneer
01 Jun 2011, 09:30Red Tulip, should I be putting the Case script from the commands window? Because if that is so, then the player could just type in "choose 1/2/3" from wherever they are and get that response? Is there any way to limit it to a room? What if want to allow the player to have conversations with multiple characters?
Skypioneer
01 Jun 2011, 11:21Okay, I think I should better clarify what I'm trying to accomplish.
Think of an RPG in which you can talk to characters. That is what I am trying to achieve.
For simplicity's sake, let's use Fallout 3, since there are good chances you've played that. When you speak to characters, there are several options to choose from, and depending on what option you choose, the character responds differently and you can say something else.
That is what I am trying to achieve on a base level. My text adventure is a lot more action based as opposed to exploration based. For instance, the game is set in a steampunk setting and you are the captain of an airship. At one point, you encounter a dust storm in which you are given three options:
[1] Fly through it
[2] Fly around it
[3] Fly around with full speed engaged (costs fuel)
[4] Wait it out
...And depending on which option you take, events play out differently. Also, earlier in the game, you have the opportunity to buy equipment which can help you in these situations - I plan to have the game read the set flags to determine whether you have an item which would help you in any scenario.
So if you could help me, I would be really, really appreciative. I know it's much to ask, but if you could make a quick game where there are at least two of these situations, I would very much appreciate it so I can see what you've done.
Think of an RPG in which you can talk to characters. That is what I am trying to achieve.
For simplicity's sake, let's use Fallout 3, since there are good chances you've played that. When you speak to characters, there are several options to choose from, and depending on what option you choose, the character responds differently and you can say something else.
That is what I am trying to achieve on a base level. My text adventure is a lot more action based as opposed to exploration based. For instance, the game is set in a steampunk setting and you are the captain of an airship. At one point, you encounter a dust storm in which you are given three options:
[1] Fly through it
[2] Fly around it
[3] Fly around with full speed engaged (costs fuel)
[4] Wait it out
...And depending on which option you take, events play out differently. Also, earlier in the game, you have the opportunity to buy equipment which can help you in these situations - I plan to have the game read the set flags to determine whether you have an item which would help you in any scenario.
So if you could help me, I would be really, really appreciative. I know it's much to ask, but if you could make a quick game where there are at least two of these situations, I would very much appreciate it so I can see what you've done.
RedTulip
01 Jun 2011, 12:22Why not use menu's?
Instead of select cases, the player could select a choice from the menu.
Instead of select cases, the player could select a choice from the menu.
Skypioneer
01 Jun 2011, 12:25A menu? Sounds convenient, how do they work? Are they detailed in the tutorial? If so, which section? I thought I read all of it but I was half asleep when I did so I might have missed something... lol.
EDIT: I found it. I'm going to experiment with it, wish me luck, and thanks for the help
Watch this space though, I still might have an issue.
EDIT: I found it. I'm going to experiment with it, wish me luck, and thanks for the help

Watch this space though, I still might have an issue.
Skypioneer
01 Jun 2011, 13:28Woooo! It worked out just fine, I don't know why I didn't think of it earlier.
Thank you Red Tulip, I'll be sure to share my game with everyone when it's done.
Thank you Red Tulip, I'll be sure to share my game with everyone when it's done.
slackers_inc
01 Jun 2011, 18:39Using a menu system is what I did in "Revenge of the Shadow Masters". It took a bit of work, but it paid off in the end. Feel free to check it out by clicking the link. Also, I'll be sure to keep an eye out for your game! 

Skypioneer
02 Jun 2011, 06:52Cheers mate I'll post it as soon as I'm done with it! Unless you want a demo, then I could probably get one up within a day, lol.