player using all items

Started by Jojowl80, Sat 04/07/2020 00:13:46

Previous topic - Next topic

Jojowl80

I posted this in my Global Script

Code: ags

function Arcus_UseInv()
{
 if (player.ActiveInventory == iCcupfull)
 if (player.HasInventory(iCcupfull))
 player.Say("I thought you'd never ask.");
 player.LoseInventory(iCcupfull);
 player.AddInventory(iCcup);
}


but it does not matter which inventory item I use on him, it activates the script.

Privateer Puddin'

#1
Try this?

Code: ags

function Arcus_UseInv()
{
  if (player.ActiveInventory == iCcupfull) {
    if (player.HasInventory(iCcupfull)) {
      player.Say("I thought you'd never ask.");
      player.LoseInventory(iCcupfull);
      player.AddInventory(iCcup);
    }
  }
}


You shouldn't need both, since for it to be active inventory, you should already have it? but it should work if both conditions are met


Jojowl80


Crimson Wizard

Jojowl80, you do not need to test if player HasInventory if ActiveInventory is same item, because ActiveInventory can be only one of the items player has.

SMF spam blocked by CleanTalk