Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: myname on Fri 08/12/2006 00:32:24

Title: gaining inventory item based on dialogue option chosen- question (solved)
Post by: myname on Fri 08/12/2006 00:32:24
I am having trouble scipting dialogue so that my player character recieves an item/object and that item leaves the room only when the player character chooses a specific option in the dialogue.Ã,  As of right now the player gets the object and it leaves the room as soon as the dialogue begins.Ã,  If anyone could help me that would be great.Ã,  Thankyou.
Title: Re: gaining inventory item based on dialogue option chosen- question
Post by: Khris on Fri 08/12/2006 01:46:05
Do a forum/manual search for "run-script X" and "dialog_request".

The dialog command "add-inv X" might be all you need, though.
Title: Re: gaining inventory item based on dialogue option chosen- question
Post by: myname on Fri 08/12/2006 04:08:19
Thanks for the help but I tried using the dialogue-request global script but I recieved the same problem with the player recieveing the item as soon as the dialogue starts instead of after choosing option 2.
This is what I put for the global script:
function dialog_request (int a) {
  if (a==1) {//cSteve.AddInventory (irestorder);
  }
}
and this is what I put in the dialogue script
@2  // option 2
"blah blah blah"
//run-script a;
@3  // option 3
NANCY: "...lovely."
stop
Title: Re: gaining inventory item based on dialogue option chosen- question
Post by: Khris on Fri 08/12/2006 07:22:33
Here's how it should work:
function dialog_request (int a) {
  if (a==1) {
    cSteve.AddInventory (iRestorder);
  }
}

@2  // option 2
"blah blah blah"
run-script 1      // 1 instead of a, NO semi-colon
return          // return to dialog choice

@3  // option 3
NANCY: "...lovely."
stop

Don't forget to "return" after each choice, otherwise the script will just continue running through every option.
Title: Re: gaining inventory item based on dialogue option chosen- question
Post by: myname on Fri 08/12/2006 21:02:32
Thanks a lot KhrisMUC.  That worked perfectly.