Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: viktor on Sat 03/07/2004 17:40:05

Title: some variables problems
Post by: viktor on Sat 03/07/2004 17:40:05
Ok i have a little problem with variables again.
First you repair a car. The wariable is set to wan, 4. Then you go and get a person.  He leaves to the car and the variable is set to dialog3, 1. Then you have to go get a nother person. The veriable is set to dialog 1, 1.  And I wan't something to hapene when all these 3 things are acomplished. But I'm having a little trouble with it. I took a quick course in variables in the interactions editor (a friend showd me, but the friend went on holyday yesterday so he can't help me).
All the other interactions work perfect. I'm only stuck with the one where both persons have to be in the car and the two global variables are turned on (dialog 1, 1 and dialog3, 1)
This is how the thing looks like:
http://www.2dadventure.com/ags/untitled1.png
Title: Re: some variables problems
Post by: Ashen on Sat 03/07/2004 18:23:24
It's probably be easiest to create another variable to track whether they're both in the car.

Create a new variable called GotBoth

Conditional - If variable is set to a certain value (dialog3, 1)
   Run script (whatever you've already got)
   Conditional - If variable is set to a certain value (dialog 1, 1)
      Game - Set variable value (GotBoth, 1)

Conditional - If variable is set to a certain value (dialog 1, 1)
   Run script (whatever you've already got)
   Conditional - If variable is set to a certain value (dialog3, 1)
      Game - Set variable value (GotBoth, 1)

Conditional - If variable is set to a certain value (GotBoth, 1)
   Run script (Or whatever you want to happen next)

And delete this bit:
Conditional - If variable is set to a certain value (dialog3, 1)
   Conditional - If variable is set to a certain value (dialog 1, 1)
      Run script

Hope this helps.
Title: Re: some variables problems
Post by: viktor on Sat 03/07/2004 18:56:49
that won't be any good. The script after the conditional is a response on how many people arein the wan. If conditional is set to dialog1, 1 and you interact with thewan you will get a mesage that you can't go becouse one is missing. If I use the variables you provided the player will first say that one of the both is missing. And then if you interact with it again will it say that everyone is in there.
Title: Re: some variables problems
Post by: Ashen on Sat 03/07/2004 19:32:21
Ok, misunderstood the question a little. Try this way:

Conditional - If variable is set to a certain value (dialog3, 1)
    Conditional - If variable is set to a certain value (dialog 1, 1)
        Run script (both in van)
        Stop running more commands
    Run script (one is missing)

Conditional - If variable is set to a certain value (dialog 1, 1)
    Conditional - If variable is set to a certain value (dialog3, 1)
        Run script (both in van)
        Stop running more commands
    Run script (one is missing)
Title: Re: some variables problems
Post by: viktor on Sat 03/07/2004 20:20:16
That dosn't work. I tried that and when there is only one in the wan no message pops up at all. When they are both in the wan the message that one is still missing pops up. Something tels me that something isn't right here.

this is how everithing looks now:
(http://www.2dadventure.com/ags/untitled2.png)
and yes I am shure that the script contained the corect message. I checked about 5 times.
Title: Re: some variables problems
Post by: Scorpiorus on Sun 04/07/2004 19:14:08
Make sure that dialog1 and dialog3 variables are actually set to 1 as an appropriate NPC got into the van. It seems to me that one of them isn't set to 1.
Title: Re: some variables problems
Post by: Ashen on Sun 04/07/2004 19:26:03
Also, looking at it again, I think it should be:

Conditional - If variable is set to a certain value (dialog3, 1)
    Conditional - If variable is set to a certain value (dialog 1, 1)
        Run script (both in van)
        Stop running more commands
    Run script (one is missing)

Conditional - If variable is set to a certain value (dialog 1, 1)
    Run script (one is missing)

I don't know if that's what stopped it working, but the second 'Conditional - If variable is set to a certain value (dialog3, 1)' isn't really needed.
Title: Re: some variables problems
Post by: viktor on Sun 04/07/2004 19:28:17
cool. Now I've got the thing working thanks to you  guys. The problem was that the wariable was actualy set to dialog and not dialog 1.  Thanks again Ashen.