RPG Maker MV

RPG Maker MV

TheMCPanda Feb 24, 2019 @ 2:16am
require item to cast spell
is there anyway i can force the player to have X item in their inventory before a spell can be cast?
< >
Showing 1-4 of 4 comments
Caethyril Feb 24, 2019 @ 5:13am 
You might be able to do it with Yanfly's Auto Passive States plugin[yanfly.moe]: have a passive state assigned to all actors with a Seal Skill trait and state notetag:
<Custom Passive Condition> if ($gameParty.numItems($dataItems[42]) < 1) { condition = true; } else { condition = false; } </Custom Passive Condition>
Replace 42 with the ID of the item you want to check for, and 1 with the number of items required. Then the state should be active (and the skill sealed) only when the party has less than that number of that item. =)

Note that if you're using independent items from Yanfly's Item Core then you'll need to replace numItems with numIndependentItems for the check to work correctly.

Alternatively, for skills that consume items on use, Yanfly's Skill Core[yanfly.moe] + Skill Cost Items[yanfly.moe] plugins can do this with no coding required~ \o/
TheMCPanda Feb 24, 2019 @ 5:32am 
Originally posted by Caethyril:
You might be able to do it with Yanfly's Auto Passive States plugin[yanfly.moe]: have a passive state assigned to all actors with a Seal Skill trait and state notetag:
<Custom Passive Condition> if ($gameParty.numItems($dataItems[42]) < 1) { condition = true; } else { condition = false; } </Custom Passive Condition>
Replace 42 with the ID of the item you want to check for, and 1 with the number of items required. Then the state should be active (and the skill sealed) only when the party has less than that number of that item. =)

Note that if you're using independent items from Yanfly's Item Core then you'll need to replace numItems with numIndependentItems for the check to work correctly.

Alternatively, for skills that consume items on use, Yanfly's Skill Core[yanfly.moe] + Skill Cost Items[yanfly.moe] plugins can do this with no coding required~ \o/
thank you this helped a ton!
Caethyril Feb 24, 2019 @ 7:12am 
Happy to help! ^_^
Jack McJaguar Sep 26, 2022 @ 10:26pm 
So I had a eureka moment in figuring out a weapon and ammo system, which is essentially a skill with an item cost. It took 3 hours to figure out kinks, buuut.... basically you have to make the item you want consumed as an accessory item. With that being the case, I've only done this for individual item cost. Though I'm sure you can have the accessory item act as the base item and adding traits of item consumption with the skill use. Anyway, back to the ammo system:

All my steps:
- In the data base, go to TYPES and add an entry for Armor Types ( I made an entry labelled "Secondary Item"), and Equipment Types ( I made an entry labelled "Ammo")

- In Weapons tab, made a "Pistol" entry, Weapon Type: Gun. And in it's Traits: Add Skill Type: Special

- In Armors tab, made a "9mm Bullet" entry. Armor Type: "Secondary Item". Equipment Type: "Ammo". In it's traits "Add Skill" Pistol (you will add this last step when you make the skill)

- In Skills tab, made a "Pistol" entry, with Skill Type: Special. Effects: Common Event: Consume 9mm (you will add this last step when you make the common event)

- In Common Events tab, made "Consume 9mm" entry. Contents= Change Armors:9mm Bullet -1 (include equipment)



As you can tell at this point, you have to go back to some of the tabs to tie in skills and items and traits.
But the hard part is over, from there you simply create a Class with the Trait: Equip Armor "Secondary Item"
DO NOT add the skills you want to be item based, into the classes' Skills to Learn section. And make sure your Actor can Equip Weapon "Gun"

To test this, I made a training ground with a dummy target and box of ammo that gives you one round per click. You have to make sure you equip the ammo before going into the fight (though I'm sure you can add an "equip" prompt in battle mode somehow) but once equipped, I was able to use the skill as many times as I had ammo in inventory. And once I ran out of ammo, the skill disappeared.

This is the formula I could come up with, you simply need to change the names/types/traits for what ever situation you desire.
Last edited by Jack McJaguar; Sep 26, 2022 @ 10:28pm
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Feb 24, 2019 @ 2:16am
Posts: 4