Cernu 87 Posted October 3, 2020 Would this be possible, or maybe it already exists ? some way to get if a player has a certain item in its inventory, return its number, and change this number. this would be very handy for a custom crafting system. Share this post Link to post Share on other sites
Azaren 130 Posted October 4, 2020 Yes u can do it, by script https://community.bistudio.com/wiki/Ylands_Tile_-_Character_inventory Share this post Link to post Share on other sites
Cernu 87 Posted October 4, 2020 Yes I discovered this indeed, thanks. however, there are still some issues. I created a function to try to return the amount of a certain item. So I loop through the items using this "get inventory" array, and then for each item, I insert an "IF" check. I here I have issues. For some items, like "fern seeds", i can reference it easily using a get type of the item. So "if get type "item" = get type "fern seed", do something. Then, i actually count and return the number of items. Works fine. However, if I use "grass", it seems that the "grass" item doesn't have a type. So it doesn't match. So I tried using the name of the item, but in this case, I have to reference an actual entity that exists on the map, it seems I can't reference a template or type, and get its name. And however, it would be much easier to reference a type, than having to create a template for each and every item I want to create in my game. Share this post Link to post Share on other sites
Cernu 87 Posted October 4, 2020 Ok, I found the issue, I wasn't refernecing the proper type of "grass", as there are at least 3 or for differeint "grass" items when choosint the entity type. It works fine, also the get and set stack. Onward to my custom crafting ! Share this post Link to post Share on other sites
Azaren 130 Posted October 5, 2020 Items in stacks counts e.g. 20 bullets are ONLY one item of bullets, but in stack 20 of them. Two stack of bullets are two items, atc. If you want to find out the number of bullets (in all of your stacks in inventory) you need check number of all stacks and if you find stack, you need check number of items in this stack. For this you need to use this script: "https://community.bistudio.com/wiki/Ylands_Tile_-_Item_stack_count" Sorry for my english... Share this post Link to post Share on other sites