/*: * @plugindesc v1.00 Star Ocean: The Last Hope - Elemental Item Checks * @author Coolie (William Couillard) * * @param Fire Ring Item ID * @type item * @desc The item that represents the Fire element. * @default 1 * * @param Fire Ring Charges Variable * @type variable * @desc Game variable that tracks Fire Ring's charges. * @default 1 * * @param Ice Ring Item ID * @type item * @desc The item that represents the Ice element. * @default 2 * * @param Ice Ring Charges Variable * @type variable * @desc Game variable that tracks Ice Ring's charges. * @default 2 * * @param Lightning Ring Item ID * @type item * @desc The item that represents the Lightning element. * @default 3 * * @param Lightning Ring Charges Variable * @type variable * @desc Game variable that tracks Lightning Ring's charges. * @default 3 * * @param Water Ring Item ID * @type item * @desc The item that represents the Water element. * @default 4 * * @param Water Ring Charges Variable * @type variable * @desc Game variable that tracks Water Ring's charges. * @default 4 * * @param Earth Ring Item ID * @type item * @desc The item that represents the Earth element. * @default 5 * * @param Earth Ring Charges Variable * @type variable * @desc Game variable that tracks Earth Ring's charges. * @default 5 * * @param Wind Ring Item ID * @type item * @desc The item that represents the Wind element. * @default 6 * * @param Wind Ring Charges Variable * @type variable * @desc Game variable that tracks Wind Ring's charges. * @default 6 * * @param Light Ring Item ID * @type item * @desc The item that represents the Light element. * @default 7 * * @param Light Ring Charges Variable * @type variable * @desc Game variable that tracks Light Ring's charges. * @default 7 * * @param Dark Ring Item ID * @type item * @desc The item that represents the Dark element. * @default 8 * * @param Dark Ring Charges Variable * @type variable * @desc Game variable that tracks Dark Ring's charges. * @default 8 * * @param Ring Max Charges * @type number * @min 1 * @desc The maximum number of charges any ring can have. * @default 20 * * @help * ----------------------------------------------------------------------------- * ABOUT THIS PLUGIN (Star Ocean: The Last Hope Elemental Item Checks) * ----------------------------------------------------------------------------- * In Star Ocean: The Last Hope, players can find a variety of elemental rings * that are required to interact with certain map objects, like doors, chests, * and other objects. Each ring has a limited number of charges and must be * recharged when they run out of them. * * For example, a chest wreathed in flames would require an Ice Ring to break * the seal and open the chest. This would deplete one charge from the ring. * Each ring had a maximum of 20 charges. * * ----------------------------------------------------------------------------- * HOW TO USE * ----------------------------------------------------------------------------- * In a Conditional Branch, select Script and use one of the following: * * HasFireRing * HasIceRing * HasLightningRing * HasWaterRing * HasEarthRing * HasWindRing * HasLightRing * HasDarkRing * * These will return TRUE if the player has the item AND its charges are > 0. * * To check against the number of charges an elemental item has, use a Script * Call, changing the element for the one you want to check. For example: * * FireRingCharges - Returns current charges * FireRingMaxCharges - Returns max charges * * In order to recharge a ring to its maximum charges, use a Plugin Command: * * RechargeFireRing * RechargeIceRing * RechargeLightningRing * RechargeWaterRing * RechargeEarthRing * RechargeWindRing * RechargeLightRing * RechargeDarkRing * * The requirements to recharge an item is up to you. Perhaps it should cost * the player some Gold, or perhaps there should be some other requirement. It's * up to you. * * ----------------------------------------------------------------------------- * PLUGIN PARAMETERS * ----------------------------------------------------------------------------- * Each item has a plugin parameter for the item's ID and an in-game variable * to track the item's current number of charges. The plugin parameters also * allow the user to set a maximum number of charges that is shared by all of * the elemental items. * * ----------------------------------------------------------------------------- * IMPORTANT NOTE!! * ----------------------------------------------------------------------------- * 1. The plugin does not deplete charges on its own. You can easily do this * manually via the Change Variables event command. * 2. You can display the number of charges for a specific elemental item by * using the escape code \v[x] where x is the variable ID tied to the item * in the plugin parameters. * * ----------------------------------------------------------------------------- * TERMS OF USE * ----------------------------------------------------------------------------- * It is OK to use this plugin in both commercial and non-commercial projects. * * Credit is appreciated, but not required. Happy game making! * * ----------------------------------------------------------------------------- * VERSION & UPDATE HISTORY * ----------------------------------------------------------------------------- * > v1.00 : - Initial Release * > September 25, 2025 */ (function() { var parameters = PluginManager.parameters('ElementalItemChecks') || {}; var fireRingId = Number(parameters['Fire Ring Item ID'] || 1); var iceRingId = Number(parameters['Ice Ring Item ID'] || 2); var lightningRingId = Number(parameters['Lightning Ring Item ID'] || 3); var waterRingId = Number(parameters['Water Ring Item ID'] || 4); var earthRingId = Number(parameters['Earth Ring Item ID'] || 5); var windRingId = Number(parameters['Wind Ring Item ID'] || 6); var lightRingId = Number(parameters['Light Ring Item ID'] || 7); var darkRingId = Number(parameters['Dark Ring Item ID'] || 8); var fireRingVar = Number(parameters['Fire Ring Charges Variable'] || 1); var iceRingVar = Number(parameters['Ice Ring Charges Variable'] || 2); var lightningRingVar = Number(parameters['Lightning Ring Charges Variable'] || 3); var waterRingVar = Number(parameters['Water Ring Charges Variable'] || 4); var earthRingVar = Number(parameters['Earth Ring Charges Variable'] || 5); var windRingVar = Number(parameters['Wind Ring Charges Variable'] || 6); var lightRingVar = Number(parameters['Light Ring Charges Variable'] || 7); var darkRingVar = Number(parameters['Dark Ring Charges Variable'] || 8); var maxCharges = Number(parameters['Ring Max Charges'] || 20); function hasRing(itemId, varId) { return $gameParty.hasItem($dataItems[itemId]) && $gameVariables.value(varId) > 0; } function getRingCharges(varId) { return $gameVariables.value(varId); } function setRingCharges(varId, value) { $gameVariables.setValue(varId, Math.max(0, Math.min(value, maxCharges))); } function getMaxCharges() { return maxCharges; } Object.defineProperty(window, 'HasFireRing', { get: function() { return hasRing(fireRingId, fireRingVar); }, configurable: true }); Object.defineProperty(window, 'HasIceRing', { get: function() { return hasRing(iceRingId, iceRingVar); }, configurable: true }); Object.defineProperty(window, 'HasLightningRing', { get: function() { return hasRing(lightningRingId, lightningRingVar); }, configurable: true }); Object.defineProperty(window, 'HasWaterRing', { get: function() { return hasRing(waterRingId, waterRingVar); }, configurable: true }); Object.defineProperty(window, 'HasEarthRing', { get: function() { return hasRing(earthRingId, earthRingVar); }, configurable: true }); Object.defineProperty(window, 'HasWindRing', { get: function() { return hasRing(windRingId, windRingVar); }, configurable: true }); Object.defineProperty(window, 'HasLightRing', { get: function() { return hasRing(lightRingId, lightRingVar); }, configurable: true }); Object.defineProperty(window, 'HasDarkRing', { get: function() { return hasRing(darkRingId, darkRingVar); }, configurable: true }); Object.defineProperty(window, 'FireRingCharges', { get: function() { return getRingCharges(fireRingVar); }, set: function(v) { setRingCharges(fireRingVar, v); }, configurable: true }); Object.defineProperty(window, 'IceRingCharges', { get: function() { return getRingCharges(iceRingVar); }, set: function(v) { setRingCharges(iceRingVar, v); }, configurable: true }); Object.defineProperty(window, 'LightningRingCharges', { get: function() { return getRingCharges(lightningRingVar); }, set: function(v) { setRingCharges(lightningRingVar, v); }, configurable: true }); Object.defineProperty(window, 'WaterRingCharges', { get: function() { return getRingCharges(waterRingVar); }, set: function(v) { setRingCharges(waterRingVar, v); }, configurable: true }); Object.defineProperty(window, 'EarthRingCharges', { get: function() { return getRingCharges(earthRingVar); }, set: function(v) { setRingCharges(earthRingVar, v); }, configurable: true }); Object.defineProperty(window, 'WindRingCharges', { get: function() { return getRingCharges(windRingVar); }, set: function(v) { setRingCharges(windRingVar, v); }, configurable: true }); Object.defineProperty(window, 'LightRingCharges', { get: function() { return getRingCharges(lightRingVar); }, set: function(v) { setRingCharges(lightRingVar, v); }, configurable: true }); Object.defineProperty(window, 'DarkRingCharges', { get: function() { return getRingCharges(darkRingVar); }, set: function(v) { setRingCharges(darkRingVar, v); }, configurable: true }); Object.defineProperty(window, 'FireRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'IceRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'LightningRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'WaterRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'EarthRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'WindRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'LightRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); Object.defineProperty(window, 'DarkRingMaxCharges', { get: function() { return getMaxCharges(); }, configurable: true }); var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); switch (command) { case 'RechargeFireRing': setRingCharges(fireRingVar, maxCharges); break; case 'RechargeIceRing': setRingCharges(iceRingVar, maxCharges); break; case 'RechargeLightningRing': setRingCharges(lightningRingVar, maxCharges); break; case 'RechargeWaterRing': setRingCharges(waterRingVar, maxCharges); break; case 'RechargeEarthRing': setRingCharges(earthRingVar, maxCharges); break; case 'RechargeWindRing': setRingCharges(windRingVar, maxCharges); break; case 'RechargeLightRing': setRingCharges(lightRingVar, maxCharges); break; case 'RechargeDarkRing': setRingCharges(darkRingVar, maxCharges); break; } }; })();