Hi guys! My name is Marco and I write from Italy. I'm new here so, first of all, I have to congratulate you on the usefulness of this forum. Uh, also I have to apologize for my uncertain English.
Here is the question.
I'm programming an adventure, and I need -if possible- to make a dialog option appear only after an "event".
Practical example:
Dialog between Ego and Luke
Initial options:
1. What's your name?
2. What are you doing?
3. See you later.
Later, if Ego knows about a thing from another character (Vader), I would like to have as dialog options:
1. What's your name?
2. What are you doing?
3. It's true that Princess Leia is your sister?
4. See you later.
Now, I think that I have to set a flag on the dialog with Vader, using (for example) set-globalint 1 1, setting in this way the flag 1 to "open" (= Ego now knows about the relationship between Luke and Leia).
Question is: how I can use in the dialog between Ego and Luke this flag to make the new option appear?
The only thing I can imagine is to prepare two different dialogs, one with the new option and another without it, and code
if (GetGlobalInt(1) == 0) {
RunDialog (1);
}
else
{
RunDialog (2);
}Ã,Â
when you talk to Luke.
But, in this way, I would lose all the states of the option-off-forever command (for example, if I set in the script that player can ask only once "What s your name?" to Luke to avoid boring repetitions, in this way, when the variable switches the dialog to the second the "What s your name?" option would appear again!).Ã,Â
Is there another way to solve my problem?
Thanks a lot.
Marco
I'd set up a single dialog, but un-check the 'Show:' box for the options you don't want to appear right away (in your example, "Is it true Princess Leia is your sister?"). Then, from the other (Vader) dialog, call run-script x and dialog_request, to run a SetDialogOption() command to turn option 3 back on.
Basicly, you need to use run-script x in the dialog, and dialog_request and SetDialogOption(topic, option, state) in the global script.
I don't know if I explained that very well... This thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=18128.0) deals with a similar question, but explains in more detail.
I was writing this while Ashen replied:
Make the dialog with all 4 options. Option 3 is initally off (Uncheck "Show" checkbox in dialog pane).
Then, for example in the dialog with Vader (dialog 0):
// dialog script for dialog 0
//...
@8 // Do you know Leia?
vader: Leia is Luke's sister.
ego: I see...
run-script 12 // call dialog_request function and pass 12 as parameter
option-off-forever 8 // turn this dialog option off
return // show dialog options again
//...
Then, edit the dialog_request function in the global script:
// global script
function dialog_request(int parameter) {
if (parameter == 12) { // if function called via "run-script 12"
SetDialogOption(1, 3, 1); // unlock dialog 1's hidden dialog option 3
}
}
Then, in the dialog with Luke (dialog 1):
// dialog script for dialog 1
//...
@3 // Is it true that Princess Leia is your sister?
luke: NOOOOOOOOOOOO!
option-off-forever 3 // turn this dialog option off
return // show dialog options again
//...
:D
Thank you very much! With your help I did it!
Thanks again also for the quickness and the clearness of the answers!
Goodbye!
Mak