Giving Character an Item to trigger Dialog (SOLVED)

Started by Afrothunde6, Thu 19/02/2009 20:00:11

Previous topic - Next topic

Afrothunde6

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

Matti

1. character.AddInventory(item);

2. Either use the character.say command or start a dialog using Dialog.Start()

Afrothunde6

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")
}

Matti

#3
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..

Khris

This is all explained throughly in the manual.

Pumaman

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.

Trent R

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Afrothunde6

Yes Thank you very much I will scour again through the manual  :)

SMF spam blocked by CleanTalk