Jump to content

Need a main idea of a combining items in and inventory system


ERAGON007

Recommended Posts

Hi, so i want to make an inventory system and now i don't know where to start coding the part that combines items and gets new items

 

currently i have

Quote

 

items = {

"Water", -- Item 1

"Sandwitch", -- Item 2

}

 

 

and now what to do next? is this right?

Quote

 

combine_list = {

-- In What Format?

}

 

 

Link to comment
On 03/01/2021 at 14:54, Tekken said:

You can do 


table = {
["item1"] = "Sandwich",

["item2"] = "Water",

-- etc

};

Is that what you need?

I already made this part , but idk how to code the part to combine items

 

for example combinig 'item1' with 'item2' gets a new item e.g ('item3')

Link to comment
  • Moderators
1 hour ago, ERAGON007 said:

for example combinig 'item1' with 'item2' gets a new item e.g ('item3')

 

 

Just some format examples, the right format depends on how you work with them:

itemProperties = {
	["water"] = {
		["friendlyName"] = "Water"
	},
	["sandwitch"] = {
		["friendlyName"] = "Sandwitch"
	}
}

items = {
	["water"] = {-- Item 1
		["amount"] = 2
	}, 
	["sandwitch"] = {-- Item 2
		["amount"] = 1
	}, 
}
-- or
items = {
	{-- Item 1
		["amount"] = 2,
		["id"] = "water"
	}, 
	{-- Item 2
		["amount"] = 1,
		["id"] = "sandwitch"
	}, 
}




combine_list = {
	{
		["ingredients"] = {
			["water"] = 2, -- 2x water
			["sandwitch"] = 1, -- 1x sandwitch
		},
		["newItem"] = "water sandwitch"
	}--[[,
	{ -- next combination
		["ingredients"] = {
			["water"] = 2, -- 2x water
			["sandwitch"] = 1, -- 1x sandwitch
		},
		["newItem"] = "water sandwitch"
	}]]
} 

 

Edited by IIYAMA
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...