Hi
I was wondering if there is a function for if a char has spoken to another char then do this or if not do this etc
IE when char is on a region it checks if he has spoken to another char in same room.
Cheers
barefoot
couldn't you use a variable for that?
like
//At the top of the script
int talk=0;
and when the character has talked to another character change talk to 1
and when the the character is on a region...
function region1_WalksOnto()
{
if (talk ==0){
dcharacter.Start(); //or whatever the name of your dialog is
}
else if (talk ==1){
Display ("I've already talked to him");}
}
don't know if that's what you're after but hopefully it's something like that you're searching for :)
Hi
Good old Int...
cheers
barefoot
Quote from: Mouth for war on Wed 29/12/2010 12:06:55
couldn't you use a variable for that?
like
//At the top of the script
int talk=0;
and when the character has talked to another character change talk to 1
and when the the character is on a region...
function region1_WalksOnto()
{
if (talk ==0){
dcharacter.Start(); //or whatever the name of your dialog is
}
else if (talk ==1){
Display ("I've already talked to him");}
}
don't know if that's what you're after but hopefully it's something like that you're searching for :)
I'm wondering if you could do that with DoOnceOnly. http://www.adventuregamestudio.co.uk/manual/Game.DoOnceOnly.htm
function region1_WalksOnto()
{
if (Game.DoOnceOnly ("Talking to a guy here"))
{
dcharacter.Start(); //or whatever the name of your dialog is
} else
{
Display ("I've already talked to him");
}
}
That depends. If the region is supposed to trigger the dialog (suggested by Mouth for war, not barefoot), but only the first time, then yes.
If the player walks into a light barrier that is deactivated by talking to a guard first, then no.
In other words, mentioning Game.DoOnceOnly is a good thing since it is sufficient for many situations where we had to use a variable before, but spreading the word about the proper use of variables is much more important.
Also remember that using "if (DoOnceOnly("blah")==false)" still uses up the DoOnceOnly, so any further uses will result in "false".
True, but the whole condition will be false the first time, then true.
As long as you don't check DoOnceOnly with the same string twice or even more, you're fine.
To prevent any misunderstandings:
DoOnceOnly("blah") is true the first time, so the statement "if (DoOnceOnly("blah")==false)" is false. After that, it's false, so "==false" will become true.
Basically, it's a oneshot thing.
I was a little confused at first... it should really be named "IsTrueOnceOnly" ;-)