[Solved]Other Dialog avaliable after an other has been run?

Started by Ali_cirox, Wed 14/10/2009 17:35:21

Previous topic - Next topic

Ali_cirox

I want to creat this situation:
You speak to Char. 1 after that to Char 2
and if you speak to Char. 1 at this time,after you already have spoken to Char. 2 there should run an other dialog as at the first time.
But I dont know how to do it!?

sorry wheater my english is bad
I try, but I´m German


NsMn

Use a boolean and change it's value to true if the player talks to one of the characters, and before talking to them, check whether bool is set to true.

Ali_cirox

much thanks for the quick answer NsMn.

But I don´t know that much of AGS, yet.
And I don´t know how to create a Boolean.
Could you discribe it to me?
or do you know a toturial? that would be brilliant

NsMn

Since you're german, I'd recommend one of the tutorials or the forum on Adventuretreff.de.

Ali_cirox

I´ve searched evry single toturial on Adventuretreff.de.
but nothing about boolean or bool
do you know an other site?
englisch would be no problem.
the Problem of toturials for AGS is that I dont find much on google.
I only found those on this site and on Adventuretreff.de.

Matti

A Boolean is just a certain kind of variable.

Code: ags

bool dialogchange;


creates a boolean called dialogchange.

Code: ags

dialogchange=true;
dialogchange=false;


will set it to true or false.

If you read through the AGS manual and do its tutorial, things like these should be perfectly clear.

Ali_cirox

Okay. I´ll watch the manual and this toturial once more
thank you Mr. Matti and NsMn

Helme

Damn... to slow. But my solution would have been more complicated ::)

Ali_cirox

Sry but i don´t find a solution in the toturials of ags and in the manual ,too.

And how do i use this codes
sry but i realy dont know

bool dialogchange;
dialogchange=true;
dialogchange=false;

could someone please post me an example?

Crimson Wizard

#9
Sample:

Code: ags

bool SpokenWithChar2Already; // initially it will be = false

// this function runs when you speak to Char1
function Char1_TalkTo()
{
   // here we check boolean variable's value
   if (SpokenWithChar2Already)   // means: if = true
   {
       dDialogChar1_2.Start();
   }
   else   // means: if = false
   {
       dDialogChar1_1.Start();
   }
}

// this function runs when you speak to Char2
function Char2_TalkTo()
{
   dDialogChar2.Start();
   SpokenWithChar2Already = true; // when you speak with char2 boolean variable becomes 'true'
}


For reference, in case you do not know, boolean type of variable is a logical type that stores simply TRUE or FALSE (that can be also thought as YES or NO, ON and OFF or 0 and 1 etc, whatever you like).

Ali_cirox

Now, I think,  I got it ;D

I thank you realy much
Crimson Wizrad
an all others for shure , too



Ali_cirox

i only have a problem with this part of code

SpokenWithChar2Already = true

what do I fill in for the "Char2" 
I already tried

cPlayer1
and dPlayer1
(is the script name is cPlayer1 and the dialog is dPlayer1)

but nothing worked


Crimson Wizard

#12
Quote from: Ali_cirox on Wed 14/10/2009 20:09:13
i only have a problem with this part of code

SpokenWithChar2Already = true

what do I fill in for the "Char2"  
I already tried

cPlayer1
and dPlayer1
(is the script name is cPlayer1 and the dialog is dPlayer1)

but nothing worked

There seem to be some kind of misunderstanding.
Variable name has no relation to character, dialog or any other names.
You could call it ABCDEF, MyVar, WhateverBooleanVariable etc, and so on.
I named it SpokenWithChar2Already. If you don't like this name, you can rename it as you like BUT you must make sure that it is named the same anywhere you use it.

For example, if you like it be called "SpokenWithPlayer1", then you should change it not only in that function, but also here:
Code: ags

bool SpokenWithChar2Already; 

to
Code: ags

bool SpokenWithPlayer1; 


and here:
Code: ags

   if (SpokenWithChar2Already)

to
Code: ags

   if (SpokenWithPlayer1)

Ali_cirox

Now all misunderstuds are removed
i finaly undestand how that works
the reason why in chrashed
was that I don´t knew that I have to create this bool in global scrip

Thanks for you troubles!

I dont know if I have to write this
im in this forum for a few hours
but myproblem is solved
and the treat can be closed

Khris

Just "Modify" your first post and put "[Solved]" at the beginning of the subject.

SMF spam blocked by CleanTalk