How to know if player has an item in his bag?
I'm trying to make a function for TreasureMaps that let's me check if the player has the item (treasuremap) in his bag so that i can display that Treasuremap's location on the map.
but i need help as i don't know how to do this... It would also be nice to know once the item gets consumed (upon finding the Treasure itt gets deleted from inventory ) |
something like this possibly?
Code:
function DoesPlayerHaveItem(itemName) |
I'm not really sure what GetMaxBags() does, but it will probably return number of bags, not numbers of slots in bag. I think you can use (I didn't test it in game):
lua Code:
lua Code:
lua Code:
|
Garkin is correct. GetMaxBags() returns the number of bags, i.e. BankBag and InventoryBag.
|
Ah, yeah I was not too sure about that myself without logging in.
|
To find when it's consumed, you need to register an event for inventory changes. Store the (bag,slot) of the Treasure Map, and when that location is set to "", it's been removed. Hint: the bag is BAG_BACKPACK, and happens to be set to 1. It will also be removed when dropping it in the bank or deleting it.
|
All times are GMT -6. The time now is 09:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI