Jump to content
Sign in to follow this  
estriole

Golden Touch - Estriole Version

Recommended Posts

Effect: Golden Touch - Estriole Version

- Golden Touch effect author : Tsukihime

- Heavily modded by Estriole

credit both if you want to use this script.

free to use in any project.

 

This effect allows you to convert items in your inventory into gold.

The amount of gold received is based on the price of the item times the multiplier of the effect.

 

Estriole Version - history

version 1.1 changes:

- split the script to two script : Effect Scene Core and Effect Golden Touch

i do this so other scene in the future could use the core and work in victor animated battle as well

i rewrite the code to make it possible to use with any scene (not specifically golden touch as before)

see the effect scene core for more information.

- i left the stand alone version too ( the version 1.0 ) if anyone want to use that instead (if they don't use the core for other scene)

 

version 1.0 changes:

 

 

- did not return to map/battle but stay in the same scene for more 'touching'

- use yanfly gab window to show the money gained

- can be used as regular scene by using script call:

SceneManager.call(Scene_GoldenTouch)

if used as regular scene it will use 1.0 as multiplier by default. to change this script call:

$game_temp.golden_touch_multiplier = x

where x is float or integer.

 

if used in skill effect. it will ignore above setting and use the skill effect tag

 

- can be used with normal battle system (need patch to remove the emerges message)

i split it in separate script so if you don't use normal battle system you must not add it.

 

- can be used with victor animated battle (even combined with yanfly ace battle engine and moghunter popup damage)

 

- compatibility written for these script:

> compatibility with moghunter popup damage script

> compatibility with yami combo count script

> compatibility with yanfly enemy hp bar script

> compatibility with mog wallpaper ex script

 

 

 

 

Known Bug

the only thing is... it erase all the action done after the actor using the golden touch scene. so make sure to set the golden touch skill speed fix to -2000 to make the skill come out last (so basically no action were erased).

it caused by changing scene back from scene golden touch to scene battle (no battle system fully support scene changing yet i think)

 

Download

 

Script:

Effect - Golden Touch - Estriole Version

need Effect Scene Core

 

 


=begin

#==============================================================================

** Effect: Golden Touch

Author: Tsukihime

Date: Oct 30, 2012

HEAVILY MODDED by Estriole (almost rewrite it in fact >.<)

you must credit me Tsukihime and Estriole if you're using it

 

requirement :

-Tsukihime Effect Manager

(http://xtsukihime.wordpress.com/2012/10/05/effects-manager)

-Yanfly Gab Window

-Estriole Effect Scene Core

 

------------------------------------------------------------------------------

** Change log

v1.1 Nov 05, 2012

- Split the script and make the Effect Scene Core so now any scene

can work fine in victor animated battle (of course must be set the last

skill executed). with the core scene equip, scene party could be possible

to use with victor animated battle

- Estriole effect scene core also repair problem with turn restart to 1

v1.0 Nov 04, 2012

- modded so it can work as normal scene call

- heavily modded so work in battle using victor animated battle

(but don't forget to set the speed fix to make the skill act last)

- compatibility with moghunter popup damage script

- compatibility with yami combo count script

- compatibility with yanfly enemy hp bar script

- compatibility with mog wallpaper ex script

 

v0.1 Nov 03, 2012

- modded by estriole

 

Oct 30, 2012

- initial release

------------------------------------------------------------------------------

** Terms of Use

* Free to use in commercial/non-commercial projects

* 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

-Tsukihime Effect Manager

(http://xtsukihime.wordpress.com/2012/10/05/effects-manager)

-Yanfly Gab Window

-Estriole Effect Scene Core

------------------------------------------------------------------------------

** 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

<eff: golden_touch x>

 

Where x is some float representing the gold multiplier

 

estriole mod - could become scene

can be used as scene also (for sell only shop event?)

- golden touch also could be called as scene by using script call

SceneManager.call(Scene_GoldenTouch)

by default it will use 1.0 multiplier if you want to change that

use script call:

$game_temp.golden_touch_multiplier = x

where x is float or integer

if the scene called by skill using effect notetag above. the multiplier will

follow the skill setting instead and ignore other.

 

estriole mod - use in victor animated battle

set the notetags. then set the skill speed fix to make the skill act last

because after returning from scene any action after the actor calling the

scene will not executed.

and if you're using other script that i'm not making compatibility with...

the compatibility i made is only for hiding the naughty images that still

shown when changing scene (because i don't dispose them - because i can't)

 

so if you're planning make compatibility yourself... (since i maybe

won't make it if i'm not using that script)

 

remember that you must not dispose any object that shown in the battle if you can.

you must just change the visible to false or opacity to 0 (depending the type).

 

#==============================================================================

=end

module Effects

module Golden_Touch

Effect_Manager.register_effect(:golden_touch, 1.6)

end

end

 

module ESTRIOLE

TEXT_GOLDEN_TOUCH_GAINED_MONEY = "You reconstruct %s and turn it to %d %s!"

#by order %s %d %s -> item name, money number, gold vocab

TEXT_GOLDEN_TOUCH_CANNOT_CONVERT = "<cannot reconstruct>"

TEXT_GOLDEN_TOUCH_VALUE_SHOW = "%s\nValue: %d gold"

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_Temp

attr_accessor :golden_touch_multiplier

end

 

class Game_Battler < Game_BattlerBase

 

def item_effect_golden_touch_global(effect)

SceneManager.call(Scene_GoldenTouch)

SceneManager.scene.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 false if item.is_a?(RPG::Item) && item.price == 0 #will not convert item with 0 price

return true

end

 

# Let's just show the price of the item

def update_help

return unless item

name = item.name

if item.price == 0 || item.key_item?

@help_window.set_text(ESTRIOLE::TEXT_GOLDEN_TOUCH_CANNOT_CONVERT)

else

text = sprintf(ESTRIOLE::TEXT_GOLDEN_TOUCH_VALUE_SHOW,name,item.price)

@help_window.set_text(text)

end

end

end

 

# A new scene for selecting an item for the effect

 

class Scene_GoldenTouch < Scene_Item

 

def effect_scene_mark

return true

end

 

def return_scene

effect_return_scene

end

 

def create_item_window

wy = @category_window.y + @category_window.height

wh = Graphics.height - wy

@gab_window = Window_Gab.new

@gab_window.z = 200 #to put the order on top other window

@gab_window.y += 300 #move the gab window to bottom

@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)

elsif $game_temp.golden_touch_multiplier

effect_golden_touch($game_temp.golden_touch_multiplier)

else

effect_golden_touch(1.0)

end

@item_window.refresh

@item_window.activate

#back to window after converting one item for more converting

end

 

def effect_golden_touch(rate = 1)

return if item.nil? #escape code when you convert the last of the item and click again

gained = item.price * rate

gained = item.price * @effect.value1[0] if @effect_callback

name = item.name

$game_party.gain_gold(gained.to_i)

$game_party.lose_item(item, 1)

text = sprintf(ESTRIOLE::TEXT_GOLDEN_TOUCH_GAINED_MONEY,name,gained.to_i,Vocab.currency_unit)

@gab_window.clear

@gab_window.setup(text,nil,nil)

 

end

end

 

 

 

 

 

Effect - Golden Touch - Estriole Version - Standalone version

doesn't need scene core

 

 


=begin

#==============================================================================

** Effect: Golden Touch

Author: Tsukihime

Date: Oct 30, 2012

HEAVILY MODDED by Estriole (almost rewrite it in fact >.<)

you must credit me Tsukihime and Estriole if you're using it

 

requirement : yanfly gab window script

------------------------------------------------------------------------------

** Change log

Nov 04, 2012

- modded so it can work as normal scene call

- heavily modded so work in battle using victor animated battle

(but don't forget to set the speed fix to make the skill act last)

- compatibility with moghunter popup damage script

- compatibility with yami combo count script

- compatibility with yanfly enemy hp bar script

- compatibility with mog wallpaper ex script

 

Nov 03, 2012

- modded by estriole

 

Oct 30, 2012

- initial release

------------------------------------------------------------------------------

** Terms of Use

* Free to use in commercial/non-commercial projects

* 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://xtsukihime.wordpress.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

<eff: golden_touch x>

 

Where x is some float representing the gold multiplier

 

estriole mod - could become scene

can be used as scene also (for sell only shop event?)

- golden touch also could be called as scene by using script call

SceneManager.call(Scene_GoldenTouch)

by default it will use 1.0 multiplier if you want to change that

use script call:

$game_temp.golden_touch_multiplier = x

where x is float or integer

if the scene called by skill using effect notetag above. the multiplier will

follow the skill setting instead and ignore other.

 

estriole mod - use in victor animated battle

set the notetags. then set the skill speed fix to make the skill act last

because after returning from scene any action after the actor calling the

scene will not executed.

and if you're using other script that i'm not making compatibility with...

the compatibility i made is only for hiding the naughty images that still

shown when changing scene (because i don't dispose them - because i can't)

 

so if you're planning make compatibility yourself... (since i maybe

won't make it if i'm not using that script)

 

remember that you must not dispose any object that shown in the battle if you can.

you must just change the visible to false or opacity to 0 (depending the type).

 

#==============================================================================

=end

module Effects

module Golden_Touch

Effect_Manager.register_effect(:golden_touch, 1.6)

end

end

 

module ESTRIOLE

TEXT_GOLDEN_TOUCH_GAINED_MONEY = "You reconstruct %s and turn it to %d %s!"

#by order %s %d %s -> item name, money number, gold vocab

TEXT_GOLDEN_TOUCH_CANNOT_CONVERT = "<cannot reconstruct>"

TEXT_GOLDEN_TOUCH_VALUE_SHOW = "%s\nValue: %d gold"

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_Temp

attr_accessor :golden_touch_multiplier

end

 

class Game_Battler < Game_BattlerBase

 

def item_effect_golden_touch_global(effect)

SceneManager.call(Scene_GoldenTouch)

SceneManager.scene.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 false if item.is_a?(RPG::Item) && item.price == 0 #will not convert item with 0 price

return true

end

 

# Let's just show the price of the item

def update_help

return unless item

name = item.name

if item.price == 0 || item.key_item?

@help_window.set_text(ESTRIOLE::TEXT_GOLDEN_TOUCH_CANNOT_CONVERT)

else

text = sprintf(ESTRIOLE::TEXT_GOLDEN_TOUCH_VALUE_SHOW,name,item.price)

@help_window.set_text(text)

end

end

end

 

# A new scene for selecting an item for the effect

 

class Scene_GoldenTouch < Scene_Item

 

def return_scene

if SceneManager.last_scene.is_a?(Scene_Battle)

#mog wallpaper ex

if $mog_rgss3_wallpaper_ex == true

@background_sprite.bitmap = nil if @background_sprite.is_a?(Plane)

@particle_bitmap.each {|sprite| sprite.visible = false }

end

#hide all golden touch window (they will disposed after battle end)

instance_variables.each do |varname|

ivar = instance_variable_get(varname)

ivar.visible = false if ivar.is_a?(Window)

end

end

 

SceneManager.return #return scene

 

if SceneManager.scene_is?(Scene_Battle)

#if victor animated battle then need this line below executed :D

SceneManager.scene.return_from_golden if $imported[:ve_animated_battle]

end

end

 

def create_item_window

wy = @category_window.y + @category_window.height

wh = Graphics.height - wy

@gab_window = Window_Gab.new

@gab_window.z = 200 #to put the order on top other window

@gab_window.y += 300 #move the gab window to bottom

@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)

elsif $game_temp.golden_touch_multiplier

effect_golden_touch($game_temp.golden_touch_multiplier)

else

effect_golden_touch(1.0)

end

@item_window.refresh

@item_window.activate

#back to window after converting one item for more converting

end

 

def effect_golden_touch(rate = 1)

return if item.nil? #escape code when you convert the last of the item and click again

gained = item.price * rate

gained = item.price * @effect.value1[0] if @effect_callback

name = item.name

$game_party.gain_gold(gained.to_i)

$game_party.lose_item(item, 1)

text = sprintf(ESTRIOLE::TEXT_GOLDEN_TOUCH_GAINED_MONEY,name,gained.to_i,Vocab.currency_unit)

@gab_window.clear

@gab_window.setup(text,nil,nil)

 

end

end

 

 

class Spriteset_Battle

 

#--------------------------------------------------------------------------

# â— Dispose yea enemy hp bar

#--------------------------------------------------------------------------

def hide_enemy_hp_gauges

if $imported["YEA-EnemyHPBars"] == true

battler_sprites.each {|sprite| sprite.hide_enemy_hp_gauges }

end

end

 

end

 

class Sprite_Battler < Sprite_Base

 

def hide_enemy_hp_gauges

if $imported["YEA-EnemyHPBars"] == true

@back_gauge_viewport.visible = false if @back_gauge_viewport

@hp_gauge_viewport.visible = false if @hp_gauge_viewport

end

end

 

end

 

class Scene_Battle < Scene_Base

 

def return_from_golden

#basicly main but without create spriteset

create_all_windows

post_start

update until scene_changing?

pre_terminate

terminate

end

 

alias golden_touch_terminate terminate

def terminate

#if from scene battle go to golden touch. dispose only battle log

#and hide all window and other visual effect

if SceneManager.scene.is_a?(Scene_GoldenTouch)

#dispose the battle log

dispose_battle_log_and_hide_other_windows

 

#moghunter pop up damage

@spriteset.dispose_damage_sprites if $mog_rgss3_damage_pop == true

#yanfly enemy hp bar

@spriteset.hide_enemy_hp_gauges if $imported["YEA-EnemyHPBars"] == true

#yami combo count

if $imported["YSE-PartyComboCounter"] == true

SceneManager.last_scene.sprite_combo_count.opacity = 0

SceneManager.last_scene.sprite_combo_damage.opacity = 0

SceneManager.last_scene.sprite_combo_congrat.opacity = 0

end

#finish

return

end

golden_touch_terminate

end

 

def dispose_battle_log_and_hide_other_windows

instance_variables.each do |varname|

ivar = instance_variable_get(varname)

ivar.visible = false if ivar.is_a?(Window)

ivar.dispose if ivar.is_a?(Window_BattleLog)

end

end

 

 

end

 

 

module WALLPAPER_EX

 

def dispose_background

@background_sprite.bitmap.dispose if @background_sprite.bitmap

@background_sprite.dispose if @background_sprite

end

 

end

 

 

 

module SceneManager

 

#new method to see what the previous scene is

def self.last_scene

return nil if !@stack

return @stack[@stack.size-1] if @stack.size > 0

return nil

end

 

 

end

 

 

 

 

 

Normal Battle Patch (remove emerges messages when returning from scene golden touch only) - stand alone version

 

 


 

#snippet for golden touch effect. to remove emerges message when

module BattleManager

 

def self.battle_restart

$game_party.on_battle_start

$game_troop.on_battle_start

wait_for_message

end

 

end

 

class Scene_GoldenTouch < Scene_Item

alias normal_battle_remove_emerges_return_scene return_scene

def return_scene

$from_effect_scene = true

normal_battle_remove_emerges_return_scene

end

end

 

 

class Scene_Battle < Scene_Base

def battle_start

 

case $from_effect_scene

when true

BattleManager.battle_restart

else

BattleManager.battle_start

end

 

$from_effect_scene = false

 

process_event

start_party_command_selection

end

end

 

 

 

 

 

Required: Effect Manager

Required: Yanfly Gab Windows

Required: Effect Scene Core

Usage

 

Tag your item/skill with

 

<eff: golden_touch x>

 

Where `x` is the gold multiplier

 

Screenshots

 

Here is a simple sequence of events

 

selecting golden touch skill in battle

selectingthegoldenskill.png

 

entering golden touch scene

enteringthesceneafterhi.png

 

 

touch touch touch for money

convertsomethingformone.png

 

returning to battle after touching :D

pressescapeandreturntob.png

 

 

ps: i use mog wallpaper ex, yanfly ace item menu in screen shot to show that custom item scene could work.

Edited by estriole

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×