Activate Equipment

Activate Equipment 1.2
ATT_Turan
​

Introduction
This plugin was a request I received to be able to use equipment for effects in battle. Apparently the request was motivated by Dragon Quest, but it reminded me of the Shining Force and Phantasy Star games.

I have tested the basic functionality, please let me know if you encounter any errors. I will consider making compatibility patches if the other plugin is free to use (or one I own, such as a Yanfly product) and unobfuscated. Otherwise, other authors are free to modify this code to make it compatible with theirs so long as I am still credited.

Spoiler: Features
Using this plugin, you can assign weapons and armor to have the function of consumable items or skills in your database. You will then be able to go into the Items menu in battle, and any equipment with that assignation the current actor has equipped will show up to be used.

There are a number of options that can be configured. The default functionality lets the player freely activate equipped items as their turn in battle. You can instead impose a limit so each actor may only activate each item once per battle. If using Yanfly's Item Core, you can also set a specific number of charges per item, and whether or not they recharge automatically.

Finally, you can specify a chance that an item will "crack" when activated. This does not impair its basic weapon/armor functionality, but prevents it from being activated again until the item is repaired. This option requires the use of Yanfly's Item Core with the parameters set to make weapons and armor independent items. You can also set a second chance that when an item cracks it will break, destroying and immediately removing the item.

Spoiler: Screenshots
ActivateEquipment2.gif

Spoiler: How to Use
Use the following notetag in the notebox of your Weapons or Armor:

<activateequipment: [skill/item] ID>

Example: <activateequipment: skill 14>

The word specifies whether the equipment is referencing a skill or item in your database. The ID determines which skill or item. Note that any costs associated with a skill are ignored when activating it from equipment.

<activateonce>

This notetag limits the equipment to being activated once per actor per battle.

<cancrack: [chance]>

Example: <cancrack: 40> would give the equipment a 40% chance to crack

This does not change how frequently the equipment can be activated, but gives each activation the specified percent chance to crack. A cracked item still has all of its parameters and functions normally as equipment, but is not available to be activated again in battle. Once it's repaired, it can be activated again normally. This notetag will not function unless your project also has Yanfly's Item Core and weapons and armor are set to be independent items.

<crackbreak: [chance]>

Example: <crackbreak: 33> would give the equipment a 40% chance to break when it cracks

This gives the equipment a chance to break and be permanently destroyed each time it cracks. This will have no effect unless the <cancrack> notetag is on the item.

<breaktext: [text]>

Example: <breaktext: The Holy Ring shatters into hundreds of pieces!>

This will allow you to create a custom message to display when a piece of equipment breaks. If specified, it will display after the crack message.

<activatecharges: [number]>

Example: <activatecharges: 4>

This will give the equipment a certain number of charges. Activating the equipment in battle spends one charge and equipment cannot be activated when it has no charges left. Charges will replenish at the start of each battle unless otherwise specified.

<chargespersist>

This notetag causes charges to persist between battles instead of refilling automatically.

Spoiler: Plugin Commands / Script Calls
RepairEquipment

This plugin command will repair all cracked equipment owned by the party.

RechargeEquipment

This plugin command will reset all equipment owned by the party to their maximum charges.

CrackRepair(item)

This function can be used to repair an individual cracked equipment. This may be useful if you want to have vendors that charge for each repair, or if you want an actor to be able to repair their own items during battle.

IsCracked(item)

This will return whether a specified weapon/armor is cracked.

RechargeItem(item)

This function can be used to reset an individual piece of equipment back to its maximum charges.

item.charges

This variable tracks an item's current number of charges.

actor.activating

If an actor is activating a piece of equipment, a copy of it will be stored in this variable for the duration of that action.

Terms and Credits
Free for non-commercial and commercial use. Credit ATT_Turan.
Adding onto, older Final Fantasy had a similar function too. For example, in the original Final Fantasy, each party member has their own inventory where they can activate equipment in their inventory. Final Fantasy IV and VI (II and III in the US) also allows activating equipped items. Cannot remember all the rest though.

Looking forward to experimenting with this plugin! Hope it plays nice with Galv's Actor Equip Items plugin.
Hope it plays nice with Galv's Actor Equip Items plugin.
I suspect it won't, because that plugin completely changes how it constructs the list of items in combat.

But I'm willing to take a look at it to see how I can accommodate. In the mean time, please enjoy trying it out!
Bruh. Why you do this!? *sigh*


*Reconfigures skill system again*


In all seriousness though this is a super exciting plugin that I will be trying to implement.

Thanks a ton @ATT_Turan

Questions:

Is the repair/cracked functionality depending on ItemCore or can it be used without?



Lastly, any chance to add activate limits by number? Beyond <activateonce>

