Fist Posted December 2, 2017 Share Posted December 2, 2017 (edited) 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 December 2, 2017 by Fist Link to comment
WorthlessCynomys Posted December 2, 2017 Share Posted December 2, 2017 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. Link to comment
Fist Posted December 2, 2017 Author Share Posted December 2, 2017 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
Mr.Loki Posted December 2, 2017 Share Posted December 2, 2017 You need to read and modify the data before overwriting it getElementData Modify the table and add new stuff Then setData Link to comment
Fist Posted December 2, 2017 Author Share Posted December 2, 2017 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 IIYAMA Posted December 2, 2017 Moderators Share Posted December 2, 2017 (edited) 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 December 2, 2017 by IIYAMA 1 1 Link to comment
Fist Posted December 3, 2017 Author Share Posted December 3, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now