Unequipping Equipped Items (Please Help)

Hello everybody.
In my game, the player can collect items, which puts it in his inventory and also immediately equips it.

These items provide stat boosts, and they’re only given to the player when they are equipped.

For example: One item in my game increases the player’s max health by 5. It only gives that stat boost while it is equipped. When it’s NOT equipped, no stat boost will be given.

Condition: “Item Name” exists in inventory AND is equipped + Trigger Once
Action: Do + 5 to “GlobalVariable: MaxHP”

However, in this game, the player will also be able to drop these items to remove their boosts, which is why I made it so that they only provide their boosts when equipped. When they’re dropped, they are removed from the inventory, and unequipped, thus losing the stats. For this example, the player loses the +5 health boost if the item is dropped.

For some reason, this isn’t working for me. When the player removes the item from his inventory, the stat boosts persist, even though the item is supposedly gone and not equipped.

So in short, what I need right now is a way to classify items as “unequipped” and remove the stat boosts that they provide.

If it helps, the HP stat, and all of the character’s other stats are global variables, so that any boosts can be carried over to other scenes.

So, can I please have some help with this? The answer seems simple, but is there something I’m missing, or am I just dumb? I’d greatly appreciate any help I can get! :slight_smile: Thanks in advance.

I think you might need to add another action (do -5 to MaxHP) after it’s unequipped to update the health. Basically, the reverse of what you have for equipping.

Thank you for your reply. However, I have already tried this before asking this question. Even when I do -5 MaxHP, the stats don’t change at all. Is there another way?

there is something you shouldn’t be doing right, can you show the part of the code where you do -5 ?
Be csrefull you says global variable, as seems HP is global

Here is a screenshot. Everything is underneath the group “Cookie Crumb.”


I’m have no idea what I’m doing wrong. Can you help please?

hi
i think both events are true do you add 5 and substract 5 so nothing seems to change on hp.
I think this should work
set scene variable dropped=0
then goes the event Dropping test and add at the end of this event dropped=1
then in the event Temporary Inventory Test add as condition dropped=0

Thank you for responding, but can you please be a little more specific? I don’t really understand… Sorry…
Also, do I have to use a scene variable? The player is going to carry these items into different scenes.

Note: All items are stored in the same group called “Collectibles” to optimize the game and code, but each individual item has different effects.

I think I can’t be more specific. If you want send me the code and I can modify it.
The scene variable is a temporal variable to differenciate both events so both are not true at the same time. So there is no need to be global

How do I send the code? Do I type it in a comment?

Attach the zipped game file I think.

Should I just type the code in the comments, or would it be more recommended to attach the zip file?
I don’t want some guy to come to this conversation and steal my game.

I’d type it out if you’re worried about theft, which is understandable, although sending the file is the easiest way for someone else to modify the code. Otherwise, they have to completely recreate it on their machine.

Okay, I’ll send it as a zip tomorrow afternoon. I’ll reply back with the link when it’s ready. Thanks for the help in advance.

(Also an apology in advance, the code is a bit messy, but I put comments and groups to organize things a bit for convenience.)