Wintermute Engine Forum
Wintermute Engine => Bug reports => Topic started by: Mac on November 28, 2010, 08:25:39 PM
-
Hi guys,
I actually have problems with the use of Game.AddResponseOnce(). Responses declared as "Once" appear to only display once a game. Here's an example of a piece the doesn't work:
function Dialog_Bibliothekar()
{
Game.StartDlgBranch("Dialog_Bibliothekar");
BibliothekarAufgewacht=true;
actor.Talk("Hallo!");
Bibliothekar.Talk("Hellas!");
// Start of response loop
var Select0;
var Loop0 = true;
while(Loop0)
{
if(QuizHalbzeit) Game.AddResponseOnce(0,"Haben sie ein Buch über Kriege und Schlachten?");
Game.AddResponse(1,"Einen schönen Tag noch.");
Select0 = Game.GetResponse();
if(Select0==0)
{
actor.Talk("Haben sie ein Buch über Kriege und Schlachten?");
Dialog_Bibliothekar_SchlachtenFragen();
}
if(Select0==1)
{
actor.Talk("Einen schönen Tag noch.");
Loop0 = false;
}
}
Game.EndDlgBranch("Dialog_Bibliothekar");
}
The variable QuizHalbzeit is true the whole time, but response 0 is only shown one time.
Any ideas someone?
Cheers
Mac
-
it should work. So you are saying, that upon next entry of this dialogue eg. Game.Msg(QuizHalbzeit); shows true and the option is not there?
-
I have had quite a lot of trouble with the Game.AddResponce one stuff.
One thing you might want to try is to close with
Game.EndDlgBranch();
without adding any value in the parentheses, I can't explain why but this works for me.
-
So you are saying, that upon next entry of this dialogue eg. Game.Msg(QuizHalbzeit); shows true and the option is not there?
Yes, that's right. It behaves like '.AddResponseOnceGame' in this script.
I have had quite a lot of trouble with the Game.AddResponce one stuff.
One thing you might want to try is to close with
Game.EndDlgBranch();
without adding any value in the parentheses, I can't explain why but this works for me.
I'll try it to see what happens.
-
I tried eborr's advice (and a few other things) but with no success. I've cut the script down a bit:
function Dialog_Bibliothekar()
{
Game.StartDlgBranch("Dialog_Bibliothekar");
BibliothekarAufgewacht=true;
actor.Talk("Hallo!");
Bibliothekar.Talk("Hellas!");
// Start of response loop
var Select0;
var Loop0 = true;
while(Loop0)
{
if(QuizHalbzeit) {
Game.Msg(QuizHalbzeit);
Game.AddResponseOnce(0,"Haben sie ein Buch über Kriege und Schlachten?");
}
Game.AddResponse(1,"Einen schönen Tag noch.");
Select0 = Game.GetResponse();
if(Select0==0)
{
actor.Talk("Haben sie ein Buch über Kriege und Schlachten?");
// Dialog_Bibliothekar_SchlachtenFragen();
}
if(Select0==1)
{
actor.Talk("Einen schönen Tag noch.");
Loop0 = false;
}
}
Game.EndDlgBranch();//Dialog_Bibliothekar");
}
I still doesn't work. The game log says 'yes' when entering the section but the option is still not shown.
-
This code should work. Please try renaming the DialogueBranch to something like "test1" to rule out naming conflict. Also try adding
Game.Msg(Game.GetCurrentDlgBranch());
before the branch is initialized, after the branch is initialized and after the EndDlgBranch() so you would rule out the bugs there.
I am using this method all the time, so I am pretty sure it works as my game is entirely based on this logic. As a sidenote, what WME version do you use?
-
Oh, thanks. I missed the GetCurrentDlgBranch method, I guess this would've helped me a lot to see what's going wrong. To the version thing: I used 1.9.1, but tried out 1.8.1 yesterday to see if it's a version problem, but both version work the same. I'll play a bit with the GetCurrentDlgBranch method and see what I can find out. Thanks.
-
Got it!
I just found out that the error only occurs if I enter another scene first. In that scene I had an automatic background dialog between two characters (you enter the scene while they are talking to each other). That function looked like this:
function Dialog_Wachen_Streitgespraech()
{
// Game.StartDlgBranch("Dialog_Wachen_Streitgespraech");
while(true) {
if(WachenStreiten) {
Tuerke.Talk("Bist du konkret Ochse vom Horn!");
} else break;
if(WachenStreiten) {
Grieche.Talk("Bitte was?");
} else break;
if(WachenStreiten) {
Tuerke.Talk("Äh, isch meine Horn vom Ochse!");
} else break;
if(WachenStreiten) {
Grieche.Talk("Du tickst doch nicht sauber! Was soll denn das sein?");
} else break;
.
.
.
} // while
// Game.EndDlgBranch("Dialog_Wachen_Streitgespraech");
}
As you can see I used a dialog branch for it too and that one caused the error, because when my main character left the scene, the script/function was destroyed, but the dialogue branch was still open. So now I erased the dialogue branching in this function and it works. You can say it was something like "dialogue branching overkill" ;D
I have to rework my dialogue editor tool to only add dialogue branches when they are needed (if a response box is involved). Right now it adds a dialogue branch for every function it creates, which seems to be dangerous.
Thanks for your help.
Cheers
Mac
-
pleased you found the source of your problem, as stated before I have battled with this in the past, the best way I have found to manage the challenge of not having "rougue" dialogue branches is to put all response box activities within function calls, then to have a StartDlgBranch/EndDilgBranch() pairing around the function call, this might seem clumsy to more accomplished coders, but I am a bear with a very little brain.