SOLVED: Boolean to check if you have talked to another character

Started by barefoot, Sun 27/02/2011 09:16:50

Previous topic - Next topic

barefoot

Hi

I'm trying to put some script together that checks if you have spoken to another character.

A bool where you could check true of false...

I did do a bool some time ago with the help from khris... but i need it to refer to something else and can't seem to find the right way of putting it in. I know the basics.

The boolean checks if you (cwizard) have spoken to a character (cbjork) so that when you talk to another character (cbergthora) what you say is determined by wheather the boolean is true or false..

I will check out booleans more..

All help/support appreciated

barefoot


I May Not Be Perfect but I Have A Big Heart ..

ThreeOhFour

An easy way to do it:

Create a new boolean variable in the global variables pane called something like TalkedToBjork, set to false (although it doesn't matter really if you set it to false here)

When you click on cBjork with whatever mouse mode starts Bjork talking, have this somewhere in that function:

Code: ags
 TalkedToBjork = true;


Then when you run the conversation with cBergthora, in either the global script or dialog script (wherever you've set it up), you can reference it:

Code: ags

cBergthora.Say("Did you ask Bjork about the shovel?");
if (TalkedToBjork == true)
{
  cWizard.Say("Yes, I have. She says you can have it.");
  cBergthora.Say("Great! Help yourself to my squishy carrot.");
}
else
{
  cWizard.Say("No, not yet.");
  cBerthora.Say("You shan't have my squishy carrot then!");
}


Hope this helps.

monkey0506

If you understand the basics, as you say you do, then you understand that for a boolean value such as this that you would want an initial value of false, and then in whatever interaction script you have accomplished the required task, you would set the boolean to true.

In the interaction script where you need to check whether the required action has been accomplished, you would simply check the value of the boolean.

So, if you understand the basics, which means that you understand clearly how to accomplish all of the above, then this thread can be marked as solved, yes?

Edit: Good job getting that inb4cynicism Ben. :=

But seriously barefoot, if you can't even comprehend how to use a simple boolean variable like this, after, as you said, Khris has already shown you how to do this at least once, you might have bigger issues than simply whether or not the player has talked to a character. You seriously need to be able to solve problems like this yourself if you want to make a game with AGS. We don't mind helping you, of course, but we're not here to make your game for you, and you've already been told how to do this before.

barefoot

Hi

i appreciate both of your replies.. I just got a bit entangled that's all...  information overload and burnout...  I never need ask that question again... solved...

Thanks again
:=


barefoot
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk