So, this is a bit complex. So for my game “Bounty Hunters”, I am making a custom shop system for getting new weapons, since I want players to be able to switch weapons without having to drop their old weapon. But my current system isn’t working. To explain the system, I divided it into two parts: The shop and the grid.
This is the shop:
And this is the grid:
So here’s what I want to happen ( means it’s working properly)
- Player presses button of item they want to get.
- If the player hasn’t yet bought the item and doesn’t have enough cash, a popup comes up saying they need more cash.
- If the player hasn’t yet bought the item but does have enough cash, the cash needed to buy the item is taken and the system moves on to the next step.
- If the player has already bought the item, no cash is taken and the system moves on to the next step.
- The player’s old weapon is cleared to create space for the new weapon.
- The new weapon of the same rarity is given to the player
The problem is that, no matter what, the player’s old weapon isn’t cleared, meaning they can’t get the new weapon.
I’m going to try to explain the system I’m using as best as I can, but it’s a bit complicated.
Everything in the shop area is aligned vertically, so each column affects the same item. When a button is pressed [possible once the 1-minute grace period ends], it sends a channel its first checker (red outline). This first checker checks whether the item has been bought already; it does so by detecting the values of the properties seen in the bottom right [all are player-scope]. A value of 0 means it hasn’t been bought yet, while a value of 1 means it has already been bought. If the item has already been bought, it sends a channel right to its second trigger (purple outline). If it has not been bought yet, it goes to the second checker (blue outline), which determines if the player has enough cash to buy the weapon. If the player does not have enough money, it sends a channel to the popup on the left. If they do have enough money, the checker sends a channel that both makes the item granter remove the amount of cash the item costed and triggers its first trigger (green outline) which changes the item’s corresponding property to 1 so the system now knows the item was already bought. The first trigger then sends a channel to the second trigger (purple outline again). The second trigger sets the property “Weapon” to a number from 1 to 5, depending on the selected weapon, then sends a channel to the trigger in the top right corner, which is in the bottom right corner of the grid. Note that the Zapper, which is the starting weapon, skips most of the previous steps and goes straight to its purple trigger, since you don’t need to buy it.
The trigger with the purple outline in the bottom left is where all the previous purple triggers send a channel to. This trigger broadcasts to ALL the inventory item managers to clear all of that item, so, in theory, no matter what weapon the player has, it will be cleared [clearly it doesn’t work though and I have no clue why]. The trigger also sends the channel to another trigger (yellow outline), which [after a 0.1 second delay, in case that’s important] runs all of the checkers above it at once [only one can be true at a time]. The checkers check for the value of two properties: “Weapon” and “Rarity”. “Weapon” was already mentioned, and “Rarity” determines whether the item should be common, uncommon, etc. Each of the checkers sends a signal to the corresponding item granter if the check passes.
So yeah, sorry for the incredibly long post, but I seriously don’t know what’s going on. I already double checked all the channels to make sure they are going to the right spots, so it’s not that. If you have any possible idea why it isn’t removing the old weapon, please let me know, any help is appreciated.