Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bustee on Mon 10/09/2012 03:43:21

Title: Combining inventory items in Lucas Arts style games (Solved)
Post by: bustee on Mon 10/09/2012 03:43:21
Hi,

I am currently trying to make a small lucas arts style game. Unfortunately, I have problems with combining 2 items. I have clicked on the items in the Inventory items menu. and used the lightning to get the according functions.

The functions are (just one, but they essentially are all the same):

function iNail_Interact()
{
  // LOOK AT
  if(UsedAction(eGA_LookAt)) {
    Unhandled();
  }
  // USE
  else if(UsedAction(eGA_Use)) {
    Unhandled();
  }
  // Push
  else if(UsedAction(eGA_Push)) {
    Unhandled();
  }
  // Pull
  else if(UsedAction(eGA_Pull)) {
    Unhandled();
  }   
  //USE INV
  else if(UsedAction(eGA_UseInv)) {
    if (player.ActiveInventory == iHerman){
      player.Say("Mmh");
      Wait(20);
      player.FaceDirection(eDir_Down);
      player.Say("Well, I had this hamster Horst");
      player.Say("The emphasis is on had");
      }

else Unhandled();}

}

I checked it with the default game and to me, it looked the same. But whenever I try to combine 2 items nothing happens (i.e. cursor text goes back to blank and there is no output whatsoever).
Has anyone an idea why my script doesn't work?

Thanks a lot!
Title: Re: Combining inventory items in Lucas Arts style games
Post by: Khris on Mon 10/09/2012 11:05:15
While for everything else, all interactions are supposed to go into the "any click on..." event, for inventory items, you can split up the handling since the template calls "look at", "use inv" and "interact", too. (The latter only if the item is supposed to by used by itself and has ">u" at the end of the name.)
Every other interaction calls the "Other click on this item" event.

If you look at the template's example, the key has iKey_OtherClick entered into each event field (except interact).
Thus, like for objects and hotspots, one function can be used to handle all verbs.

If an item is used on another item, the template triggers the "Use inventory on this item" event.
To fix your issue, either enter iNail_Interact into each of iNail's event fields or create the function for the "use inventory on this item" event and put the handling in there.
Title: Re: Combining inventory items in Lucas Arts style games
Post by: bustee on Mon 10/09/2012 14:43:05
Thanks a lot!