Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AnimeKA on Fri 31/07/2015 04:20:35

Title: Dialog Trigger Events
Post by: AnimeKA on Fri 31/07/2015 04:20:35
I just restarted using AGS and I need some basic help regarding conversation events scripts.

1. Adding items into inventory via conversation dialog. I tried using the dialog box but it can't recognize the item. Cause this is included in a conversation with a person which is why I don't want to use Display(). And I need the item to disappear once the option is selected.
Code (ags) Select

@2
Ego: "Its an empty ale mug, just what I need at the moment"
{
   player.Walk(260, 300, eBlock);
   AleMug.Visible = false;
   player.AddInventory(iAleMug)
}


2. Opening inventory using dialog, once exit inventory dialog resumes. Something like "dialog: Why don't you check ur inventory?" "inventory opens" "click exit" "dialog: you see?"
Title: Re: Dialog Trigger Events
Post by: Joe on Fri 31/07/2015 08:58:22
The dialog script should recognize the inventory item, since they are global variables. In your code you are missing a semicolon at the end of the 6th line, and I think those braces are unnecesary.
Title: Re: Dialog Trigger Events
Post by: Dualnames on Fri 31/07/2015 09:01:46
I'm baffled honestly i've been reading what you wrote a couple of times, and I can't make any sense. At least in first, the } and { need to be removed. And this: player.AddInventory(iAleMug) needs to be player.AddInventory(iAleMug);
Title: Re: Dialog Trigger Events
Post by: Grok on Fri 31/07/2015 19:17:31
I am assuming that AleMug is an object in your room that you want to go invisible when the player picks up the inventory item, and that that is the part that doesn't work.

If so, you could do it this way.

Get a global variable. It could be bool bAleMug and you initially set it to false.

In the dialog you substitute the "AleMug.Visible = false;" line with "bAleMug=true;"

In the room script you set under the repeat function

if(bAleMug==true)
AleMug.Visible = false;



That should work.
Title: Re: Dialog Trigger Events
Post by: Dualnames on Fri 31/07/2015 20:15:08
Aren't you missing something grok? :cheesy:
Title: Re: Dialog Trigger Events
Post by: Khris on Mon 03/08/2015 01:27:03
Try this (change 0 to AleMug's ID):

Code (ags) Select
@2
Ego: "Its an empty ale mug, just what I need at the moment"
  player.Walk(260, 300, eBlock);
  object[0].Visible = false;
  player.AddInventory(iAleMug);


The second is a bit more complicated; you could simply try and call "gInventory.Visible = true;" to display it but it depends on how your game is setup / what template you're using, etc.