[SOLVED] After complete interrogation

Started by limeTree, Sat 27/12/2008 19:22:25

Previous topic - Next topic

limeTree

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.  ???

limeTree

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.

Trent R

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

limeTree

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)

SSH

Can you post the EXACT script, using cut-and-paste, becuase the code you put up is completely invalid.
12

limeTree

no,i deleted it,it was totally confusing,i mught write it again and then post it

Khris

#6
Just to prevent you from making the same mistakes again, it's supposed to be:

Code: ags
  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:
Code: ags
  if (DIALOGV && DIALOGV2 && DIALOGV3)


And btw: please don't report errors over in technical until you've mastered the basics of AGS scripting.

limeTree


monkey0506

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:

Code: ags
// GlobalScript.ash
import int DIALOGV;
import int DIALOGV2;


Code: ags
// 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.

limeTree

ok,thanks the == was tyoing mistake,the rest ill try now



limeTree

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

limeTree

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!!!!!!

monkey0506

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:

Code: ags
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:

Code: ags
  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. ;)

limeTree

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.

monkey0506

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... :=

SMF spam blocked by CleanTalk