Help with script if (player.ActiveInventory)

Started by HereComeDatBoi, Thu 01/01/2009 06:48:33

Previous topic - Next topic

HereComeDatBoi

On my new game I would like to know the script so that I can check multiple items with if (player.ActiveInventory ==). This is the script i've used but I need some help.

function iSouthernwood_UseInv()
{
if (player.ActiveInventory == iSouthernwood){
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iSouthernwood)
(player.ActiveInventory == iVial)
player.LoseInventory(iSouthernwood);
player.LoseInventory(iVial);
player.AddInventory(iAConcoct);
Display ("Mixed the Southernwood in the Vial to create an Appleringie Concoction");
}
else Display ("You need 10 Southernwood herbs to produce an Appleringie Concoction!")
}


Thanks in advance

Trent R

Try
Code: ags

function iSouthernwood_UseInv()
{
  if ((player.ActiveInventory==iVial)&&(player.InventoryQuantity[iSouthernwood.ID]==10))
  {
    //do stuff
    player.InventoryQuantity[iSouthernwood.ID]-=10;
    player.LoseInventory(iVial);
    player.AddInventory(iAConcoct);
    UpdateInventory();
    Display ("Mixed the Southernwood in the Vial to create an Appleringie Concoction");
  }
  else Display ("You need 10 Southernwood herbs to produce an Appleringie Concoction!")
}


You want you use iVial on iSouthernwood, right?


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune


Shane 'ProgZmax' Stevens

If for some reason you can carry more than 10 Southernwood, you'll need to change this line:

Code: ags

(player.InventoryQuantity[iSouthernwood.ID]==10)


to this

Code: ags

(player.InventoryQuantity[iSouthernwood.ID]>=10)


If this is just a one-shot puzzle though, it's fine.

SMF spam blocked by CleanTalk