The title may be a bit confusing but here's the scenario, I have a scroll in the inventory which runs a code that when selected, its Y-Position goes up and is visible to the camera. Now when I click on the scroll again, I want it to go down again. I tried the combine event and added a combine event on itself.The scroll goes down when I deselect the scroll using unhandled combine events. I want this to happen when I click on the item itself too. Thanks
Comments
It's probably easier to make a separate inventory item for when the scroll is changed, and then use the "Inventory: Replace" Action to swap one for the other. You can then define a Use interaction for it to run what you need when you click on this changed scroll.
I have the function for the equip scroll function already, the scroll just goes up and the scroll is then visible. The unequip function works alright too. it just does the same thing in reverse.
I have the equip function attached to the "on use" event on the scroll item in the inventory. I also have the unequip function attached to the unhandled combine to unequip the scroll whenever the player wants to select another item. But my problem is that whenever I click the scroll item on the inventory box while the scroll itself is equipped. The unequip function doesn't apply.
All in all what I want to do is to be able to add a function where when the item is active. If you click on the item again, a function or actionlist is ran.
Please do tell me if it is still confusing. Thanks
Using an item on itself will just de-select it - you can't define an interaction for that, unhandled or otherwise. However, it will invoke the OnInventoryCombine custom event, which has parameters for both items involved - so you can use this to check if the item was used on itself, and react accordingly.
See the bottom of the "Inventory scripting" chapter of the Manual, the one on "Custom events", as well as this tutorial. Shout if you need more specific help after going through those, but that's going to be the avenue to go down - unless you try the replace method I suggested above.