Special Encounter

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Special Encounter
Lifecrafter
Member # 4682
Profile #0
I gave my party a quest that is completed through going to another place in town and answering 'yes' to a special encounter(the quest doesn't give experience, it's just to advance the plot). When you answer yes, you are told by the special encounter to go to your house and go to sleep. If the party answers no, the special encounter is just go away. However, whenever the party activates the special encounter, no matter what it answers, it repeats the question and when the party answers again, the special encounter goes away.

beginstate 10;
reset_dialog ();
add_dialog_str (0, "text", 0);
add_dialog_str (1, "text", 1);
add_dialog_choice (0, "Yes");
add_dialog_choice (1, "No");
choice = run_dialog(0);
if (run_dialog(0) ==1) {
set_flag (0, 1, 1);
set_state_continue(11);
}
break;

beginstate 11;
reset_dialog ();
add_dialog_str (0, "text", 0);
break;


--------------------
Do not underestimate the power of the mechanical pencil.

Join the Dark side. We have cookies.

Played in:
Fiddler on the Roof
Bye Bye Birdie

"Hey, Patrick, feel this random pipe. It's squishy"-Nils
Posts: 834 | Registered: Thursday, July 8 2004 07:00
The Establishment
Member # 6
Profile #1
That is what I would indeed expect for your coding. The problem is that you can run_dialog(0) twice. In your conditional statement, use the variable choice instead of run_dialog. It should read:

beginstate 10;
reset_dialog();
add_dialog_str(0, "text", 0);
add_dialog_str (1, "text", 0);
add_dialog_choice (0, "Yes");
add_dialog_choice (1, "No");
choice = run_dialog(0);
if (choice ==1) {
set_flag (0, 1, 1);
set_state_continue(11);
}
break;

beginstate 11;
reset_dialog ();
add_dialog_str (0, "text", 0);
break;


--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Shaper
Member # 3442
Profile Homepage #2
beginstate 10;
reset_dialog();
add_dialog_str(0, "text", 0);
add_dialog_str (1, "text", 0);
add_dialog_choice (0, "Yes");
add_dialog_choice (1, "No");
choice = run_dialog(0);
if (choice ==1) {
set_flag (0, 1, 1);
set_state_continue(11);
}
break;

beginstate 11;
reset_dialog ();
add_dialog_str (0, "text", 0);
RUN_DIALOG(1);
break;
You forgot a line Stareye.

Edit: Apparently, you can't make coded text bold. Grr. I capitalised it instead.

[ Sunday, February 05, 2006 08:08: Message edited by: SupaNik ]

--------------------
And when you want to Live
How do you start?
Where do you go?
Who do you need to know?

Posts: 2864 | Registered: Monday, September 8 2003 07:00
Lifecrafter
Member # 4682
Profile #3
It works now. Is it possible to make the special encounter only show up again if you say no? If so, how? Thank you!

--------------------
Do not underestimate the power of the mechanical pencil.

Join the Dark side. We have cookies.

Played in:
Fiddler on the Roof
Bye Bye Birdie

"Hey, Patrick, feel this random pipe. It's squishy"-Nils
Posts: 834 | Registered: Thursday, July 8 2004 07:00
The Establishment
Member # 6
Profile #4
I didn't forget a line, I figured he just submitted incomplete code which I purposely did not complete. It would have fixed the error he was stating.

The answer to your question is yes. Put your dialogue script inside of an if-then statement to check to see if a flag is zero. If it is, call the dialogue. If "yes" is selected, set that flag to one. That way if the player picks "yes" you will never see it again (unless you set the flag back to zero somewhere of course).

[ Sunday, February 05, 2006 09:10: Message edited by: *i ]

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Councilor
Member # 6600
Profile Homepage #5
Use a SDF. If the SDF is set to one, have the special encounter end there. If it isn't, then the encounter continues to run. You already have the set_flag command if the party chooses yes. Just add a get_flag at the beginning and {} to enclose everything after else.

if (get_flag(0,1) == 1)
end();
else
{reset_dialog ();
add_dialog_str (0, "text", 0)
;add_dialog_str (1, "text", 1);
add_dialog_choice (0, "Yes");
add_dialog_choice (1, "No");
choice = run_dialog(0);
if (run_dialog(0) ==1)
{set_flag (0, 1, 1);
set_state_continue(11);}}
break;
beginstate 11;
reset_dialog ();
add_dialog_str (0, "text", 0);
break;
Dikiyoba thinks it should work but hasn't tested it.
Posts: 4346 | Registered: Friday, December 23 2005 08:00
Off With Their Heads
Member # 4045
Profile Homepage #6
More briefly:

beginstate 10;
if (get_flag(0,1) != 0)
end();

reset_dialog();
add_dialog_str(0, "text", 0);
add_dialog_str (1, "text", 0);
add_dialog_choice (0, "Yes");
add_dialog_choice (1, "No");
choice = run_dialog(0);
if (choice ==1) {
set_flag (0, 1, 1);
set_state_continue(11);
}
break;
This is described here, under One-Shot Specials.

[ Sunday, February 05, 2006 09:41: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00