Stopping an opening dialog from playing when clicking 'previous'

Started by LinkMaestro, Tue 27/05/2008 23:16:40

Previous topic - Next topic

LinkMaestro

If you write dialog to play when you click the 'talk' icon onto a character, but don't wish it to play if they select 'previous' from a branching dialog, how do you keep your opening dialog from showing?

Example:  The player clicks on the merchant and the following dialog plays.

" Hey, c'mere."
" What do you want?"
" You look like you could use a little scrap."

Now, the second option takes him to dWares. The third option of dWares is 'previous' which brings him back to the first menu But how do you keep this opening dialog from playing when he clicks 'previous'?

Khris

Instead of putting the lines in the dialog script, use:

Code: ags
  cMerchant.Say("Hey, c'mere.");
  player.Say("What do you want?");
  cMerchant.Say("You look like you could use a little scrap.");
  dMerchant1.Start();


Then, at the start of the dialog script, use:
Code: ags
@S
return
@1
...


Neeext! ;)

LinkMaestro

// Dialog script file
  cMerchant.Say("Hey, c'mere.");
  player.Say("What do you want?");
  cMerchant.Say("You look like you could use a little scrap.");
  dMerchant1.Start();
@S  // Dialog startup entry point
return
@1
cMerchant: " Th'names Gorgenji. I gather a bit of scrap here and there to pawn off to anyone 'o has th'creds."
return
@2
cMerchant: " Have a look-see."
goto-dialog dWares
return
@3
cMerchant: " Anytime you need somethin', be sure to find me."
stop

So I tried this and it said 'uknown command. 'cmerchant' '

suggestion?

.M.M.

Yes. You must import this part of script before the dialog will start.
Code: ags
function Merchant_Talk_To()
{
  cMerchant.Say("Hey, c'mere.");   // this 3 lines will  run before the start of the dialog
  player.Say("What do you want?");
  cMerchant.Say("You look like you could use a little scrap.");
  dMerchant1.Start(); // and now, the dialog starts so it won´t display first lines again
} 


Khris

Yes. To quote myself:
"Instead of putting the lines in the dialog script, [...]"

Plus, I have no idea what your actual script names of the merchant character and the first merchant dialog are.
"cMerchant" and "dMerchant1" was just used to illustrate my solution.

LinkMaestro

Hmm.  cMerchant is the name of the character, and cEgo is the player.  I did as you suggested:

Quote
  // cMerchant.Say("Hey, c'mere.");
   cEgo.Say("What do you want?");
   cMerchant.Say("You look like you could use a little scrap.");
   dMerchant.Start();

// Dialog script file
@S
// Dialog startup entry point
return
@1
cMerchant: " Th'names Gorgenji. I gather a bit of scrap here and there to pawn off to anyone 'o has th'creds."
return
@2
cMerchant: " Have a look-see."
goto-dialog dWares
return
@3
cMerchant: " Anytime you need somethin', be sure to find me."
stop

and then tried:
Quote
  // cMerchant.Say("Hey, c'mere.");
  // cEgo.Say("What do you want?");
  //cMerchant.Say("You look like you could use a little scrap.");
  //dMerchant.Start();

// Dialog script file
@S
// Dialog startup entry point
return
@1
cMerchant: " Th'names Gorgenji. I gather a bit of scrap here and there to pawn off to anyone 'o has th'creds."
return
@2
cMerchant: " Have a look-see."
goto-dialog dWares
return
@3
cMerchant: " Anytime you need somethin', be sure to find me."
stop

Neither of which work. The first time it tells me that cEgo is an unknown command and the second time it runs, but the opening dialog doesn't play, it simply goes straight to the dialog tree.  The characters names are cMerchant and cEgo. Sorry if i'm not grasping a simple concept, but this is really confusing me. ???

LinkMaestro

Would it be easier to just set up a dialog that contains that intro, then have it go to a seperate dialog? Almost like doing a cutscene then just having it ignore that cutscene every other time he goes to talk to the merchant?

Khris

You are still trying to run the lines I provided as part of the dialog script, although I've told you twice already not to do that!

In the main tree, select the Merchant character, then click the lightning bolt icon. Select "talk to this character" and click the ...-button.
This should take you to the global script, to a function looking similar to the one Mirek posted.
In there should be a single command, the one you're using to run the dialog, correct?
Now put the .Say lines into that function, right before the dWhatever.Start(); command.

Now the player won't even notice that these lines aren't part of the actual dialog, but thanks to that, they will only run once (per click on the merchant).

SMF spam blocked by CleanTalk