Hi!
I would like to know how to change character interaction options.
Example:
I talked to my character.When i click on him we talk about a certain topic.
But how can i change it so then when i interact with him later we talk about a different topic?
One word: variables.
If you want to change the behavior only once, there's Game.DoOnceOnly (http://www.adventuregamestudio.co.uk/manual/Game.DoOnceOnly.htm).
If you want more than two different reactions, you'll have to use a variable.
int guy_talk = 0; // define an integer variable called guy_talk, initial value 0
function cGuy_Talk() {
if (guy_talk == 0) {
// first conversation here
guy_talk = 1;
}
else if (guy_talk = 1) {
// second conversation
guy_talk = 2;
}
else {
// third conversation
}
}
i tryed,there are no bugs in the screen when i enter the game but it still doednt do the trick
I want the main character to talk to noah and the dialog opens(that works)
that the character to go and talk to Mary(all fine still)
but then to go bact to noah and talk about a different topic
but when i come back he still talks about the first dialog
this is what i wrote
//NOAH TALK*****************
function cNoah_Talk()
{int F = 0;
{if (F == 1)
{
dfather2.Start();
}
else {
dFather.Start();
}
}
}
//MARY TALK*****************
function cMary_Talk()
{
int F = 1;
dmary.Start();
}
You need to declare the variable outside the functions:
int F; // is 0 from the start
//NOAH TALK*****************
function cNoah_Talk() {
if (F == 1) dfather2.Start();
else dFather.Start();
}
//MARY TALK*****************
function cMary_Talk() {
F = 1;
dmary.Start();
}
Basically you're having a problem with scope. If you declare a variable outside of a function, it will be available by all functions. If it's declared inside, then it will only be available in that function.
~Trent
PS-Try indenting your code like Khris's, instead of having {//whatever is on your line
Oh yeah,so stupid of me,i was turning on the variable every time i talked to him!
thnaks guys,ill check it out tomorrow
today is CHRISTMAS!
MERRY CHRISTMAS ALL!!!!!
hey,checked it,it works!
can i use IF function wotjout ELSE?
because im gonna chnage dialogs manny times in the game so can i
use if like that with variables?
like: if F == 1
{DIALOG 1}
if F == 2
{DIALOG 2} ect.
And shall i use variables to erase the parts of topic i already talked about?thta confuses me
Yes, you can do:
if (F==1) dFather1.Start();
if (F==2) dFather2.Start();
if (F==3) dFather3.Start();
You can deactivate dialog option using the dialog commands:
Manual -> Tutorial -> Starting off -> Conversations
It's better coding to use 'else if' if you're check the same variable over and over (in this case, 'F'). And then you can use just plain 'else' for a catch-all everything else case.
~Trent
yeah,tryed,works great.
But what i meant is can i set variables during the dialogs?
lets say during the converation in one topic mary says something that will trigger a new topic when i talk to noah