Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ty3194 on Sat 25/10/2008 04:29:42

Title: Free items from one charecter to another. (SOLVED)
Post by: ty3194 on Sat 25/10/2008 04:29:42
I have a merchant with a drink, and i want to give the drink for free to my main character. when the player clicks the option text "What type of drink is it" in the dialogue dWares, the merchant says "It is a very tasty beverage, have a sample!" and at that point i want to add the drink to the players inventory. This is what i have in my globalscript.asc:

function dialog_request;
{
if cMerchant.Say("It is a very tasty beverage, have a sample!");
cEgo.AddInventory(iDrink);
}
Title: Re: Free items from one charecter to another.
Post by: RickJ on Sat 25/10/2008 07:14:17
Quote
dialog_request (int parameter)
Called when a dialog script line "run-script" is processed. PARAMETER is the value of the number following the "run-script" on that line of the dialog script.
So you would probably put something like this in somewhere the dialog script ..

run-script 1


and in the global scri[pt something like this ...

function dialog_request(int data) {

     if (data==1) {
          cEgo.AddInventory(iDrink);
     }
}

Title: Re: Free items from one charecter to another.
Post by: ty3194 on Sat 25/10/2008 22:00:53
cool thanks it worked on first try ;D