Dialog Trigger Events

Started by AnimeKA, Fri 31/07/2015 04:20:35

Previous topic - Next topic

AnimeKA

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

@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?"

Joe

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.
Copinstar © Oficial Site

Dualnames

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);
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Grok

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

Code: ags
if(bAleMug==true)
AleMug.Visible = false;



That should work.

Dualnames

Aren't you missing something grok? :cheesy:
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Khris

Try this (change 0 to AleMug's ID):

Code: ags
@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.

SMF spam blocked by CleanTalk