Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Chrono Cross Color Field System, v1.0
udivision
post Mar 24 2011, 09:01 AM
Post #1


Level 12
Group Icon

Group: Revolutionary
Posts: 216
Type: Developer
RM Skill: Skilled




Chrono Cross Color Field
version 1.0
by U Division of ICU Gigasoft


Introduction & Features
-faithfully recreates the skill Color system from the Squaresoft game Chrono Cross
-Each skill is assigned a color (or none at all) through elements, and whenver a skill is used it's "color" is added to the battle's color field. The more of a certain color there is, the more powerful the skill of that color becomes. The field can hold up to a certain number of colors at a time
-An extra bonus (or penalty) if the color field is completely one color

Screenshots


Demo
Color Field Icons
Demo

Script
1
 
#-------------------------------------------------------------------------------
#  Chrono Cross Color Field
#  version 1.0
#  by U-Division of ICU Gigasoft
#
#  What is does:
#  -faithfully recreates the skill Color system from the Squaresoft
#   game Chrono Cross
#  -Each skill is assigned a color (or none at all) through elements,
#   and whenver a skill is used it's "color" is added to the battle's
#   color field. The more of a certain color there is, the more
#   powerful the skill of that color becomes.  The field can hold up
#   to a certain number of colors at a time
#  -An extra bonus (or penalty) if the color field is completely one color
#-------------------------------------------------------------------------------
 
CF_COLOR_BONUS = 0.10
#Rate of increase of power for each color the battler's
#currently used skill on field. Set to 0 to disable.
 
CF_ANTI_PENALTY = 0.10
#Rate of decrease of power for each anti-color of the battler's
#currently used skill's color on field. Set to 0 to disable.
 
CF_FULL_BONUS = 0.50
#The extra bonus given when the color of the battler's skill completely
#fills the field.
 
CF_FULL_PENALTY = 0.50
#The extra subtraction given when the anti-color of the battler's skill
#completely fills the field.
 
 
#Using the ELEMENT ID fill out the hash like this
#   CF_ELEM_COLORS = {
#   element_id => color_id,
#   element_id => color_id,
#   ...
#   }
CF_ELEM_COLORS = {
17 => 0,
18 => 1,
19 => 2,
20 => 3,
21 => 4,
22 => 5,
}
 
CF_FIELD_MAX = 6
#Set this to the number of colors, or however many colors you want to be
#remembered.
 
#Using the COLOR ID (as in not the element ID) fill out the hash like this
#   CF_ELEM_ANTI_COLORS = {
#   color_id => anti_color_id,
#   color_id => anti_color_id,
#   ...
#   }
CF_ELEM_ANTI_COLORS = {
0 => 1,
1 => 0,
2 => 3,
3 => 2,
4 => 5,
5 => 6,
}
module Kernel
  def CF_getColor(element_id)
    id = CF_ELEM_COLORS[element_id]
    id = -1 if id == nil
    return id
  end
 
  def CF_getColorFromSet(elementarray)
  for element_id in elementarray
    id = CF_ELEM_COLORS[element_id]
    id = -1 if id == nil
    return id if id != -1
  end
  return -1
  end
 
  def CF_hasColor?(element_id)
    return (getColor(element_id) != -1)
  end
 
  def CF_antiColor(color)
    return CF_ELEM_ANTI_COLORS[color] if CF_ELEM_ANTI_COLORS.has_key?(color)
    return -1
 end
end
 
#-------------------------------------------------------------------------------
#  RPG::Skill
#  new methods:
#      color(color)      :returns the skills color
#      hasColor?         :returns whether or not the skill has a color
#-------------------------------------------------------------------------------
 
module RPG
  class Skill
   
    def color
      color_elems = []
      for e in element_set
        color_elems.push(e) if CF_ELEM_COLORS.include?(e)
      end
      color_elems.push(0) if color_elems.empty?
      return CF_getColor(color_elems[0])
    end
 
    def hasColor?
      return (color != -1)
    end
   
    end
  end
 
#-------------------------------------------------------------------------------
#  Scene_Battle
#  new methods:
#      add_color(color)      :adds color to color field
#      refresh_color_field   :redraws the icons
#      reset_color_field     :resets color field
#      color_boost(color)    :calculates the damage modifier
#-------------------------------------------------------------------------------
 
class Scene_Battle
  attr_accessor :color_set
  attr_accessor :color_max
 
alias :_orig_main :main
def main
  @color_set = []
  @color_max = CF_FIELD_MAX
  @color_icons = Window_ColorField.new(@color_set)
  _orig_main
  @color_icons.dispose
end
 
def add_color(color)
  if @color_set.size == @color_max
    @color_set.pop
  end
  @color_set.unshift(color)
end
 
def refresh_color_field
    @color_icons.refresh(@color_set)
end
 
def reset_color_field
  @color_set = []
  refresh_color_field
end
 
def color_boost(color)
  mod =  1.00
  count = 0
  anti_count = 0
  anti_color = CF_antiColor(color)
  return mod if @color_set == nil
   for color_field in @color_set
     mod += CF_COLOR_BONUS  if color_field == color
     mod -= CF_ANTI_PENALTY if color_field == anti_color
     count += 1 if color_field == color
     count -= 1 if color_field == anti_color
   end
  mod += CF_FULL_BONUS if count == @color_max
  mod -= CF_FULL_PENALTY if count == -@color_max
  mod = 0.01 if mod < 0.01
 return mod
end
 
end
 
#--------------------------------------------------------------------------
# Game_Battler
#---------------------------------------------------------------------------
class Game_Battler
 
alias :_orig_elements_correct :elements_correct
def elements_correct(element_set)
  weakest = _orig_elements_correct(element_set)
  if $scene.is_a?(Scene_Battle)
    color = CF_getColorFromSet(element_set)
    mod = $scene.color_boost(color)
    weakest = Integer(weakest*mod)
    $scene.add_color(color) if color != -1
    $scene.refresh_color_field
  end
  return weakest
  end
end
 
 
#--------------------------------------------------------------------------
# Window_ColorField
#   Displays the Color icons
#   CF_WINDOW_X = The X Position of the window
#   CF_WINDOW_Y = The Y Position of the window
#--------------------------------------------------------------------------
 
class Window_ColorField < Window_Base
 
  CF_WINDOW_X = 0 #Default is 0
  CF_WINDOW_Y = 0 #Default is 0
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(color_set)
    super(CF_WINDOW_X, CF_WINDOW_Y, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.z -= 10
    refresh(color_set)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(color_set)
    self.contents.clear
    return if color_set == nil
     count = 0
      for i in color_set
       color_image = "CF_" + i.to_s
       bitmap = RPG::Cache.icon(color_image)
       self.contents.blt(x + count*24, y + 4, bitmap, Rect.new(0, 0, 24, 24))
       count += 1
     end
  end
end


Instructions
-YOU NEED A CF_X.png for every color in the ICONS FOLDER (CF_0.png, CF_1.png)
-You can just download my icons unless you want to make your own
-Put script above main

FAQ
N/A

Compatibility
Should be compatible with most battle scripts. Nothing was overwritten.

Credits and Thanks
Square Enix for making the game that inspired this even though I've never played it and dislike most of the endings...

Terms and Conditions
Just give credit if used.


__________________________
Go to the top of the page
 
+Quote Post
   
ASCIIgod
post Jan 24 2012, 08:05 AM
Post #2


Demonic God of Snippets of Doom +10
Group Icon

Group: Revolutionary
Posts: 271
Type: Scripter
RM Skill: Intermediate




would be awesome if VX has it


__________________________

Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 01:00 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker