Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Duckbutcher on Wed 15/03/2006 16:30:54

Title: NPC Give player objects after specific dialog (Solved)
Post by: Duckbutcher on Wed 15/03/2006 16:30:54
Hi, first post so don't annihilate me....

Just scripted my first conversation between my player and an NPC. This conversation has more than one outcome - after one outcome I'd like to give my player an item, but the other outcomes should leave them empty handed. I can't figure this at the moment, the only thing I can do is give the player the item no matter the outcome. can anyone help?

duckbutcher@hotmail.co.uk
Title: Re: NPC Give player objects after specific dialog
Post by: DoorKnobHandle on Wed 15/03/2006 16:39:21
Look up the "dialog_request" function in the manual that comes with AGS. You can add a line like this to the dialog script:


run-script 1


This will call the "dialog_request" function and pass a "1" as parameter. Now use this "dialog_request" function:


function dialog_request ( int parameter )
{
   if ( parameter == 1 )
   {
      // do what you want (ie. give the player an inv. item)
   }
}


Oh, and welcome to the forums.
Title: Re: NPC Give player objects after specific dialog
Post by: Ashen on Wed 15/03/2006 16:43:07
How have you tried doing it far?
As dhk said (as I was typing this) try using run-script and dialog_request (BFAQ Entry (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#Running_regular_code_inside_dialog) for more details) to give the item when you want to. An other way would be to use set-globaint in the dialog, and check it's value after the Dialog has been run.
Title: Re: NPC Give player objects after specific dialog
Post by: Duckbutcher on Fri 17/03/2006 13:27:06
Thanks guys, sorted it out.