Would allow for some cool flexibility
@zelanius The compatibility actually looked simple to implement, so please download version 1.1 and let me know if you run into any bugs.

Questions:
Is the repair/cracked functionality depending on ItemCore or can it be used without?
Per the description above, items cracking requires the use of Yanfly's Item Core.

Lastly, any chance to add activate limits by number? Beyond <activateonce>
Equipment charges are possible, but would also require Item Core.

Also, please note that I do not promise any compatibility with this plugin in MZ, which is what your profile says you use. You're welcome to try it, of course.
Per the description above, items cracking requires the use of Yanfly's Item Core.
Yep, caught that after and crossed out that question

Equipment charges are possible, but would also require Item Core.
fine if thats the case, would be a nice to have, definitely not a need

Also, please note that I do not promise any compatibility with this plugin in MZ, which is what your profile says you use. You're welcome to try it, of course.
Naturally ^_^, working fine so far though. Going to test functionality when more than one of the same equipment is on an actor when "activateonce" is in play.

Awesome, so I can confirm if independent items is in play from ItemCore each equipment can be activated separately even if there are duplicates equipped with Activate Once applied ^_^. So I used one of them turn 1, and the other is still available. Feels like an obvious thing but saying outloud in case anyone else ends up with the same question.

1681566672151.png



Side request:

Is there any potential to have Equipment Activation as its own command? So a list would look like:

Attck
Skill
Equipment (renamable)
Defend
Item
Escape
I can confirm if independent items is in play from ItemCore each equipment can be activated separately even if there are duplicates equipped with Activate Once applied ^_^.
It's important to note this is not the case without independent items. So with the basic functionality, if you had two Fire rings or whatever you show in your screenshot, activating one will count for them both. The same is true if you use an equip change plugin, swapping two Blaze Swords or something won't enable the second to be activated again.

Is there any potential to have Equipment Activation as its own command?
It's possible, but I'm not sure it'll go on a to-do list - I think having them placed prominently at the top of the Items list works pretty well.

If a few people say they'd like it (or if I get bored for stuff to do), I'll look into it. Primarily, constructing new sets of windows and the commands for them is kinda tedious 😛
*Puts on Thanos "Fine I'll do it myself" hat* xD
@ATT_Turan , I tested the plugin with Galv_ActorEquipItems, and got the below error. I also had YEP_ItemCore active (along with YEP_CoreEngine). The error report happens with or without other plugins turned on. The first is when I place your plugin after both Galv and YEP plugins, while the second is placing them before the plugins.

I think it might be the issue with Galv_ActorEquipItems compatibility. I tried turning only this plugin off, and your plugin works perfectly with all my other plugins (so far, I heavily use YEP, but also Ramza, some of Caethyril, Galv, and a couple of others here and there like SRD, Yorae Rasante, and HeroicJay, and they all work in perfect sync except for Galv_ActorEquipItems).

Also, I like your idea of having it right at the top of the item list, but that might just be my nostalgia from FFII (IV in Japan) SNES days (pretty much my first RPG I ever played).
@zelanius the Galv plugin changes how items are displayed and selected more significantly than I realized at first glance.

I'll have to take a poke at it over the weekend - it's a neat plugin, and I'd like for them to work together, but he did some tricky stuff.
@ATT_Turan forgot to mention a few things:
1. When I place your plugin after both Galv_ActorEquipItems and YEP_ItemCore, I could not even open the Item menu in battle, and the bug report immediately surface.
2. When I place your plugin before, however, I am able to open the Item menu in battle, and even select the first item, as well as the target of the item. However, back in the menu, as soon as I press any directional key, the error report shows up.
I thought the plugin was neat and i loved the mechanic in earlier FFs and Dragon quest so I gave it a shot in my main project. A few initial observations:

Using Yanfly's in-battle equip menu plugin seems to cause the overlay for the menu to linger on the screen in some situations. Real unhelpful, i know, but i havent played around with it enough to find a possible cause other than "It sometimes happens when leaving the menu". If i find out more about it later ill bring it up.

1681728818317.png


Every time I attempted to open the item menu on someone that had something equipped with the <activateonce> tag on while conducting a battle test, the following error occurred:

1681727135526.png
1681727177686.png


I then removed the tag and it let me into the items list, but selecting the equipment caused a different error. Regular items and skills are unaffected.
1681727326057.png
1681727376404.png

I figured it was because of some plugin incompatibility so i started disabling plugins to see what could be causing it. once I got to the the point where nothing below yanfly's item core was enabled I decided to make a new project and test it in isolation. I still got the error above
1681727922472.png
1681727994746.png
1681727952468.png

I thought the message was unhelpful and added Yanfly's core above it.
1681728236859.png

