Replies: 1 comment 4 replies
-
I looked into it and I'm pretty sure this happens because the items created inside func addItem(item_name: String):
var item = InventoryItem.new()
item.protoset = protoset
item.prototype_id = item_name
if inventory_stacked.has_place_for(item):
inventory_stacked.add_item_automerge(item) This can be considered a bug in the plugin which prevents you from setting the prototype ID while the protoset is |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Peter!
I'm relatively new to Godot and just found GLoot a few days ago. In my game I have several items that can be dropped and the player should pick them up. I have a helper method for this inside player.gd - the player scene has an InventoryStacked and a CtrlInventoryStacked:
func addItem(item_name: String):
var item = InventoryItem.new()
item.prototype_id = item_name
if inventory_stacked.has_place_for(item):
inventory_stacked.add_item_automerge(item)
But it seems that this works only for the first item from the protoset which is this:
[
{
"id": "apple",
"image": "res://art/apple-icon.png",
"name": "Apple",
"stack_size": 1
},
{
"id": "stick",
"image": "res://art/stick-icon.png",
"name": "Stick",
"stack_size": 5
},
{
"id": "water_potion",
"image": "res://art/water_potion.png",
"name": "Water potion",
"stack_size": 1
},
{
"id": "slime",
"image": "res://art/SlimeIcon.png",
"name": "Slime",
"stack_size": 1
}
]
Whenever I add another item, I only get apples. When I remove the apple, I only get sticks (again the first item), but the stack_size = 5 works also only the first time. Then the default "1" will be added. Maybe I'm doing something completely wrong. The chance is very high that I maybe don't understand how to use your tool.
Take care.
z3dd4
Beta Was this translation helpful? Give feedback.
All reactions