if a char has spoken to another char then do this...

Started by barefoot, Wed 29/12/2010 11:53:10

Previous topic - Next topic

barefoot

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
I May Not Be Perfect but I Have A Big Heart ..

Mouth for war

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 :)
mass genocide is the most exhausting activity one can engage in, next to soccer

barefoot

I May Not Be Perfect but I Have A Big Heart ..

Sslaxx

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

Code: ags

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");
 }
}
Stuart "Sslaxx" Moore.

Khris

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.

Tamanegi

Also remember that using "if (DoOnceOnly("blah")==false)" still uses up the DoOnceOnly, so any further uses will result in "false".
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Khris

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.

Tamanegi

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" ;-)
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

SMF spam blocked by CleanTalk