Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============================================================================
- #VTS-Elemental Charge Fields (with Charge Skill Evolution)
- #By Ventwig
- #Version 1.21 - Mar 22 2014
- #For RPGMaker VX Ace
- #Thanks Selchar and Tsukihime for the help!
- #=============================================================================
- # Description:
- # This script adds an extra dynamic to elements for both players and enemies
- # alike. When a skill of an element is used, its "charge" will raise, and,
- # if desired, the opposing element's "charge" will drop. That charge counts
- # as a damage multiplier, and it can even nullify or drain damage of a certain
- # element if its charge drops low enough.
- # The new Charge Skill Evolution feature (from Tales of The Abyss's Field
- # of Fonons Change) allows a skill to change into a more powerful form
- # under certain conditions based on the fields.
- #==============================================================================
- # Compatability:
- # I'd say it's pretty high!
- # It works with Battle Symphony, and YEA because it's only an add-on to battles,
- # so have fun!
- #===============================================================================
- # Instructions: Put in materials, above main. You need to set the elements/icons!
- #==============================================================================
- # Please give Credit to Ventwig if you would like to use one of my scripts!
- # Use it commericial or non-commercial, and feel free to tell me if you're using
- # it commercially!
- # You may edit my scripts, just don't claim as your own!
- #===============================================================================
- #===============================================================================
- # How to Change Charge Value (Skill Notetags)
- #===============================================================================
- # <charge_value x>
- # x = amount to increase charge (make a negative to decrease) (number)
- # If you want to make certain skills worth more in charge fields, this notetag
- # lets you make some skills strengthen fields better. Negatives weaken fields.
- # These override the default for said skill.
- #===============================================================================
- # How to Set up a Charge Skill Evolution (Skill Notetags)
- #===============================================================================
- # If you do not like the CSE idea, simply do not use these notetags
- #===============================================================================
- # <evolution_element x>
- # x = element id (the number)
- # Set the element ID for the CSE. This means that this element will
- # need the specidic value (or default if you use that) in order to CSE.
- # Please be careful and don't set it to an element without a Charge Field,
- # as that will have no effect.
- #
- # <evolution_charge x>
- # x = required charge value
- # Set a number for the CSE. This means that the element (specified using
- # the notetag above or using the default setting) will need a value equal to or
- # greater than x in order to FOFChange.
- #
- # <evolution_skill x>
- # x = skill id (the number)
- # Set the skill to CSE into. Simple enough, if the conditions are met,
- # then this skill will be used instead.
- #*******************************************************************************
- # IT IS IMPERATIVE to make sure the MP/TP costs are equal to/less than the
- # original skill. This script does not check for that and will bug if
- # the player doesn't have enough MP to use the new skill.
- #===============================================================================
- module VTS_ECF
- #This means whether or not elements across from each other will "oppose"
- #each other. If set to true, using a fire attack will raise fire charge
- #and lower ice. False will just raise fire.
- #True/False Def:True
- COUNTER_CHARGE = true
- #The default amount an attack will raise/lower the fields
- #Def: 10
- CHARGE_VALUE = 10
- #The ID number of the desired elements. In "Terms" in the database, there's
- #the area where you can edit elements. The ID is the number beside them.
- #Def: 3,4,5,8,6,7,9,10 (Fire,Ice,Thunder,Wind,Water,Stone,Light,Dark)
- #NOTE:If you are using opposing elements, then the opposing pairs are:
- # 1/2 and 3/4 (so on), 1/2 will not alter 3/4, 3/4 will not alter 1/2.
- ELE1 = 3
- ELE2 = 4
- ELE3 = 5
- ELE4 = 8
- #========
- # Don't want 8 elements? Simply change the number to "nil" w/o brackets!
- # (min 4 elements, max 8)
- #=======
- ELE5 = nil
- ELE6 = nil
- ELE7 = nil
- ELE8 = nil
- #How wide the window should be.
- #Recommended
- #4 elements: 100
- #6 elements: 160
- #8 elements: 200
- WIDTH = 100
- #The icon numbers for the elements. These are in sync with the numbers
- #for element id above, so just shove in the icons you want!
- #Def: 96,97,98,101,99,100,102,103
- EIC1 = 96
- EIC2 = 97
- EIC3 = 98
- EIC4 = 101
- EIC5 = 99
- EIC6 = 100
- EIC7 = 102
- EIC8 = 103
- #The icon showing "opposing elements", acting as the connector between them.
- #Put 0 if you don't want one (like if you don't use opposing elements)
- #Def:115
- LIC = 115
- #The X and Y placement of the window. Easy enough.
- #Def: Graphics.width - 200, 0
- #I recommend keeping X like this, making the number equal to width. Y can be whatever.
- X = Graphics.width - 100
- Y = 0
- #=============================================================================
- #Charge Skill Evolution
- #=============================================================================
- DEF_CSE_ELEMENT = 3
- #If an element is not set to a skill with a CSE,
- #this is the element ID it will be given
- DEF_CSE_CHARGE = 120
- #If no charge amount is specified for a skill with a
- #CSE, this is the required amount
- CSE_TEXT = "FoF Change!"
- #The text said when announcing the new change
- CSE_TEXT_SKILL = false
- #Display the skill name after the text above? True/false
- #(It shows the traditional (Eric used FIREAGA! Afterwards)
- end
- #############################################################################
- class Game_Battler < Game_BattlerBase
- def make_damage_value(user, item)
- value = item.damage.eval(user, self, $game_variables)
- value *= item_element_rate(user, item)
- value *= pdr if item.physical?
- value *= mdr if item.magical?
- value *= rec if item.damage.recover?
- value = value*$vts_elechrg1/100 if item.damage.element_id == VTS_ECF::ELE1
- value = value*$vts_elechrg2/100 if item.damage.element_id == VTS_ECF::ELE2
- value = value*$vts_elechrg3/100 if item.damage.element_id == VTS_ECF::ELE3
- value = value*$vts_elechrg4/100 if item.damage.element_id == VTS_ECF::ELE4
- if $vts_elechrg5 != nil
- value = value*$vts_elechrg5/100 if item.damage.element_id == VTS_ECF::ELE5
- end
- if $vts_elechrg6 != nil
- value = value*$vts_elechrg6/100 if item.damage.element_id == VTS_ECF::ELE6
- end
- if $vts_elechrg7 != nil
- value = value*$vts_elechrg7/100 if item.damage.element_id == VTS_ECF::ELE7
- end
- if $vts_elechrg8 != nil
- value = value*$vts_elechrg8/100 if item.damage.element_id == VTS_ECF::ELE8
- end
- value = apply_critical(value) if @result.critical
- value = apply_variance(value, item.damage.variance)
- value = apply_guard(value)
- @result.make_damage(value.to_i, item)
- end
- end
- class Window_ElementCharge < Window_Base
- def initialize(x,y,width,height)
- super
- self.z = 0
- draw_elements
- set_values
- draw_value
- end
- def set_values
- @val1 = $vts_elechrg1
- @val2 = $vts_elechrg2
- @val3 = $vts_elechrg3
- @val4 = $vts_elechrg4
- @val5 = $vts_elechrg5 if $vts_elechrg5 != nil
- @val6 = $vts_elechrg6 if $vts_elechrg6 != nil
- @val7 = $vts_elechrg7 if $vts_elechrg7 != nil
- @val8 = $vts_elechrg8 if $vts_elechrg8 != nil
- end
- def draw_elements
- draw_icon(VTS_ECF::EIC1,0,0,enabled=true) #Fire
- draw_icon(VTS_ECF::EIC2,0,93,enabled=true) #Ice
- draw_icon(VTS_ECF::EIC3,50,0,enabled=true) #Thunder
- draw_icon(VTS_ECF::EIC4,50,93,enabled=true) #Wind
- draw_icon(VTS_ECF::LIC,0,50,enabled=true) #Fire
- draw_icon(VTS_ECF::LIC,50,50,enabled=true) #Fire
- draw_icon(VTS_ECF::EIC5,100,0,enabled=true) if $vts_elechrg5 != nil
- draw_icon(VTS_ECF::EIC6,100,93,enabled=true) if $vts_elechrg6 != nil
- draw_icon(VTS_ECF::EIC7,150,0,enabled=true) if $vts_elechrg7 != nil
- draw_icon(VTS_ECF::EIC8,150,93,enabled=true) if $vts_elechrg8 != nil
- draw_icon(VTS_ECF::LIC,100,50,enabled=true) if $vts_elechrg6 != nil
- draw_icon(VTS_ECF::LIC,150,50,enabled=true) if $vts_elechrg8 != nil
- end
- def draw_value
- draw_text(0,20,40,32,@val1)
- draw_text(0,70,40,32,@val2)
- draw_text(45,20,40,32,@val3)
- draw_text(45,70,40,32,@val4)
- draw_text(100,20,40,32,@val5)if $vts_elechrg5 != nil
- draw_text(100,70,40,32,@val6)if $vts_elechrg6 != nil
- draw_text(145,20,40,32,@val7)if $vts_elechrg7 != nil
- draw_text(145,70,40,32,@val8)if $vts_elechrg8 != nil
- end
- def refresh
- contents.clear
- draw_elements
- set_values
- draw_value
- end
- def update
- refresh if $vts_elechrg1 != @val1
- refresh if $vts_elechrg2 != @val2
- refresh if $vts_elechrg3 != @val3
- refresh if $vts_elechrg4 != @val4
- refresh if $vts_elechrg5 != @val5 and $vts_elechrg5 != nil
- refresh if $vts_elechrg6 != @val6 and $vts_elechrg6 != nil
- refresh if $vts_elechrg7 != @val7 and $vts_elechrg7 != nil
- refresh if $vts_elechrg8 != @val8 and $vts_elechrg8 != nil
- end
- end
- class Scene_Battle < Scene_Base
- alias ele_charge_start start
- def start
- ele_charge_start
- $vts_elechrg1 = 100
- $vts_elechrg2 = 100
- $vts_elechrg3 = 100
- $vts_elechrg4 = 100
- $vts_elechrg5 = 100 if VTS_ECF::ELE5 != nil
- $vts_elechrg6 = 100 if VTS_ECF::ELE6 != nil
- $vts_elechrg7 = 100 if VTS_ECF::ELE7 != nil
- $vts_elechrg8 = 100 if VTS_ECF::ELE8 != nil
- end
- alias element_charge_create_all_windows create_all_windows
- def create_all_windows
- element_charge_create_all_windows
- create_element_window
- end
- def create_element_window
- @element_window = Window_ElementCharge.new(VTS_ECF::X,VTS_ECF::Y,VTS_ECF::WIDTH,150)
- end
- alias element_charge_use_item use_item
- def use_item
- item = @subject.current_action.item
- if item.is_a?(RPG::Skill)
- @charge_element = item.damage.element_id
- adjust_element_charge(@charge_element, item)
- end
- element_charge_use_item
- end
- def adjust_element_charge(element, skill)
- if element == VTS_ECF::ELE1
- $vts_elechrg1 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg2 -= skill.charge_value
- end
- end
- if element == VTS_ECF::ELE2
- $vts_elechrg2 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg1 -= skill.charge_value
- end
- end
- if element == VTS_ECF::ELE3
- $vts_elechrg3 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg4 -= skill.charge_value
- end
- end
- if element == VTS_ECF::ELE4
- $vts_elechrg4 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg3 -= skill.charge_value
- end
- end
- if $vts_elechrg5 != nil
- if element == VTS_ECF::ELE5
- $vts_elechrg5 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg6 -= skill.charge_value
- end
- end
- end
- if $vts_elechrg5 != nil
- if element == VTS_ECF::ELE6
- $vts_elechrg6 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg5 -= skill.charge_value
- end
- end
- end
- if $vts_elechrg5 != nil
- if element == VTS_ECF::ELE7
- $vts_elechrg7 +=skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg8 -= skill.charge_value
- end
- end
- end
- if $vts_elechrg5 != nil
- if element == VTS_ECF::ELE8
- $vts_elechrg8 += skill.charge_value
- if VTS_ECF::COUNTER_CHARGE
- $vts_elechrg7 -= skill.charge_value
- end
- end
- end
- end
- end
- #===============================================================================
- #FOF CHANGE
- #===============================================================================
- module RPG
- class BaseItem
- def fofc_element
- if @fofc_element.nil?
- if @note =~ /<evolution_element (.*)>/i
- @fofc_element= $1.to_i
- else
- @fofc_element = VTS_ECF::DEF_CSE_ELEMENT
- end
- end
- @fofc_element
- end
- def fofc_charge
- if @fofc_charge.nil?
- if @note =~ /<evolution_charge (.*)>/i
- @fofc_charge= $1.to_i
- else
- @fofc_charge = VTS_ECF::DEF_CSE_CHARGE
- end
- end
- @fofc_charge
- end
- def fofc_skill
- if @fofc_skill.nil?
- if @note =~ /<evolution_skill (.*)>/i
- @fofc_skill= $1.to_i
- else
- @fofc_skill = 0
- end
- end
- @fofc_skill
- end
- def charge_value
- if @charge_value.nil?
- if @note =~ /<charge_value (.*)>/i
- @charge_value= $1.to_i
- else
- @charge_value = VTS_ECF::CHARGE_VALUE
- end
- end
- @charge_value
- end
- end
- end
- class Game_Action
- attr_accessor :old_skill
- end
- class Game_Battler < Game_BattlerBase
- def get_new_skill
- return unless current_action.item.is_a?(RPG::Skill)
- quest_skill = current_action.item
- if quest_skill.fofc_skill != 0
- if quest_skill.fofc_element == VTS_ECF::ELE1
- if $vts_elechrg1 >= quest_skill.fofc_charge
- current_action.set_skill(quest_skill.fofc_skill)
- current_action.old_skill = quest_skill
- $vts_elechrg1 = 100
- end
- end
- if quest_skill.fofc_element == VTS_ECF::ELE2
- if $vts_elechrg2 >= quest_skill.fofc_charge
- current_action.set_skill(quest_skill.fofc_skill)
- current_action.old_skill = quest_skill
- $vts_elechrg1 = 100
- end
- end
- if quest_skill.fofc_element == VTS_ECF::ELE3
- if $vts_elechrg3 >= quest_skill.fofc_charge
- current_action.set_skill(quest_skill.fofc_skill)
- current_action.old_skill = quest_skill
- $vts_elechrg1 = 100
- end
- end
- if quest_skill.fofc_element == VTS_ECF::ELE4
- if $vts_elechrg4 >= quest_skill.fofc_charge
- current_action.set_skill(quest_skill.fofc_skill)
- current_action.old_skill = quest_skill
- $vts_elechrg1 = 100
- end
- end
- end
- end
- end # Game_Battler
- class Window_BattleLog < Window_Selectable
- alias vts_fofchange_display_use_item display_use_item
- def display_use_item(subject, item)
- if item.is_a?(RPG::Skill)
- if subject.current_action.old_skill != nil
- name = subject.name
- change_text = VTS_ECF::CSE_TEXT
- skill_name = item.name + '!'
- use_name = subject.current_action.old_skill.message1
- old_skill_text = name + use_name
- add_text(old_skill_text)
- wait
- if VTS_ECF::CSE_TEXT_SKILL == true
- new_skill_text = change_text + skill_name
- else
- new_skill_text = change_text
- end
- add_text(new_skill_text)
- wait
- end
- end
- vts_fofchange_display_use_item(subject, item)
- subject.current_action.old_skill = nil
- end
- end
- class Scene_Battle < Scene_Base
- alias scene_battle_use_item_new use_item
- def use_item
- @subject.get_new_skill
- scene_battle_use_item_new
- end
- end # Scene_Battle
Advertisement
Add Comment
Please, Sign In to add comment