=begin #============================================================================== ** Effect: Golden Touch Author: Hime Date: Nov 28, 2012 ------------------------------------------------------------------------------ ** Change log Nov 28, 2012 - updated to new global effect specs Oct 31, 2012 - changed global method name as specified by the effect manager Oct 30, 2012 - initial release ------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Preserve this header ------------------------------------------------------------------------------ ** Required -Effect Manager (http://himeworks.com/2012/10/05/effects-manager) ------------------------------------------------------------------------------ ** Description This script adds a "golden touch" effect to your skill. When this effect is activated, you can select an item from your inventory and turn it into gold. The amount of gold received is based on the price of the item times the multiplier of the effect. Tag your item/skills with Where x is some float representing the gold multiplier #============================================================================== =end module Effects module Golden_Touch Effect_Manager.register_effect(:golden_touch, 2.0) end end class RPG::UsableItem # Check whether the operator is valid def add_effect_golden_touch(code, data_id, args) args[0] = args[0] ? args[0].to_f : 1 add_effect(code, data_id, args) end end class Game_Battler < Game_BattlerBase def item_effect_golden_touch_global(obj, effect) SceneManager.call(Scene_GoldenTouch) SceneManager.set_effect_callback(:effect_golden_touch, effect) end end # Just a custom window for my effect class Window_ItemList_GoldenTouch < Window_ItemList # everything should be available for almost everything def enable?(item) return false if item.is_a?(RPG::Item) && item.key_item? return true end # Let's just show the price of the item def update_help return unless item @help_window.set_text("Value: %d gold" %item.price) end end # A new scene for selecting an item for the effect class Scene_GoldenTouch < Scene_Item def create_item_window wy = @category_window.y + @category_window.height wh = Graphics.height - wy @item_window = Window_ItemList_GoldenTouch.new(0, wy, Graphics.width, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @category_window.item_window = @item_window end def on_item_ok if @effect_callback send(@effect_callback) else super end end def effect_golden_touch gained = item.price * @effect.value1[0] $game_party.gain_gold(gained) $game_party.lose_item(item, 1) $game_message.add("Received %d %s!" %[gained, Vocab.currency_unit]) # this is pretty bad coding since you might not want to go to either of these $game_party.in_battle ? SceneManager.goto(Scene_Battle) : SceneManager.goto(Scene_Map) end end