Jump to content

setElementData


Fist

Recommended Posts

so i've been making pubg inventory, for pubg gamemode what i'm working on. Inventory works perfectly, only thing is that how items are saved, i'm using setElementData and then i use predefined table where all item names are in, and then compare that table with player's element data that has and if he does have them then display them in inventory. But that's not the thing i need help with. I need help with making few items unique, what i mean by that is for example Helmet, that item has more properties to it, so it goes like that setElementData(player,"Helmet",{amount,armor}, works fine too, but problem is in that, armor value changes for each item of helmet, and making them all the same value when are stacked together, i know it's because of that i use same name for them but i can't find other solution. I tried many other ways doing it. still couldn't find a way to do it. So if anyone has any ideas, please let me know. By the way, sorry about ban explanation, not that good at English.

Edited by Fist
Link to comment
4 minutes ago, Randomly said:

I assume, you store the items in a way like {item, amount} or something similar. Now if you store it like {item, amount, {special data}} then you'll be able to make uniqe items. That third part in the table won't hurt anything, however you can access it when needed. 

that won't work anyway if i use it on same element data, even adding more variables in it because element data's name stays the same. It will just overwrite it for every single item. I tried by making name a table which stores unique id or something like that but u can't pass tables in name.

Link to comment
1 minute ago, Mr.Loki said:

You need to read and modify the data before overwriting it

getElementData

Modify the table and add new stuff

Then setData

omg, you didn't understand it. Whatever, just close this topic if anyone can. Doesn't look like someone can understand what i meant. lol

Link to comment
  • Moderators
setElementData(player,"Helmet",
	{
		{id="notSpecial", amount, armor},
		{id="stupid", 999, -10000},
		{id="IIYAMA", 1, 1000000000000000000}
	}
)

 

setElementData(player,"Helmet",
	{
		notSpecial = { amount, armor},
		stupid = {999, -10000},
		IIYAMA = {1, 1000000000000000000}
	}
)

 

Edited by IIYAMA
  • Like 1
  • Thanks 1
Link to comment
17 hours ago, IIYAMA said:

setElementData(player,"Helmet",
	{
		{id="notSpecial", amount, armor},
		{id="stupid", 999, -10000},
		{id="IIYAMA", 1, 1000000000000000000}
	}
)

 


setElementData(player,"Helmet",
	{
		notSpecial = { amount, armor},
		stupid = {999, -10000},
		IIYAMA = {1, 1000000000000000000}
	}
)

 

ty this idea works fine.

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...