Author Topic: run differents dialogs with the same character in differents moments  (Read 290 times)

Hi guys!
First of all, thank you for your ever helps.

I've a room (hall), where is a character called Picklear. When run a dialog between characters, in one option I get a key. With this key I can go to other room. Well, then pick up an object (a rose) and I have to turn back to the first room (hall again) and run a different dialog. The dialog number 2. How can I run the dialog n2 when I came back?

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
The most basic check, and actually the one you might be looking for, is whether the player has acquired the rose.

Code: Adventure Game Studio
  1.   if (player.hasInventory(iRose)) {
  2.     dPicklear1.Start();
  3.   }
  4.   else {
  5.     dPicklear2.Start();
  6.   }

Obviously, this means if the player loses the rose at any point, they're back to dialog one. There are other ways to track game states, most commonly people use global variables.

Thank you Khris.

Where can I read about the global variables? What is the method to do this action in GV? I think is more correct than losing the rose.

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Create the variable via the project tree node called "Global variables". Right-click the empty list and click on "Add new variable..."
Use name "playerGotRose", type "bool" and initial value "false".

When the player receives the rose, use
Code: Adventure Game Studio
  1.   playerGotRose = true;

In the talkto-Interaction, use
Code: Adventure Game Studio
  1.  if (playerGotRose) ...

Thank you very much, I'm goint to try in this moment!! :)

It's work fine!!! With all your help and a thousand readings and searches a day in the F1 manual I am able to move forward as I wanted. You do not know how much I really appreciate it. In not too long I will be able to present at least images and what the game is about :)

Just one more thing. Is it normal to use a lot of global variables? Is that thinking about the possibilities, I think I will use many to activate and deactivate game options as I go forward and I do not know if this would be the correct method.

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
It depends on what you're using them for. If there's no other way to store game state, then using a global variable is not just fine but the only solution anyway.
If you have variables that you only need in a specific room script you don't have to create a GV though; you can simply declare a variable at the top of your room script.