Okay after 4 hours of work and not even the slightest success I am done with this part.
It's apparently insanely difficult to have a shop unit and buy an item from it which consumes other items in the process.
All I want is "Buy item X", only works if you have item "A and B" in your inventory and # vespene gas. It would be better if it could also be "item A x2 and item B x1" but well, it's not that important.
At the moment I am using a research ability as dummy. If you use one of the dummy abilities (e.g. Research Longsword) then it checks for the first unit in the unitgroup of my heros that is owned by the triggering player for the required items and gives the corresponding item to the player.
This is working fine, but I'm having a few problems. I want this to be somewhat useable if you have more than 1 hero per player (just in case) and I also have the problem that the combine cost of the research ability is always deducted, no matter if you actually made the item or not.
Edit: Okay, I got that working too. If I now could get it so that if you don't have the items it will try to use your resources instead and only if that fails give you an error I would feel like god.
Basically, if you have item A and B for item X, A and B disappear and you get X - good.
If you have item A but not B you get an error "You need item B".
It would rock if it would try to subtract the cost of item B from your resources and if you have enough still buy the item. Only if you also lack the resources give you an error.
totallly trigger based system and exactly what you need. needs some setup on the items. i used the food field to determine how many recipe items are needed. the needed items are the produced units.
maybe finally someone has a use for it lol
I do have a huge problem with my solution though. I made it work, that you can buy items even if you lack the components and the correct amount (component price + combine cost) is subtracted.
But this does not work if your inventory is full.
I have a recipe that requires 2 Longswords. If I have 1 Longsword it subtracts the correct amount of money, the Longsword is consumed and I get the recipe item.
But if I have 5 Items that are not Longswords and 1 Longsword (OOOOOX) then it doesn't recognize the Longsword, subtracts the full cost (like if I had no Longsword) and doesnt give me an item.
Now what makes this even more funny is that if I have 2 Longswords and 4 other items (OOOOXX) it recognizes only ONE of the two, subtracts the correct money (for having 1 and lacking 1) and gives me the item.
BUT If I then buy the item again (now since I just made an item I have 5 different items and 1 Longsword left) it works fine! But only after buying the recipe item with 2 longswords before and it bugging there.
This is exactly the case why this "addition" to my solution was necessary. If someone has a full inventory with a component within I want them to be able to upgrade that component by just clicking the recipe button.
I wanted to find out why this happens, which I couldn't. I simply raised all arrays from 6 (my inventory size) to 7 (one more than I have inventory slots). This fixed this issue completely, however I don't know why.
The reason I don't get it - if I put 2 Longswords in my slot 5 & 6 it would work fine. Just if Slot 1-4 were occupied by other items it wouldn't recognize one Longsword (no matter how they were arranged).
an array of 6 goes 0-5 making 6 slots. Common mistake is to forget about the 0 slot. The issue fixed itself when u went to an array of 7 because 0-6 are now available.
not utilizing slot 0 is considered sloppy but considering the scale and potential scale it doesn't matter.
Okay after 4 hours of work and not even the slightest success I am done with this part.
It's apparently insanely difficult to have a shop unit and buy an item from it which consumes other items in the process.
All I want is "Buy item X", only works if you have item "A and B" in your inventory and # vespene gas. It would be better if it could also be "item A x2 and item B x1" but well, it's not that important.
At the moment I am using a research ability as dummy. If you use one of the dummy abilities (e.g. Research Longsword) then it checks for the first unit in the unitgroup of my heros that is owned by the triggering player for the required items and gives the corresponding item to the player.
This is working fine, but I'm having a few problems. I want this to be somewhat useable if you have more than 1 hero per player (just in case) and I also have the problem that the combine cost of the research ability is always deducted, no matter if you actually made the item or not.
Edit: Okay, I got that working too. If I now could get it so that if you don't have the items it will try to use your resources instead and only if that fails give you an error I would feel like god.
Basically, if you have item A and B for item X, A and B disappear and you get X - good.
If you have item A but not B you get an error "You need item B".
It would rock if it would try to subtract the cost of item B from your resources and if you have enough still buy the item. Only if you also lack the resources give you an error.
@Scythe1250: Go
totallly trigger based system and exactly what you need. needs some setup on the items. i used the food field to determine how many recipe items are needed. the needed items are the produced units.
maybe finally someone has a use for it lol
That's pretty amazing. But I'm not sure I understand the shop. I will spend some time understanding it and if I do I will probably use it.
If I decide I don't want a dialog shop I might go with my own solution, but right I think your shop is cool.
@Scythe1250: Go
just pm me if you have questions to the shop
I do have a huge problem with my solution though. I made it work, that you can buy items even if you lack the components and the correct amount (component price + combine cost) is subtracted.
But this does not work if your inventory is full.
I have a recipe that requires 2 Longswords. If I have 1 Longsword it subtracts the correct amount of money, the Longsword is consumed and I get the recipe item.
But if I have 5 Items that are not Longswords and 1 Longsword (OOOOOX) then it doesn't recognize the Longsword, subtracts the full cost (like if I had no Longsword) and doesnt give me an item.
Now what makes this even more funny is that if I have 2 Longswords and 4 other items (OOOOXX) it recognizes only ONE of the two, subtracts the correct money (for having 1 and lacking 1) and gives me the item.
BUT If I then buy the item again (now since I just made an item I have 5 different items and 1 Longsword left) it works fine! But only after buying the recipe item with 2 longswords before and it bugging there.
This is exactly the case why this "addition" to my solution was necessary. If someone has a full inventory with a component within I want them to be able to upgrade that component by just clicking the recipe button.
Okay, I solved the issue, but not like I wanted.
I wanted to find out why this happens, which I couldn't. I simply raised all arrays from 6 (my inventory size) to 7 (one more than I have inventory slots). This fixed this issue completely, however I don't know why.
The reason I don't get it - if I put 2 Longswords in my slot 5 & 6 it would work fine. Just if Slot 1-4 were occupied by other items it wouldn't recognize one Longsword (no matter how they were arranged).
an array of 6 goes 0-5 making 6 slots. Common mistake is to forget about the 0 slot. The issue fixed itself when u went to an array of 7 because 0-6 are now available.
not utilizing slot 0 is considered sloppy but considering the scale and potential scale it doesn't matter.
@SoulTaker916: Go
in GUI, setting a variable array, e.g. units[6] , creates always an array from 0-6
@FunkyUserName: Go I stand corrected.