Found that in the end, neither of the two crashes from the tags above happens when starting a full playtest, just battle tests. the items function properly as well. Not the end of the world, but It does end up meaning that battle tuning tests cant take place if an actor is using activate once gear unless i dont intend on being able to use items with them. ill also have to actively not use the equipment as an item if it doesnt have the one one use tag during them. slightly more cumbersome in the long run, but can be worked around.

Afterwards though, I noticed that anyone that doesnt have an activate equip crashes the game with this error whenever they try to access the item menu
1681730221975.png

It seems with the plugin enabled, the game crashes if it has to bring up the item menu with an empty item list. It worked fine with actor 1 because they had the sword in their possession but everyone else caused a crash if an item wasnt picked up prior.

Went back to the main project and reenabled every plugin with these in mind and the behavior was consistent besides the equip menu overlay issue. but the test project didnt have that plugin on it and I still havent set out to determine even if its the issue or some other plugin.

Otherwise, its a great feature to have. Itll take a little bit of cleanup around my database, but it kills the clunky implementation I had before where i had to duplicate skills under a bonus skilltype to sidestep yanfly's classchange preventing me from just adding the skilltype and skill through the default editor traits. If i find any other possible issues later in the week ill bring it up but I'm really liking whats there so far.
@Robro33 Thank you for your detailed post! A few points:

Found that in the end, neither of the two crashes from the tags above happens when starting a full playtest, just battle tests.
This is, unfortunately, very much the case when you start including plugins in your project. Battle test does not do a full database load, so many plugins that modify anything in battle will cause it to not function correctly. Honestly, I'm surprised you haven't noticed any other problems if you're using some number of Yanfly plugins already - best practice is just to use play test with a temporary event that starts a battle.

It seems with the plugin enabled, the game crashes if it has to bring up the item menu with an empty item list.
It actually took me a little bit to reproduce this, but I got it! The original post has an updated download - in my testing, an actor/party with no items displays properly and has no errors if trying to select non-existent items.

Let me know if you come across any other problems. I really can't speak to the battle equip overlay, I don't see why they'd be related.
best practice is just to use play test with a temporary event that starts a battle.
Ah, interesting. I'll keep that in mind in the future then. I hadnt seen an issue involving it up until now but itll save me the embarrassment of contacting people over false positives later.

I was unsure as to if i should have included the bit about the equip menu since it was unlikely that the plugin interacted with it just by its description. But the issue seemingly only popped up after i had added the plugin to the list and I was able to get it to happen a few times once I did. I figured I'd atleast mention it existing but also mention the uncertainty around it and its cause.
I was unsure as to if i should have included the bit...I figured I'd atleast mention it existing
Absolutely! Just to confirm, it's a temporary linger and everything continues to function? Or does it actually make the game get locked on that scene? If the latter, I appreciate anything you can do to give me specific circumstances (or a test project that duplicates it).

@zelanius I think I got it! I got my test project to work with the Galv plugin. It appears to list items correctly and allow you to select them. Please test in your game with the latest download and let me know if you find anything that doesn't work correctly.
Great job @ATT_Turan !
Suggestions for updates: Maybe allow the user to specify the number of times an equip can be used instead of one or infinity.
And while it can likely be done in the damage formula, if there was an eval in there, that would be golden.
(I'd love to pair this with durability!)
Suggestions for updates: Maybe allow the user to specify the number of times an equip can be used instead of one or infinity.
That seconds the request from Puppet, so I'll look into it.

For the eval part: can you elaborate? Charges would require independent items, so would you want all instances of an item to be calculating their charges from the same variable or something? I think I'm not understanding you correctly.
I'd say, limit to the number of times a particular weapon ID could be used that resets each battle (if the dev wants it to reset!) That should circumvent the independent items part.

As for the eval, just a place where someone could inject code when an item is used. (Lunatic mode) So the devs could do more with this plugin without having to edit it.
I'd say, limit to the number of times a particular weapon ID could be used that resets each battle (if the dev wants it to reset!) That should circumvent the independent items part.
That's certainly possible, but I think storing the charges on the item makes more sense from a UX perspective.

Especially if you're talking about the uses persisting between battles, would you look at your item menu and all the swords say 3/5 charges or something?

As for the eval, just a place where someone could inject code when an item is used.
You could actually do this using Yanfly's Skill Core skill phases notetags by checking user.activating

But if you have use for code that's specifically run when it's being activated via , that shouldn't be a difficult addition. I'll look into that 🙂
Sounds good to me.

I don't use skill core, but if it's works for the majority...

Good point on the charges, but if the dev isn't using independent items, it'll be challenging to do. How do you handle the once per battle use?

Overall, great idea. A few tidbits that probably won't be needed so work on it as you like.

We appreciate the work.

Original thread: https://forums.rpgmakerweb.com/threads/activate-equipment.156685/