Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: jpcr on Fri 14/11/2008 22:09:36

Title: function iKey_Interact() ; problem interacting with inventory item(SOLVED)
Post by: jpcr on Fri 14/11/2008 22:09:36
ok newbie here ... ,

i searched the forum but did not found what i 'm looking for.

i have an object  door ( oDoor ) and a key in my inventory (iKey)

what i want to do is simple :

i pick the key in my inventory then use it on the door.

i thought it was in the function iKey_Interact() but i'm stuck.

please help.

jp
Title: Re: function iKey_Interact() ; problem interacting with inventory item
Post by: jpcr on Fri 14/11/2008 22:42:15
ok i got it :

function oPorte_UseInv()
{
  if ( cEgo.ActiveInventory == iKey)
  {
    oPorte.SetView(3);

    oPorte.Animate(0, 7, eOnce, eBlock, eForwards);
   
       
   
    }
}


but now the key remains on screen , any way to put it back in inventory after use?
another call to addInventory?

thanks
Title: Re: function iKey_Interact() ; problem interacting with inventory item
Post by: Trent R on Sat 15/11/2008 01:53:07
mouse.Mode==eWalkto changes the mouse mode to walking, or use any of the other mouse modes. You might consider putting a loseInventory after Animate, unless the player will use the key inventory item again. By making the player lose it (again, only if this the only time they use it) it keeps the inventory from getting cluttered.


~Trent
Title: Re: function iKey_Interact() ; problem interacting with inventory item
Post by: Dualnames on Tue 18/11/2008 09:52:37
function oPorte_UseInv(){
  if ( cEgo.ActiveInventory == iKey)  {
    oPorte.SetView(3);
    oPorte.Animate(0, 7, eOnce, eBlock, eForwards);
    player.ActiveInventory=null;//that will make the cursor back to normal.
//or
//player.LoseInventory(iKey);
//that will make the cursor back to normal, and lose item.
    }
}

Un-comment anything you want to put to use, I've put them in bold to help you see what I changed.