run differents dialogs with the same character in differents moments

Started by croquetasesina, Thu 28/02/2019 08:13:24

Previous topic - Next topic

croquetasesina

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

The most basic check, and actually the one you might be looking for, is whether the player has acquired the rose.

Code: ags
  if (player.hasInventory(iRose)) {
    dPicklear1.Start();
  }
  else {
    dPicklear2.Start();
  }


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.

croquetasesina

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

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: ags
  playerGotRose = true;


In the talkto-Interaction, use
Code: ags
 if (playerGotRose) ... 

croquetasesina


croquetasesina

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 :)

croquetasesina

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

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.

SMF spam blocked by CleanTalk