Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: limeTree on Sat 27/12/2008 19:22:25

Title: [SOLVED] After complete interrogation
Post by: limeTree on Sat 27/12/2008 19:22:25
Hi,it's boring me again.But everyone before were so helpful and i don't wanna breka my head with this anymore.

Does anyone know how to make a character do something,or say something new when i ckick on him,never mind
after i have interrogated everyone totaly
i have 5 people,i have dialog with each of them
i would like that the options for that person change only if the player had gone through whole dialogs with every person.  ???
Title: Re: After complete interrogation
Post by: limeTree on Sat 27/12/2008 22:32:54
couse it really gets on my nerves,im totally stuck

i really need the game to continue after all of them have been totally questioned.

i tryed using variables after each option but it gets compplicated
with IF command and dialog script still has problems coz its not recognizing global variables.
Title: Re: After complete interrogation
Post by: Trent R on Sun 28/12/2008 02:03:08
Well, you do need to use variables, so you're on the right track.

If you showed us some scripts that you've written, then it'd be easier to help you.


~Trent
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 15:39:56
wel,i thought the only way to do it was using a lot of variables
so i wrote(this is a structure example)

outside of everything:

int DIALOGV = 0;
int DIALOGV2 = 0; ect.

then in the dialogs i would add after each option;

DIALOG

mary: somethin,something,somethnig...
1@
mary: bla bla bla
harry:  bla bla
DIALOGV = 1;
option-off1
1@
mary: bal ba
harry: bla bla
DIALOGV = 1;
option-off2      etc.

i would put that after each option in each dialog for every person.

and,here come 2 problems!,
in the section intercat john_talk()

(i thought this would work.)(i was wrong);
if DIALOGV = 1;
if DIALOGV2 = 1;
if DIALOGV3 = 1; etc....
{cjon.say("Munckins,theyl get you!");}

else
cjohn.say("LA LA LA!");

1. when i decide to run the game it says that dialogV is undefined!

when i try the same thing with the old way,using SETGLOBALINT and GETGLOBALINT
there are no bugs so i guess there is a problem with global variables in dialogs

2.when i used setgloabal int ec. i realised its just not possible for it to do what i want
i wish for my character to say a certain sentence all the time until all of the people have been questioned(all variables set to 1 or in workng case setglobalint);
then after i question them i want him to schange the sentence

this is important for me because i want the player to know all the facts before continuing the game story

(Note that i a making a game that is problably gonna take place just in 1 room,currenty thats the plan) (Hoping to finish it soon)
Title: Re: After complete interrogation
Post by: SSH on Sun 28/12/2008 15:58:06
Can you post the EXACT script, using cut-and-paste, becuase the code you put up is completely invalid.
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 16:10:48
no,i deleted it,it was totally confusing,i mught write it again and then post it
Title: Re: After complete interrogation
Post by: Khris on Sun 28/12/2008 16:22:02
Just to prevent you from making the same mistakes again, it's supposed to be:

  if (DIALOGV = 1 && DIALOGV2 = 1 && DIALOGV3 = 1) {
    cjon.say("Munckins, they'll get you!");
  }


The && being the operator for the logical AND.

Since you're testing for the variables being not zero, you can shorten this to:
  if (DIALOGV && DIALOGV2 && DIALOGV3)

And btw: please don't report errors over in technical until you've mastered the basics of AGS scripting.
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 16:28:04
ok,thanks,soryy   :-\
Title: Re: After complete interrogation
Post by: monkey0506 on Sun 28/12/2008 16:47:24
Also for testing equality it's the == operator not the = assignment operator... :=

One further problem I noticed is that if you're declaring the variables in your global script, then you would also need to export/import them:

// GlobalScript.ash
import int DIALOGV;
import int DIALOGV2;


// GlobalScript.asc
int DIALOGV; // int automatically initializes to 0
int DIALOGV2;
export DIALOGV;
export DIALOGV2;


An easier option to do this would be to simply use the Global Variables pane in the editor to create the variables instead of creating them from the script.
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 16:57:51
ok,thanks the == was tyoing mistake,the rest ill try now


Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 17:04:16
Yep! I was fighting with that,now the variable in dialog works
thanks MONEY_05_06
now ill write and try the rest of the code
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 17:30:47
IT WORKED!!!!!!!


I created the variables in global variable pane,the each variable changed to 1 after each option.
In global script i put:

function cJerry_Talk()
{
if (DIALOGVB1 == 1 && DIALOGVB2 == 1 && DIALOGVB3 == 1 && DIALOGVB4 == 1 && DIALOGVB5 == 1)
   {cJerry.Say("I know what we have to do!");}
else
{cJames.FaceCharacter(cJerry);
cJerry.FaceCharacter(cJames);
cJerry.Say("I need to get out of here!");
cJames.Say("There is nothing you can do.");
cJames.Say("The best option would be to wait until someone comes.");
cJames.Say("Any bigger ruckuss might just bring the whole thing down.");
Wait(40);
cJerry.Say("Yeah,I'm aware of that.");
Wait(20);
cJames.Say("What is your name?");
cJerry.Say("J..Jerry.I'm Jerry.");
cJerry.FaceLocation(338, 158, eBlock);
}
}



If i want to do it for all the characters its just gonna take more variables!
THANK YOU ALL!!!!!!
Title: Re: After complete interrogation
Post by: monkey0506 on Sun 28/12/2008 18:27:57
Actually, I was just looking back, and you're turning each option off after it's said anyway. In that case you could just use the option state instead of having to use umpteen variables:

function cJerry_Talk() {
  bool saidOption[5];
  int i = 0;
  while (i < 5) {
    i = (dDialog.GetOptionState(i + 1) == eOptionOff);
    i++;
  }
  if (saidOption[0] && saidOption[1] && saidOption[2] && saidOption[3] && saidOption[4]) {
    cJerry.Say("I know what we have to do!");
  }
  else {
    // ...
  }
}


I copied the states over into an array first to simplify the conditional statement. Though you could do:

  if (dDialog.GetOptionState(1) == eOptionOff && dDialog.GetOptionState(2) == eOptionOff &&
      dDialog.GetOptionState(3) == eOptionOff && dDialog.GetOptionState(4) == eOptionOff && dDialog.GetOptionState(5) == eOptionOff) {


P.S. You can use the "Modify" link on each of your posts to edit them instead of double- and triple-posting which is against the forum rules. ;)
Title: Re: After complete interrogation
Post by: limeTree on Sun 28/12/2008 18:37:25
oh,i get it! Thank you!

Sorry for being a pain in the ass but it's my first game and all.
I hope i'll finish it this week actually.
Title: Re: After complete interrogation
Post by: monkey0506 on Sun 28/12/2008 18:52:59
You're not being a pain...you're learning. The important part is that you're trying. Oh, and...

Quote from: lipaoklipa on Sun 28/12/2008 17:04:16thanks MONEY_05_06

...you're welcome BTW... :=