Getting a dialog option to show up if...

Started by Raggit, Thu 09/12/2004 00:52:03

Previous topic - Next topic

Raggit

Okay, I've got a tid bit of trouble.Ã,  I'm using dialog options in my game.Ã,  The player needs to be able to tell character2 about something, only if he's asked character1 a certain question.Ã,  I've got a fair grasp on scripting dialogs and so on, but I can't tackle this one.

Here is a simplified example of what I want, in case the above makes little or no sense:

TOPIC1:

So, the ego asks character1:

Ã,  1".How are you?"

character1("I'm fine but...")

then the ego has the option to ask

Ã,  2."But what?"

character1("Well, my goldfish died. And I'm sad.")

okay, the second option, "but what" should enable to inform character2 about character1's gold fish, but ONLY if he actually clicked option 2.

Now, later in topic 2:

Ã,  1."Hello, character2."

character2: "Hi.Ã,  Whats new?"

Ã,  2."Character1's goldfish died. He's sad."

So how do I get option 2 in topic 2 to show up, once ego has spoken with char1, and once char 2 has asked what's new?  I gather from the manual that I'll need to use dialog_request in the main script or something, but this isn't all making sense.  Any help would be greatly cherished and I might even kiss you.

--- BARACK OBAMA '08 ---
www.barackobama.com

strazer

Yes, at the moment you would have to use the dialog_request function:

Code: ags

// dialog script file for topic 1
@1 // How are you?
char1: I'm fine but...
return
@2 // But what?
char1: Well, my goldfish died. And I'm sad.
run-script 77 // turn on dialog option 2 in topic 2
return
//...


Code: ags

// main global script

function dialog_request (int parameter) {
  if (parameter == 77) { // run-script 77 used from dialog script
    SetDialogOption(2, 2, 1); // turn on dialog option 2 in topic 2
  }
}


There's already a tracker entry to do this from the dialog script directly.

Raggit

It works alright, except there is one problem.  Option 2 in topic 2 should not show up until the ego clicks option 1 in topic 2.  After that, if he spoke with char1, option 2 will pop up.  If not, then nothing happens.

The way it works now, option 2 in topic 2 shows up from the start of the conversation.
--- BARACK OBAMA '08 ---
www.barackobama.com

Einoo

Well, you could try using counters, like the "character1 saying he has a dead goldfish" thing would add 1 to the counter, and the "clicking option 1 in dialog 2" thing would add 1 to the counter, and if the counter was equal to or greater than 2, Ã,  option 2 in dialog 2 would be activated. You'd have to use dialog_request to do it, though. Do you get what I mean?

strazer

#4
QuoteThe way it works now, option 2 in topic 2 shows up from the start of the conversation.

Remove topic 2 option 2's "Show" checkbox...

Edit:

Yeah, do as Einoo says or use GlobalInts:

Code: ags

// dialog script file for topic 1
@1 // How are you?
char1: I'm fine but...
return
@2 // But what?
char1: Well, my goldfish died. And I'm sad.
set-globalint 333 1
return
//...


Code: ags

// dialog script file for topic 2
@1 // Hello character2
char2: Hi.  Whats new?
run-script 77
return
@2 //Character1's goldfish died. He's sad.
char2: ...
return
//...


Code: ags

// main global script

function dialog_request (int parameter) {
  if (parameter == 77) { // run-script 77 used from dialog script
    if (GetGlobalInt(333)) { // if talked to char1
      SetDialogOption(2, 2, 1); // turn on dialog option 2 in topic 2
    }
  }
}

SMF spam blocked by CleanTalk