Question about Scripting for Dialogue.

Started by Vig, Tue 29/06/2004 13:04:26

Previous topic - Next topic

Vig

 I understand this might be a typical beginners question but i'm having major problems with it. :-[

Say my main character goes to Room 1 and talks to A. He goes through all the questions/dialog options for that particular room and is done with that set.

Now, the character goes to Room 2 and talks to B. B gives him a major clue and only A knows about it.
My question is, when the character goes back to Room 1, i want him to ask a new Topic to A. discarding the previous ones. How do i do that?

I understand this requires some scripting. But being a beginner, i'm having a hard time understanding the scripting language. I really need this information to finish my game.

Thanks.  :)

Barbarian

#1
You don't need to neccesarily do it through scripting, you could also use the AGS built-in editor and use it by setting variables.

Go to your character list, and select your character "A" for example, then click on the "Interaction" button, then add an action under the "Talk to character", and you can make it "Conditional - If a variable is set to a certain variable (Variable name, Variable Value)" then "Game - Run Dialog (Dialog number here you want to run)"

If hope that made sense? So basically you can set a variable, let say you make a "talk_to_a" variable, then when something happens you can set "talk_to_a" to a value of 1, 2, 3, 4, etc... Then accordingly, you can set the interaction of the "Talk to character" to have like Conditional if talk_to_a = 1, then run dialog 1, if =2 to, run dialog 2, etc.. something like thatÃ,  :P

PS: By default, newly created variables have a value of 0 (zero).
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Vig

 Ok, i have know tried GlobalInt to help activate my character's different sets of topic.

I think i hit a snag. Maybe my scripting is wrong.

Using the same scenario i posted above:

My character talks to A. I have set the required value to run the first set of dialogue. Ecerything works fine. :)

I go to room 2 and talk to B. Everything works fine too. For B's script i wrote:
if (GetGlobalInt(10)==0) {
RunDialog (5);
SetGlobalInt(11,1);
}

Now, the main character goes back to Room 1 and talks to A. In A's Interaction, i have specified a second Condition, which recognises the new GlobalInt setting value (11,1), and runs the new set of dialog.

Character B's second Condition is
-If variable is set to a certain value(11,1)
-Run Script
Ã,  if (GetGlobalInt(11)==1) {
Ã,  RunDialog (2);
Ã,  SetGlobalInt(13,1);Ã, 
Ã,  }

But, nothing happens. :(

Did i wrote something wrong or the path of action for the characters are mixed up.

What should i do? ???

Barbarian

#3
Post the complete script for the second part, maybe there's something that's being ignored or not being run for some reason? And I'm not sure, but maybe try using the SetGlobalInt command before using the RunDialog command in your scripts.Ã,  Probably someone else with more knowledge of scripting can give you some more advice, as I'm still getting the hang of all this scripting stuff too.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Vig

 The complete script for B's second command is the one i posted above. The script i wrote was:

if (GetGlobalInt(11)==1) {
RunDialog (2);
SetGlobalInt(13,1);Ã, 
}

I've even tried placing Set GlobalInt before Run Dialog but it doesn't work.

I know something is wrong in the script. Character B must recognise the new value to run the next script,

Is it possible to import A's SetGlobalInt to B so the character could recognise it? :-\



Ashen

#5
I think the problem is that the variables used in the interaction editor (Conditional - If variable is set to a certain value, Game - Set variable value) aren't the same as the GlobalInts. It looks like you're trying to use a combination of scripting and the interaction editor, and have gotten the two 'types' of variable confused. Use one or the other, e.g.:


Scripting Method:

Character A interaction:
Run Script:
Ã,  if (GetGlobalInt (10) == 0) {
Ã,  Ã,  RunDialog (1);
Ã,  }
Ã,  if (GetGlobalInt (10) > 0) {
Ã,  Ã,  RunDialog (2);
Ã,  Ã,  SetGlobalInt (10, 2);
Ã,  }

Character B interaction:
Run Script:
Ã,  if (GetGlobalInt (10) < 2) {
Ã,  Ã,  RunDialog (5);
    SetGlobalInt (10, 1);
Ã,  }
Ã,  if (GetGlobalInt (10) == 2) {
Ã,  Ã,  // whatever you want to happen
Ã,  }


Interaction Editor Method:

First, create a Global Variable called dialog.

Character A interaction:
Conditional - If variable is set to a certain value (dialog, 0)
Ã,  Game - Run dialog (1)
Ã,  Stop running more commands

Game - Run dialog (1)
Game - Set variable value (dialog, 2)

Character B interaction:
Conditional - If variable is set to a certain value (dialog, 2)
Ã,  (whatever you want to happen)
Ã,  Stop running more commands

Game - Run dialog (5)
Game - Set variable value (dialog, 2)


Hope this helps.
I know what you're thinking ... Don't think that.

Vig

Thanks guys! I have managed to basically complete my game!. ;D

But i actually have two final minor questions to ask, ;)

1) How do you change a characters view? Because i want the character to change his pose once he has spoken his line. Say as in Character B. Once he's done talking, how do i change his normal view?Because when i add a Change Character view action at the end of the interaction, it actually takes effect earlier than it should.
One moment, the character is lying on the floor, once he talks, he's back up, talking and once he's done talking. he's on the floor. And the action repeats itself untill the conversation is over.Ã,  ???

2)For some odd reason, whenever the dialog option appears at the bottom for the main character's conversation, an image of Roger appears beside the dialog option. Why?

That would be all. And thanks again guys. ;D

Goot

Check out SetCharacterView and SetCharacterViewEx in the manual. I think you have set your dialog bullet point to a roger picture. Go to the dialog and click set dialog bullet point. Then choose sprite 0, the blue teacup.

Vig

Thanks guys. I've finally completed my game! ;D ;D ;D

SMF spam blocked by CleanTalk