I want to add a trinket system to my game, ones that can be added to their own designated slot and be equipped to provide passive effects to the player
The way I set this up is that I have the trinket inventory with 2 pages (Each on their own external layout, then loaded in as a layer). These pages are cycled through by a pagination system. When you click on the trinket after picking it up, it will be equipped or unequipped
However, I’m having issues when trying to equip these trinkets
I want to have the trinkets be equipped relative to the slots they’re in. If you click on a slot, equip/unequip. If it’s equipped, put a blend mode layer on the slot, and remove it when it’s not equipped.
Are you just using hide for inactive layers? If so maybe you can set up a condition that they’re not hidden (if hiding layers lets that work, not sure it might be only actual object visibility counts to check if an item is visible) or if it’s on a layer that’s visible.
For the other thing, the blend thing, maybe drag it out so it’s an independent condition/action. Worth a shot. If not, I’d tie it to another condition like maybe just a simple boolean is equipped.
Alright, I tweaked the code a bit like you said (Tried the hiding layer thingy) and now the trinkets equip and unequip like they should. Unfortunately, one other problem persists. Here, I’ll show you:
Basically, what’s happening is that when I click on the trinket in slot 2, the hidden slot BEHIND that slot also gets equipped and unequipped. How can I made it so only the trinket on the active page gets selected while the hidden one gets ignored entirely?
I tried uninverting the hide layer condition, but it just straight up prevents trinkets from being equipped…
Is there some sort of special trick to solve this? Thanks
Just a word of caution. If it’s possible for both [OR] conditions to be true, then both TrinkCell sprites would be “picked”. The one in collision with the selector and the one with the mouse. The “z” key and mouse would have to be pressed at the same time but it’s not tough if you repeatedly do it.
I don’t know enough about your project to know if that’s possible. You could check that the “number of instances picked” equals 1 which would also prevent multiple cells from being touched simultaneously.
IDK. It should work without being inverted. I would make sure all of the objects are on the right layers. You can double check with the debugger. I’d also check the value of the trinkPage. Make sure it’s changing properly.
This seems to be your process:
if cursor is on cell and mouse is released then all cells on all layers at that location get picked
if the cells animation isn’t 0 then they get unpicked
if the cell is on “Layer” + Variable(tinkerLayer) should pick only instances left on that layer.
same for the one that uses a collision and the Z key.
There are only 3 options, either the layer variable isn’t the right value, the object(s) isn’t on the right layer or code somewhere else is doing something.
I created a project just to test the process. It uses a text object instead of sprites but it’s the same process.
If you click the numbers, it changes layers. If you click the text object it spins. The “X” is the selector. If you drag it onto one of the text boxes and then press “Z” it will also rotate the text object.
Out of curiosity, are the text objects in TrinketGroup separate text objects? Because I’m using the same trinket cells for both pages. Is THAT the problem?
Also, I tried with the debugger after uninverting the condition, the trinkets don’t equip unless it’s inverted. I did some more debugging, and I can confirm that both trinkPages 1 and 2 are each on their own layers in their own external scenes, and the TrinkPage variable is changing properly
I’m completely lost on what’s wrong with the project. Should I just send it to you?
The problem could be anywhere. It’s usually something small like a typo or something that looks like it should’ve worked. I’d be happy to have look. Send me a link to your project files and I’ll take look today (Monday).