Usable Item Effect to depend on Key Item in Inventory?

Hello again!

My next stumbling block is this: I want to make a usable item's effect vary dependent on whether the party is in possession of a Key Item: specifically, Holy Water restores 100 HP to a party member, but if the Key Item Aspergillum is in the inventory, Holy Water restores 50 HP to all party members.

Two ways that I can think of to do this:

1.) "Damage" formula under Holy Water, though I know neither the Ruby syntax for checking if an item is in the inventory, nor if the damage formula can change the number of targets.

2.) Call Common Event when Holy Water is used. Here I can check if the Key Item is held, and heal the entire party, but I don't know how to make it so the target/user would be the only one gaining HP if the Key Item was not held.

Worst case scenario, I can just have the target gain 150 HP... maybe they got soaked. 🙂 Thanks for your time!
I'm pretty sure there is a way just to input this in the formula but I'm not very knowledgeable on this matter.

I can think of one way that requires the use of common events

Visuals

Spoiler
hSgbaoo.png


p7r3EcF.png
You first need to create a switch that will be On when the item is in your inventory (since its a key item, I assume you can't sell it)

You first change the items damage formula to "$game_switches[x] ? 0: 100 " where x is your switch number previously mentioned.

Under effects, you want to call a common event.

The common event will have a conditional branch that if game_switch[x] is on then here you can use change hp (but it won't update the health in battle right away) or make one of you actors force an animation of a spell that heals all of your allies when you consume the item.

Its a bit tedious and I'm hoping that there is a better way to do this but this is the first thing that came in my head.

Another cleaner way to do it which you should try is the instant the key item appears in your inventory, you can replace the holy water with another holy water but this item instead will heal all member. Basically an Item with the same name but with different properties.

lbf9lky.png


One way to perform checks is a conditional branch with "if item in inventory". Hope this gives you some ideas.

Original thread: https://forums.rpgmakerweb.com/threads/usable-item-effect-to-depend-on-key-item-in-inventory.24987/