Hey,
So I am creating a simple item system, and my goal is to manage things via Lua code as much as possible, and use Object Editor as much as possible.
I am able to pretty much fully manipulate item objects (name, icon, abilities etc). This way I can have 1 single item created in Object Editor and pretty much "create" any item I want ingame.
Huge props to Uncle for helping out with the struggles.
The thing is, the unit will get the items from shops by purchasing them. So I created shops and then I need to add them to stock. I did that as follows:
Now, I want to be able to manipulate the items in shop (or before adding them to the shop). The issue is, this native function requires you to use typeId, so I can't create an item object and add it to the shop. Meaning I need to somehow reference the items after they are added to the shop.
I tried getting them though inventory function, but that was a fail (obviously).
I also tried assigning the AddItemToStock function to a variable and use that (e.g: local item1 = AddItemToStock(shop, basicItems[1].typeId, 0, 0), but it didn't work either.
I search over all the natives I thought could be related and couldn't find an answer.
Is there a way to either reference the items in shop (stock items), or change the item typeId (not item object), then add it to the shop, and change it again with hopes that it won't change the item instance already added to the shop?
If that's not a possibility, sadly I will have to create an item in Object Editor for each item in game, and that somewhat negates the usage of manipulating object items (yes, I will still be able to change it's stats and such, but I will have to get an item for every item name and item icon I want to be in the shop..).
Any suggestions/ideas will be much appreciated
So I am creating a simple item system, and my goal is to manage things via Lua code as much as possible, and use Object Editor as much as possible.
I am able to pretty much fully manipulate item objects (name, icon, abilities etc). This way I can have 1 single item created in Object Editor and pretty much "create" any item I want ingame.
Huge props to Uncle for helping out with the struggles.
The thing is, the unit will get the items from shops by purchasing them. So I created shops and then I need to add them to stock. I did that as follows:
Lua:
function Shops.AddBasicItemsToShop(shop)
local basicItems = Items.data.ShopItems.BasicItems
AddItemToStock(shop, basicItems[1].typeId, 0, 0)
AddItemToStock(shop, basicItems[2].typeId, 0, 0)
AddItemToStock(shop, basicItems[8].typeId, 0, 0)
end
Now, I want to be able to manipulate the items in shop (or before adding them to the shop). The issue is, this native function requires you to use typeId, so I can't create an item object and add it to the shop. Meaning I need to somehow reference the items after they are added to the shop.
I tried getting them though inventory function, but that was a fail (obviously).
I also tried assigning the AddItemToStock function to a variable and use that (e.g: local item1 = AddItemToStock(shop, basicItems[1].typeId, 0, 0), but it didn't work either.
I search over all the natives I thought could be related and couldn't find an answer.
Is there a way to either reference the items in shop (stock items), or change the item typeId (not item object), then add it to the shop, and change it again with hopes that it won't change the item instance already added to the shop?
If that's not a possibility, sadly I will have to create an item in Object Editor for each item in game, and that somewhat negates the usage of manipulating object items (yes, I will still be able to change it's stats and such, but I will have to get an item for every item name and item icon I want to be in the shop..).
Any suggestions/ideas will be much appreciated