Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - timebandit

#1
Quote from: emabolo on Wed 20/01/2021 18:29:07

I know that people more expert than me will disagree, but this is why I prefer to use the custom properties of the objects. In my case I have defined a new boolean property called "hasBeenExamined" and it applies to all objects. This way I can do something like:

Code: ags

if (oNotebook.GetProperty("hasBeenExamined")) {
   dDialog1.Start();
}
else {
   cCharacter.Say("Can't talk right now");
}


Could you write a step-by-step guide of what you do when creating the variable "hasBeenExamined" and making it work? Like, first you click "create global variable" or what it now says on the sidebar. What do you do after that?
#2
But how do I tell AGS that the variable "has_looked_at_object" is supposed to relate to the player looking at the object? How do I define what the variable actually relates to?
#3
Thanks to both of you. I haven't really understood how I create and define a global variable yet so I guess I'll have to understand that before I can proceed with your solutions.
#4
I want to make it so that cPlayer has to have had looked at an object, oHouse, before dKing2 happens.

I know what I would write if dKing2 was enabled by a dialogue option from another dialogue:
Code: ags

Function cKing_Interact
{
if (dTroll.HasOptionBeenChosen(1))
{dKing2.Start();
}
else {dKing1.Start();}
}


So for necessary dialogues, I would need
"dTroll.HasOptionBeenChosen(number)".

And for necessary inventory items, I would need
"Player.HasInventory(iFootball)".

But what do I need to write if I want dKing2 to happen after cPlayer has looked at an object?

I haven't been able to find the answer in the manual, unlike the other two "conditions" I've mentioned here.

I searched the forums and found someone writing "(UsedAction (A_LOOK_AT))" but it didn't work for me and it was only written once on this forum.
#5
Okay, I believe I have fixed it now thanks to your help.

Let me first say that I made a typo in my original post, I meant to write "dSnake2", not just "dSnake".

Like you have already said, my mistake was that I wrote most of it in the wrong order. I was wrong to assume that the problem was because of something specifically related to dWoman1.

So I guess that means that, if you want any amount of potential dialogue, whether it is 2, 3 or higher, you have to put the "ultimate" dialogue first. A potential dialogue has to be younger than the dialogue below it, and older than the dialogue above it. So the fix to my problem is simply this:

Code: ags

function cMan_Interact()
    else if (dSnake2.HasOptionBeenChosen(2))
    {
      dMan4.Start();
    }
    else if (dSnake1.HasOptionBeenChosen(1))
  {
    dMan3.Start();
    }
{
  if (dWoman1.HasOptionBeenChosen(3))
  {dMan2.Start();}
    else {dMan.Start();}}


Thanks to both of you for your help!
#6
I have bumped into a problem with enabling different dialogues depending on what the player has done before.

What I've written looks something like this:

Code: ags

function cMan_Interact()
{
  if (dWoman1.HasOptionBeenChosen(3))
  {
  dMan2.Start();
  }
    else if (dSnake1.HasOptionBeenChosen(1))
  {
    dMan3.Start();
    }
    else if (dSnake.HasOptionBeenChosen(2))
    {
      dMan4.Start();
    }
    else {dMan.Start();}
}


This script works well for having cMan change from dMan1 to dMan2 if the player has talked to cWoman.

However, while I can run the game without any error notification, the player is unable to get the dMan3 dialogue, which is the dialogue that I want to have activated after dSnake1.

I assume that the problem is that the script "thinks" something like this:

"The player has had dWoman1, therefore dMan2 will forever be the dialogue that the player has with cMan."

How do I change my script so that dSnake1 will enable dMan3 and disable dMan2?
SMF spam blocked by CleanTalk