Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Afrothunde6 on Thu 19/02/2009 20:00:11

Title: Giving Character an Item to trigger Dialog (SOLVED)
Post by: Afrothunde6 on Thu 19/02/2009 20:00:11
I am quite new to AGS and have scoured the forums and the manual and don't know where to start on this topic to be honest. I would appreciate some help to give an item to a character so that  its starts a dialog driving the story along.

-Give item to character
-Character tells player what to do through Dialog

Thank you in advance
Title: Re: Giving Character an Item to trigger Dialog
Post by: Matti on Thu 19/02/2009 20:59:37
1. character.AddInventory(item);

2. Either use the character.say command or start a dialog using Dialog.Start()
Title: Re: Giving Character an Item to trigger Dialog
Post by: Afrothunde6 on Fri 20/02/2009 12:51:41
Thank you but now Im stuck with this
"GlobalScript.asc(545): Error (line 545): '[' expected"

Over this

function cMysteryMan1_UseInv()
{
character.AddInventory(iWaterCup);
character.Say("There is a passage through the mountains")
}
Title: Re: Giving Character an Item to trigger Dialog
Post by: Matti on Fri 20/02/2009 12:58:47
Well, you have to tell which character is supposed to do these things. If it is your main character, use cEgo.AddInventory and cEgo.Say.... if it's another one or you changd the scipt name of the main character then change the lines accordingly.

Regarding the error message:

A "[" is expected because you can also use character[ x].blabla, x being the number of the character..
Title: Re: Giving Character an Item to trigger Dialog
Post by: Khris on Fri 20/02/2009 13:29:11
This is all explained throughly in the manual.
Title: Re: Giving Character an Item to trigger Dialog
Post by: Pumaman on Fri 20/02/2009 18:17:03
I think what you want is this:

function cMysteryMan1_UseInv()
{
  if (player.ActiveInventory == iWaterCup)
  {
     cMysteryMan1.Say("There is a passage through the mountains");
  }
}

ie. if the player uses the Water Cup on the other character, then he says the text.
Title: Re: Giving Character an Item to trigger Dialog
Post by: Trent R on Fri 20/02/2009 18:18:29
Quote from: Mr Matti on Fri 20/02/2009 12:58:47
Regarding the error message:

A "[" is expected because you can also use character[ x].blabla, x being the number of the character..
However, this is outdated. You should just use the script name for the character.


~Trent
Title: Re: Giving Character an Item to trigger Dialog
Post by: Afrothunde6 on Sat 21/02/2009 09:53:35
Yes Thank you very much I will scour again through the manual  :)