Can someone help edit this script so that there are no bars that overfill the bar, and that you can put a point into a stat one at a time, and if anyone is generous enough could somebody make it so when a stat get's to 60, the yellow bars at the starting start to turn red as you raise the stat, like overlaping until it maxes out at 120? if you don't get what I'm saying then just pm me or post it here.
Here is the script
here is the problem with the red bars overlapping the text
I'd really appreciate it if anyone could help me out with this, I'm not much of a scripter, more of a spriter though... Thanks to anyone who helps.
Thank you and have a nice day!
Here is the script
Code:
module DPD
#===============================================================================
# Script By: PandoraShock(azrith001)
# Date Made: 6/6/2010
# Script Orginal Idea: zchin131
# Script Name: Dryad_Point_Distributer (DPD)
#===============================================================================
# Description:
# This System is a new type of point system based off chance,
# the points are gained in a chance amount from 1-5.
#===============================================================================
module DPD
#---------------------------------------------------
# Config
#---------------------------------------------------
ImgSet = {} # Don't Change only change whats in the " "
ImgSet[0] = "point_dis_back" # Background Image
ImgSet[1] = "point_meter" # This is the point meter image is in a set
#---------------------------------
FaceSet = {}
#FaceSet[actor id] = "file in pictures folder"
FaceSet[1] = "face01"
FaceSet[2] = "face01"
FaceSet[7] = "face01"
FaceSet[8] = "face01"
#---------------------------------
BaseCost = {} # Don't Change
BaseCost[0] = 1 # Hp Base Cost
BaseCost[1] = 1 # Mp/Sp Base Cost
BaseCost[2] = 1 # Strength Base Cost
BaseCost[3] = 1 # Dexterity Base Cost
BaseCost[4] = 1 # Agility Base Cost
BaseCost[5] = 1 # Wisdom/Int Base Cost
#----------
# This is the Multiplier of all costs IE:
# At level 10 the cost of hp, Cost = 10 + Level * 2 = 40
# To use multiplier Max Point should be set to 5000
# Else Set the Multiplier to 1
BaseCost[6] = 1
#---------------------------------
BaseGain = {} # Don't Change
BaseGain[0] = 1 # Hp Base Gained
BaseGain[1] = 1 # Mp/Sp Base Gained
BaseGain[2] = 1 # Strength Base Gained
BaseGain[3] = 1 # Dexterity Base Gained
BaseGain[4] = 1 # Agility Base Gained
BaseGain[5] = 1 # Wisdom/Int Base Gained
#--------------
BaseGain[6] = 1 # Multiplier: works like Base Cost one.
#---------------------------------
MaxPoints = 999 # Max Points you can Gain
Chance = true # Set to true if you don't want to use Just Base points
BaseGainedPoints = 3 # This is the base amount of points gained
BarLength = 60 # Length in Squares (Default = 59)
#---------------------------------
# Stat Caps
StatCap = {}
StatCap[0] = 60 #HP
StatCap[1] = 60 #SP
StatCap[2] = 60 #STR
StatCap[3] = 60 #DEX
StatCap[4] = 60 #AGI
StatCap[5] = 60 #INT
#---------------------------------
# Base points gained:
# The Base Amount of points gained + chance
# Will set up an imaginary set of dice that role
# apon leveling up, the dice will predict if the base
# gained points will be multiplied IE:
# if a 5 is roled(max) the Base Points gained will be
# level = 10
# Points = base + (level*5) = 53
# using base with no chance is for low exp/point games only IE:
# Points = base + (level) = 13
#---------------------------------
end
#===============================================================================
# ** Game_Actor - EDIT
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Added variables
attr_reader :dpdpoints
attr_reader :dpdpoints_max
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias dpd_game_actor_setup setup
alias dpd_game_actor_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
# actor_id : actor ID
#--------------------------------------------------------------------------
def initialize(actor_id)
dpd_game_actor_init(actor_id)
end
#--------------------------------------------------------------------------
# * Setup
# information for Orbs
#--------------------------------------------------------------------------
def setup(actor_id)
# Added info for Leveling system
@dpdpoints = 0
@max_dpdpoints = DPD::MaxPoints
# Original setup method
dpd_game_actor_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Create Maximum dpd_points
#--------------------------------------------------------------------------
def dpdpoints_max=(max_dpdpoints)
@max_dpdpoints = max_dpdpoints
end
#--------------------------------------------------------------------------
# * Create dpd_points
#--------------------------------------------------------------------------
def dpdpoints=(dpdpoints)
@dpdpoints = dpdpoints
end
end
#===============================================================================
# ** Scene_Battle - Phase 5 Rewite
#===============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP and amount of gold obtained
exp += enemy.exp
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
# Setup Points
if DPD::Chance == true
dice_role = rand(4)
points = DPD::BaseGainedPoints + (actor.level*(dice_role+1))
else
points = DPD::BaseGainedPoints + (actor.level)
end
actor.dpdpoints += points
@status_window.level_up(i)
end
end
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Set wait count
@phase5_wait_count = 100
end
end
#==============================================================================
# ** Dryad_Point_Distributer
#------------------------------------------------------------------------------
# This class allows you distribute points to stats.
#==============================================================================
class Dryad_Pt_Dist
#--------------------------------------------------------------------------
# * Initial Processing
#--------------------------------------------------------------------------
def initialize(actor_id)
@actor_id = actor_id
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_id]
# Set Up Scene
get_menus_and_sprites
get_transition
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
@ptwin.update
@help_window.update
# Get Input Commands and update functions
get_help(@ptwin.index)
get_input
end
#--------------------------------------------------------------------------
# * Gets Help Window Text
#--------------------------------------------------------------------------
def get_help(i)
# Set Cost
c = DPD::BaseCost[i] + (@actor.level * DPD::BaseCost[6])
# Set Gained Points To Stat
g = DPD::BaseGain[i] + (@actor.level * DPD::BaseGain[6])
txt = "#{c}"
txt2 = "#{g}"
# Get Window Value
case i
when 0 # HP
@help_window.set_text("Cost: #{txt} Points, Gained: HP+ #{txt2}")
when 1 # SP
@help_window.set_text("Cost: #{txt} Points, Gained: SP+ #{txt2}")
when 2 # STR
@help_window.set_text("Cost: #{txt} Points, Gained: STR+ #{txt2}")
when 3 # DEX
@help_window.set_text("Cost: #{txt} Points, Gained: DEX+ #{txt2}")
when 4 # AGI
@help_window.set_text("Cost: #{txt} Points, Gained: AGI+ #{txt2}")
when 5 # INT
@help_window.set_text("Cost: #{txt} Points, Gained: INT+ #{txt2}")
end
end
#--------------------------------------------------------------------------
# * Process Inputs for the Main Command Window
#--------------------------------------------------------------------------
def get_input
# If B button was pressed
if Input.trigger?(Input::B)
get_back_function
elsif Input.trigger?(Input::C)
get_trigger_function
elsif Input.trigger?(Input::R)
$game_system.se_play($data_system.decision_se)
@actor_id += 1
@actor_id %= $game_party.actors.size
$scene = Dryad_Pt_Dist.new(@actor_id)
elsif Input.trigger?(Input::L)
$game_system.se_play($data_system.decision_se)
@actor_id += $game_party.actors.size - 1
@actor_id %= $game_party.actors.size
$scene = Dryad_Pt_Dist.new(@actor_id)
return
end
end
#--------------------------------------------------------------------------
# * C Pressed Function
#--------------------------------------------------------------------------
def get_trigger_function
if @command_window.active == true
# Branch by command window cursor position
case @command_window.index
when 0 # Distribute
command_distribute
when 1 # Cancel
command_cancel
end
elsif @ptwin.active == true
get_ptwin_function
else
return
end
end
#--------------------------------------------------------------------------
# * B Pressed Function
#--------------------------------------------------------------------------
def get_back_function
if @command_window.active == true
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
elsif @ptwin.active == true
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@ptwin.active = false
else
return
end
end
#--------------------------------------------------------------------------
# * Point Window Input Function
#--------------------------------------------------------------------------
def get_ptwin_function
# Set Cost and Current Points
p = @actor.dpdpoints
c = DPD::BaseCost[@ptwin.index] + (@actor.level * DPD::BaseCost[6])
#Get Case
case @ptwin.index
when 0 # HP
v = @actor.maxhp
v2 = DPD::StatCap[@ptwin.index]
when 1 # SP
v = @actor.maxsp
v2 = DPD::StatCap[@ptwin.index]
when 2 # STR
v = @actor.str
v2 = DPD::StatCap[@ptwin.index]
when 3 # DEX
v = @actor.dex
v2 = DPD::StatCap[@ptwin.index]
when 4 # AGI
v = @actor.agi
v2 = DPD::StatCap[@ptwin.index]
when 5 # INT
v = @actor.int
v2 = DPD::StatCap[@ptwin.index]
end
# Check Price to Cost
if @actor.dpdpoints >= c and v < v2
@actor.dpdpoints -= c
make_exchange(@ptwin.index)
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
#--------------------------------------------------------------------------
# * Process When making an exchange in points
#--------------------------------------------------------------------------
def make_exchange(i)
# Get Window Value
v = DPD::BaseGain[i] + (@actor.level * DPD::BaseGain[6])
#Get Case
case i
when 0 # HP
@actor.maxhp += v
@actor.hp += v
when 1 # SP
@actor.maxsp += v
@actor.sp += v
when 2 # STR
@actor.str += v
when 3 # DEX
@actor.dex += v
when 4 # AGI
@actor.agi += v
when 5 # INT
@actor.int += v
end
$game_system.se_play($data_system.decision_se)
get_refresh
return
end
#--------------------------------------------------------------------------
# * Process When Exchanging Points for Stats
#--------------------------------------------------------------------------
def get_refresh
@ptwin.refresh
@command_window.refresh
@actor_win.refresh
return
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_distribute
# Play decision SE
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@ptwin.active = true
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
end
#--------------------------------------------------------------------------
# * Process Main Sprites and Windows Created
#--------------------------------------------------------------------------
def get_menus_and_sprites
@background = Sprite.new
@background.bitmap = RPG::Cache.picture("point_dis_back")
# Make command window
s1 = "Distribute"
s2 = "Cancel"
@command_window = Point_Window_Right.new(155, [s1, s2], @actor)
@command_window.x = 640 - @command_window.width
@command_window.y = 192 - @command_window.height / 2
# Make Actor Window
@actor_win = Window_DPD_stat.new(@actor)
# Make Point Window
@ptwin = Point_Window.new(@actor)
@ptwin.active = false
# Make Help Window
@help_window = Window_Help.new
@help_window.opacity = 0
end
#--------------------------------------------------------------------------
# * Process Disposed Items
#--------------------------------------------------------------------------
def get_dispose
# Dispose of window
@command_window.dispose
@help_window.dispose
@ptwin.dispose
@background.dispose
@actor_win.dispose
end
#--------------------------------------------------------------------------
# * Process Transition and Updates
#--------------------------------------------------------------------------
def get_transition
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame Update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
get_dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
end
#==============================================================================
# ** Window_DPD_stat
#------------------------------------------------------------------------------
# This window displays the Stats in the DPD system.
#==============================================================================
class Window_DPD_stat < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(-15, 40, 495, 142)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_face(@actor, 10, 6)
draw_actor_name(@actor, 240, 6)
draw_actor_state(@actor, 140, 32)
draw_actor_level(@actor, 140, 64)
draw_actor_hp(@actor, 284, 32)
draw_actor_sp(@actor, 284, 64)
end
def draw_face(a, x, y)
bitmap = RPG::Cache.picture(DPD::FaceSet[a.id])
self.contents.blt(x, y , bitmap, Rect.new(0, 0, 96, 96))
end
end
#==============================================================================
# ** Point_Window
#------------------------------------------------------------------------------
# This window deals with general command choices for the point system.
#==============================================================================
class Point_Window < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(actor)
# Compute window height from command quantity
super(0, 185, 470, 6 * 32 + 64)
@item_max = 6
self.contents = Bitmap.new(width - 32, (@item_max+1) * 32)
@actor = actor
@txt = [actor.maxhp, actor.maxsp, actor.str, actor.dex, actor.agi, actor.int]
self.opacity = 0
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = @actor
@txt = [actor.maxhp, actor.maxsp, actor.str, actor.dex, actor.agi, actor.int]
wid = 360/(DPD::BarLength/10)
for n in 0...wid
draw_bar(n, wid, wid*6)
end
for i in 0...(@item_max+1)
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
self.contents.font.size = 14
rect = Rect.new(370, 32 * index + (7*index) + ((1*index)-2), 80, 32)
self.contents.draw_text(rect, "#{@txt[index]}", 1)
end
#--------------------------------------------------------------------------
# * draw_bar
# n : item number
# w : split width
# ow : Original Width
#--------------------------------------------------------------------------
def draw_bar(n, w, ow)
bitmap = RPG::Cache.picture(DPD::ImgSet[1])
for i in 0...@item_max
v = (@actor.hp.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 0
v = (@actor.sp.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 1
v = (@actor.str.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 2
v = (@actor.dex.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 3
v = (@actor.agi.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 4
v = (@actor.int.to_f / DPD::StatCap[i]) * DPD::BarLength if i == 5
for p in 0...v
if p <= DPD::BarLength-1
self.contents.blt(26+(6*p), 9 + 32 * i + (7*i) + ((1*i)-2) - (0.5*i) , bitmap, Rect.new(0, 0, 6, 14))
self.contents.blt(26+(6*p), 9 + 32 * i + (7*i) + ((1*i)-2) - (0.5*i) + 1 , bitmap, Rect.new(0, 0, 6, 14)) and i == 3 or i == 5
else
self.contents.blt(26+(6*p), 9 + 32 * i + (7*i) + ((1*i)-2) - (0.5*i), bitmap, Rect.new(6, 0, 6, 14))
self.contents.blt(26+(6*p), 9 + 32 * i + (7*i) + ((1*i)-2) - (0.5*i) + 1 , bitmap, Rect.new(6, 0, 6, 14)) if i == 3 or i == 5
end
end
end
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * update_cursor_rect
# index : item number
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 4
self.cursor_rect.set(-8, 32 * @index + (7*@index) + ((1*@index)-2), 32, 32)
else
self.cursor_rect.set(-8, 32 * @index + (7*@index) + ((1*@index)-2) - 2, 32, 32)
end
end
end
#==============================================================================
# ** Point_Window_Right
#------------------------------------------------------------------------------
# This window deals with general command choices for the right window.
#==============================================================================
class Point_Window_Right < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands, actor)
# Compute window height from command quantity
super(0, 0, width, commands.size * 32 + 32 + 128)
@item_max = commands.size
@commands = commands
@actor = actor
self.contents = Bitmap.new(width - 32, self.height-32)
self.opacity = 0
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
self.contents.font.size = 20
self.contents.draw_text(4, 4, self.contents.width - 8, 32, "Points:", 1)
self.contents.font.size = 16
self.contents.fill_rect(0, 32+0, self.contents.width - 4, 32+4, Color.new(0, 0, 0, 150))
self.contents.draw_text(4, 32+4, self.contents.width - 8, 32, "#{@actor.dpdpoints}/#{DPD::MaxPoints}", 1)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.size = 20
self.contents.font.color = color
rect = Rect.new(4, 92 + 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * update_cursor_rect
# index : item number
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(4, 92 + 32 * @index , self.contents.width, 32)
end
end
here is the problem with the red bars overlapping the text
I'd really appreciate it if anyone could help me out with this, I'm not much of a scripter, more of a spriter though... Thanks to anyone who helps.
Thank you and have a nice day!