I need scripts for:
1. in-battle summons
2. in-battle party changes
3. party reserve(where you can have more than 4 party members but different ones at a time)
also if anyone knows where i can go to learn ruby(aka rgss) pls let me know........
hmmm...
they were on rmxp.net, but i can't fnd them
hint: look around at rmxp.net
Yes all three of them are at rmxp.net.
Please search there as they have a variety of scripts.
You can learn RGSS checking the others' scripts :lol:
listen to slipknot he has a point a learnt HTML,javascript and WML(its used in mobile phones) by looking at other peoples scripts
scripts that have lots of comments sometimes tell you waht the line of code is doing the hardest thing to learn in the syntax. it took me ages with javascript i kept forgetting to add [ and ) and ;
ruby doesnt have that much syntax though.
:)
summons can be done as an event methinks i used summons in rpgmaker2003 but the game i made is dead now :)
Quote from: phoenix92I need scripts for:
1. in-battle summons
2. in-battle party changes
3. party reserve(where you can have more than 4 party members but different ones at a time)
also if anyone knows where i can go to learn ruby(aka rgss) pls let me know........
2. i dont know how to make you party change in battle, but ill try some common events, and if i get 1 that works, ill send it to you
3. there is a script around here that lets you hav 5 party members.
Later On.... Ive tried it, i cant make it so u can change but pressing buttons, but i can make it say" ??? has decided to join your clan, remove 1 person to let ??? join" then just choises, easy common event making
You can use events to change party members.
If you havent found it yet heres the link
http://www.rmxp.net/forums/index.php?showtopic=30526
well that is the easyiest way, but i think he wants it like button pressing.
there is party switchin and summoning as one script which is this:
#==============================================================================
# Battle Switching & Summoning
#==============================================================================
# SephirothSpawn
# Version 2
# 20.12.05
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Battle Switching & Summoning", "SephirothSpawn", 2, "12.18.05")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Battle Switching & Summoning") == true
#==============================================================================
# ** Class Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :actors
attr_accessor :reserve_actors
attr_accessor :summon_actors
attr_accessor :reserve_summon_actors
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias seph_battleswitch_gameparty_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
seph_battleswitch_gameparty_initialize
@reserve_actors = []
@summon_actors = []
@reserve_summon_actors = []
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If the party has less than 4 members and this actor is not in the party
if @actors.size < 4 and not @actors.include?(actor)
# Add actor
@actors.push(actor)
# Refresh player
$game_player.refresh
elsif @actors.size >= 4 and not @actors.include?(actor) and not @reserve_actors.include?(actor)
# Add actor
@reserve_actors.push(actor)
# Refresh player
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# * Move To Reserve
# actor_id : actor ID
#--------------------------------------------------------------------------
def move_to_reserve(actor_id)
# Get actor
actor = $game_actors[actor_id]
if @actors.include?(actor)
@actors.delete(actor)
@reserve_actors.push(actor)
end
# Refresh player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Move To Party
# actor_id : actor ID
#--------------------------------------------------------------------------
def move_to_party(actor_id, index = -1)
# Get actor
actor = $game_actors[actor_id]
if @reserve_actors.include?(actor)
@reserve_actors.delete(actor)
@actors.insert(index, actor)
end
# Refresh player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Activate Summon
# actor_id : actor ID
#--------------------------------------------------------------------------
def summon_active(actor_id)
# Get actor
actor = $game_actors[actor_id]
if @reserve_summon_actors.include?(actor)
@reserve_summon_actors.delete(actor)
@summon_actors.push(actor)
end
# Refresh player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Deactivate Summon
# actor_id : actor ID
#--------------------------------------------------------------------------
def summon_deactive(actor_id)
# Get actor
actor = $game_actors[actor_id]
if @summon_actors.include?(actor)
@summon_actors.delete(actor)
@reserve_summon_actors.push(actor)
end
# Refresh player
$game_player.refresh
end
end
#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :commands
#--------------------------------------------------------------------------
# * Refresh Contents
#--------------------------------------------------------------------------
def refresh_contents
self.contents.dispose
@item_max = @commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
end
end
#==============================================================================
# ** Window_BattleSwitching
#==============================================================================
class Window_BattleSwitching < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(actors)
# Compute window height from command quantity
super(0, 0, 480, [actors.size * 32, 32].max + 32)
@item_max = actors.size
@actors = actors.dup
self.contents = Bitmap.new(width - 32, [@item_max * 32, 32].max)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
actor = @actors[index]
# Draws Name
contents.font.size = 22
contents.font.color = normal_color
contents.draw_text(4, index * 32, contents.width, 32, actor.name)
# Draws HP
contents.font.size = 16
color = actor.hp == 0 ? knockout_color : actor.hp < actor.maxhp / 2 ? crisis_color : normal_color
contents.font.color = color
contents.draw_text(140, index * 32, 140, 18, "#{actor.hp} / #{actor.maxhp}", 1)
draw_slant_bar(140, index * 32 + 22, actor.hp, actor.maxhp.to_f, 140)
# Draws SP
contents.font.size = 16
color = actor.sp == 0 ? knockout_color : actor.sp < actor.maxsp / 2 ? crisis_color : normal_color
contents.font.color = color
contents.draw_text(290, index * 32, 140, 18, "#{actor.sp} / #{actor.maxsp}", 1)
draw_slant_bar(290, index * 32 + 22, actor.sp, actor.maxsp.to_f, 140)
end
#--------------------------------------------------------------------------
# Draw Slant Bar
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6, bar_color = Color.new(150, 0, 0, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Color Values
if min == max
bar_color = Color.new(200, 0, 0, 255)
end
# Draws Bar
for i in 1..( (min / max) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + 255 * i / width
g = bar_color.green * (width - i) / width + 255 * i / width
b = bar_color.blue * (width - i) / width + 60 * i / width
a = bar_color.alpha * (width - i) / width + 255 * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
#==============================================================================
# ** Scene Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias seph_battleswitch_scenetitle_commandnewgame command_new_game
#--------------------------------------------------------------------------
# * Adds Base Stats For Enemies
#--------------------------------------------------------------------------
def command_new_game
# SDK Command: Command New Game
seph_battleswitch_scenetitle_commandnewgame
# Sets Summon Actors Requirements
for actor in $data_actors
unless actor == nil
$game_party.reserve_summon_actors.push($game_actors[actor.id]) if actor.name.delete!('*')
end
end
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_battleswitch_scenebattle_commandsinit commands_init
alias seph_battleswitch_scenebattle_updatesceneexit update_scene_exit
alias seph_battleswitch_scenebattle_updatephase3 update_phase3
alias seph_battleswitch_scenebattle_checkcommands check_commands
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
# SDK Commands Initialization
seph_battleswitch_scenebattle_commandsinit
# Adds Commands
@commands.push('Switch', 'Summon')
end
#--------------------------------------------------------------------------
# * Scene Exit Update
#--------------------------------------------------------------------------
def update_scene_exit
# SDK Scene Exit
seph_battleswitch_scenebattle_updatesceneexit
unless $scene == self
# Replace Active Members
unless @temp_actors == nil
unless @temp_actors.empty?
$game_party.actors.push(@temp_actors.dup).flatten!.delete_at(0)
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
seph_battleswitch_scenebattle_updatephase3
# If Party Switch is enabled
if @party_switch_window != nil
update_phase3_party_switch_select
end
# If Summon Switch skill is enabled
if @summon_switch_window != nil
update_phase3_summon_switch_select
end
end
#--------------------------------------------------------------------------
# * Check Commands
#--------------------------------------------------------------------------
def check_commands
seph_battleswitch_scenebattle_checkcommands
# Loads Current Command
command = @commands[@actor_command_window.index]
# Party Switch
if command == 'Switch'
update_phase3_command_switch
end
# Summon Switch
if command == 'Summon'
update_phase3_command_summon
end
# Unsummon Switch
if command == 'Unsummon'
update_phase3_command_unsummon
end
end
#--------------------------------------------------------------------------
# * Start Command: Switch
#--------------------------------------------------------------------------
def update_phase3_command_switch
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Party Switch Window
@party_switch_window = Window_BattleSwitching.new($game_party.reserve_actors)
@party_switch_window.height = 160 if @party_switch_window.height > 160
@party_switch_window.x = 320 - @party_switch_window.width / 2
@party_switch_window.y = 192 - @party_switch_window.height / 2
@party_switch_window.back_opacity = 225
# Actives Switch Window
@party_switch_window.active = true
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * Start Command: Summon
#--------------------------------------------------------------------------
def update_phase3_command_summon
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Summon Switch Window
@summon_switch_window = Window_BattleSwitching.new($game_party.summon_actors)
@summon_switch_window.height = 160 if @summon_switch_window.height > 160
@summon_switch_window.x = 320 - @summon_switch_window.width / 2
@summon_switch_window.y = 192 - @summon_switch_window.height / 2
@summon_switch_window.back_opacity = 225
# Actives Switch Window
@summon_switch_window.active = true
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * Start Command: Unsummon
#--------------------------------------------------------------------------
def update_phase3_command_unsummon
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Replace Active Members & Delete Summon
$game_party.actors.push(@temp_actors.dup).flatten!.delete_at(0)
# Refreshes
$game_party.refresh
# Clears Temp Actors
@temp_actors.clear
# Creates New Commands
@commands = @temp_commands
# Recreates Command Window
@actor_command_window.commands = @commands
# Refresh Window Contents
@actor_command_window.refresh_contents
# Refreshes Status Window
@status_window.refresh
# Deletes Spriteset
@spriteset.dispose
# Recreates Spriteset
@spriteset = Spriteset_Battle.new
for actor in $game_party.actors
@active_battler = actor
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
@active_battler.blink = false
end
# Go to Battle Processing
start_phase4
end
#--------------------------------------------------------------------------
# * Command: Switch
#--------------------------------------------------------------------------
def update_phase3_party_switch_select
# Make Party Switch window visible
@party_switch_window.visible = true
# Update window
@party_switch_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_party_switch_select
return
end
# If A button was pressed
if Input.trigger?(Input::A)
if $game_party.reserve_actors[@party_switch_window.index] == nil
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Store Index of Current Battler
index = $game_party.actors.index(@active_battler)
# Move Active Battler to Reserve
$game_party.move_to_reserve(@active_battler.id)
# Set Active Battler
@active_battler = $game_party.reserve_actors[@party_switch_window.index]
# Move Reserve Actor to Active Party
$game_party.move_to_party(@active_battler.id, index)
# Refreshes
$game_party.refresh
# Refresh Status Window
@status_window.refresh
# Set actor as unselectable
@actor_index -= 1
@active_battler = nil
# End skill selection
end_party_switch_select
# Go to command input for next actor
phase3_next_actor
return
end
end
end
#--------------------------------------------------------------------------
# * Command: Summon
#--------------------------------------------------------------------------
def update_phase3_summon_switch_select
# Make summon window visible
@summon_switch_window.visible = true
# Update summon window
@summon_switch_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_summon_switch_select
return
end
# If A button was pressed
if Input.trigger?(Input::A)
if $game_party.summon_actors[@summon_switch_window.index] == nil
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stores Current Actors
@temp_actors = $game_party.actors.dup
# Store Current Commands
@temp_commands = @commands.dup
# Make New Commands
@actor_command_window.commands = [$data_system.words.attack,
$data_system.words.skill, $data_system.words.guard, $data_system.words.item]
# Adds Limit Break if Limit Break Enabled
if SDK.state("Advanced Limit Break") == true
index = @actor_command_window.commands.index($data_system.words.skill) + 1
@actor_command_window.commands.insert(index, 'Limit Break')
end
# Adds Unsummon Command
@actor_command_window.commands.push('Unsummon')
# Creates New Commands
@commands = @actor_command_window.commands.dup
# Refresh Window Contents
@actor_command_window.refresh_contents
# Clear Game Party
$game_party.actors.clear
# Gets Active Battler
@active_battler = $game_party.summon_actors[@summon_switch_window.index]
# Add Summon to Party
$game_party.actors = [@active_battler]
# Refresh Status Window
@status_window.refresh
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
@active_battler.blink = false
# End skill selection
end_summon_switch_select
# Go to Battle Processing
start_phase4
return
end
end
end
#--------------------------------------------------------------------------
# * End Party Switch Selection
#--------------------------------------------------------------------------
def end_party_switch_select
# Delete Party Switch Window
@party_switch_window.dispose
@party_switch_window = nil
# Hide help window
@help_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# * End Summon Switch Selection
#--------------------------------------------------------------------------
def end_summon_switch_select
# Delete Summon Switch Window
@summon_switch_window.dispose
@summon_switch_window = nil
# Hide help window
@help_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
and for reserve and class change (i know u didn't ask)
[code]#==============================================================================
# Party & Class Changing System
#--------------------------------------------------------------------------
# Created By SephirothSpawn (11.27.05)
# Last Updated: 11.28.05
#==============================================================================
#==============================================================================
# Class Scene Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias new_game command_new_game
#--------------------------------------------------------------------------
# * Adds Base Stats For Enemies
#--------------------------------------------------------------------------
def command_new_game
# Sets Class Requirements
for i in 1...$data_classes.size
$data_classes[i].set_reqirements
end
# Sets Characters Sex
for i in 1...$data_actors.size
$data_actors[i].set_sex
end
new_game
end
end
#==============================================================================
# ** Module RPG
#==============================================================================
module RPG
#===========================================================================
# ** Class Actor
#===========================================================================
class Actor
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sex
#--------------------------------------------------------------------------
# * Set Sex
#--------------------------------------------------------------------------
def set_sex
if @name.include?('(')
@sex = @name.slice!(@name.index('(')..@name.index(')')) == '(M)' ? 1 : 2
else
@sex = 1
end
end
end
#===========================================================================
# ** Class Class
#===========================================================================
class Class
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :level_requirements
attr_accessor :sex_requirements
#--------------------------------------------------------------------------
# * Set Requirements
#--------------------------------------------------------------------------
def set_reqirements
# Sets Level Requirements
@level_requirements = @name.include?('{') ?
eval (@name.slice!(@name.index('{')..@name.index('}'))) : {}
# Sets Sex Requirements
if @name.include?('(')
sex = @name.slice!(@name.index('(')..@name.index(')'))
@sex_requirements = sex == '(M)' ? 1 : 2
else
@sex_requirements = 0
end
end
end
end
#==============================================================================
# ** Class Window_Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Item Name
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw text width
# align : text align
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, width = 212, align = 0, type = 0)
if item == nil
case type
when 0 # Weapon
bitmap = RPG::Cache.icon("001-Weapon01")
when 1 # Shield
bitmap = RPG::Cache.icon("009-Shield01")
when 2 # Helmet
bitmap = RPG::Cache.icon("010-Head01")
when 3 # Armor
bitmap = RPG::Cache.icon("014-Body02")
when 4 # Accessory
bitmap = RPG::Cache.icon("016-Accessory01")
end
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), disabled_color.alpha)
self.contents.font.color = disabled_color
self.contents.draw_text(x + 28, y, width - 28, 32, "Nothing Equipped", align)
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, width - 28, 32, item.name, align)
end
#--------------------------------------------------------------------------
# * Draw Sprite
#--------------------------------------------------------------------------
def draw_sprite(x, y, name, hue, pose, frame, actor_contents = true)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
# Facing Direction
case pose
when 0 ;a = 0 # Down
when 1 ;a = ch # Left
when 2 ;a = ch * 3 # Up
when 3 ;a = ch * 2 # Right
end
# Current Animation Slide
case frame
when 0 ;b = 0
when 1 ;b = cw
when 2 ;b = cw * 2
when 3 ;b = cw * 3
end
# Bitmap Rectange
src_rect = Rect.new(b, a, cw, ch)
# Draws Bitmap
if actor_contents
@sprite_contents.bitmap.blt(x - cw / 2, y - ch, bitmap, src_rect)
else
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# Draw Bar
# Credit Near Fantastica for Orginal Script
#--------------------------------------------------------------------------
def draw_bar(x, y, min, max, width = 152, height = 20)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
bar_color = Color.new(0, 0, 200, 255)
for i in 0..(width * min / max)
r = bar_color.red * (width - i) / width + 0 * i / width
g = bar_color.green * (width - i) / width + 0 * i / width
b = bar_color.blue * (width - i) / width + 0 * i / width
a = bar_color.alpha * (width - i) / width + 255 * i / width
self.contents.fill_rect(x + i, y, 1 , height, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Alias Update
#--------------------------------------------------------------------------
alias sprite_update update
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
sprite_update
unless @sprite_contents == nil
@sprite_contents.x = self.x + self.ox + 16
@sprite_contents.y = self.y + self.oy + 16
end
end
#--------------------------------------------------------------------------
# * Alias Dispose
#--------------------------------------------------------------------------
alias sprite_dispose dispose
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
sprite_dispose
unless @sprite_contents == nil
@sprite_contents.dispose
@sprite_contents.dispose
end
end
end
#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :cursor_height
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias custom_int initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
custom_int(x, y, width, height)
@cursor_height = 32
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of @cursor_height
return self.oy / @cursor_height
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * @cursor_height
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of @cursor_height
return (self.height - 32) / @cursor_height
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * @cursor_height - self.oy
if self.active == true
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, @cursor_height)
end
end
end
#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Unisable Item
# index : item number
#--------------------------------------------------------------------------
def undisable_item(index)
draw_item(index, normal_color)
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :class_levels
attr_accessor :class_exp
attr_accessor :class_skills
attr_accessor :sex
#--------------------------------------------------------------------------
# * Alias Setup
#--------------------------------------------------------------------------
alias class_setup setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
class_setup(actor_id)
@class_levels, @class_exp, @class_skills = [nil], [nil], [nil]
for i in 0...$data_classes.size
@class_levels.push(1)
@class_exp.push(0)
@class_skills.push([])
end
@sex = $data_actors[actor_id].sex
end
#--------------------------------------------------------------------------
# * Switch Class
#--------------------------------------------------------------------------
def switch_class(class_id)
# Updates Class Arrays
@class_levels[@class_id ] = @level
@class_exp[@class_id] = @exp
@class_skills[@class_id] = @skills
# Loads New Class ID
@class_id = class_id
# Loads Class Level & Exp Count
@level = @class_levels[class_id]
@exp = @class_exp[class_id]
@skills = @class_skills[class_id]
end
#--------------------------------------------------------------------------
# * Update Levels & Exp
#--------------------------------------------------------------------------
def update_classes
# Updates Class Arrays
@class_levels[@class_id ] = @level
@class_exp[@class_id] = @exp
@class_skills[@class_id] = @skills
end
end
#==============================================================================
# ** Class Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :reserve_actors
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias reserve_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
reserve_initialize
@reserve_actors = []
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If the party has less than 4 members and this actor is not in the party
if @actors.size < 4 and not @actors.include?(actor)
# Add actor
@actors.push(actor)
# Refresh player
$game_player.refresh
elsif @actors.size >= 4 and not @actors.include?(actor) and not @reserve_actors.include?(actor)
# Add actor
@reserve_actors.push(actor)
# Refresh player
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# * Move To Reserve
# actor_id : actor ID
#--------------------------------------------------------------------------
def move_to_reserve(actor_id)
# Get actor
actor = $game_actors[actor_id]
if @actors.include?(actor)
@actors.delete(actor)
@reserve_actors.push(actor)
end
# Refresh player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Move To Party
# actor_id : actor ID
#--------------------------------------------------------------------------
def move_to_party(actor_id)
# Get actor
actor = $game_actors[actor_id]
if @reserve_actors.include?(actor)
@reserve_actors.delete(actor)
@actors.push(actor)
end
# Refresh player
$game_player.refresh
end
end
#==============================================================================
# ** Window_Member_Sprites
#==============================================================================
class Window_Member_Sprites < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x = 0, y = 384, width = 160)
super(x, y, width, 96)
self.z = 500
# Creates Contents
self.contents = Bitmap.new(width - 32, height - 32)
@sprite_contents = Sprite.new
@sprite_contents.bitmap = Bitmap.new(width - 32, height - 32)
@sprite_contents.z = 505
self.contents.font.size = 10
# Animation Varaibles
@pose, @frame = 0, 0
# Updates Window
update
end
#--------------------------------------------------------------------------
# * Refresh
# actors : $game_party.actors or $game_party.reserve_actors
#--------------------------------------------------------------------------
def refresh(actors)
# Clears Contents
contents.clear
@sprite_contents.bitmap.clear
# Stores Actors
@actors = actors.dup
# Adds Blank Actors
max = @actors == $game_party.actors ? 3 : 14
@actors.push(nil) until @actors.size > max
# Draw Sprites
draw_sprites
# Draws Info
draw_info
end
#--------------------------------------------------------------------------
# Draw Sprites
#--------------------------------------------------------------------------
def draw_sprites
@sprite_contents.bitmap.clear
for i in 0...@actors.size
actor = @actors[i]
if actor == nil
draw_sprite(i * 32 + 16, 64, "Empty", 0, @pose, @frame)
else
draw_sprite(i * 32 + 16, 64, actor.character_name, actor.character_hue , @pose, @frame)
end
end
end
#--------------------------------------------------------------------------
# Draw Information
#--------------------------------------------------------------------------
def draw_info
contents.clear
for i in 0...@actors.size
actor = @actors[i]
if actor == nil
contents.font.color = disabled_color
contents.draw_text(i * 32, 0, 32, 12, "Empty", 1)
else
contents.font.color = normal_color
contents.draw_text(i * 32, 0, 32, 12, actor.name, 1)
end
end
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
draw_sprites
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect(index)
self.cursor_rect.set(index * 32, 0, 32, 64)
end
#--------------------------------------------------------------------------
# Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
draw_sprites
end
end
#==============================================================================
# ** Window_Party_Changing
#==============================================================================
class Window_Party_Changing < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 288)
# Sets Cursor Height
self.cursor_height = 64
# Sets Index
self.index = 0
# Animated Sprite Counters
@pose, @frame = 0, 0
# Sets Up Window Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Sprite Contents
@sprite_contents = Sprite.new
@sprite_contents.bitmap = Bitmap.new(width - 32, height - 32)
@sprite_contents.z = 500
# Updates Window
update
end
#--------------------------------------------------------------------------
# * Refresh
# actors : $game_party.actors or $game_party.reserve_actors
#--------------------------------------------------------------------------
def refresh(actors)
# Clears Contents
contents.clear
@sprite_contents.bitmap.clear
# Duplicates Actors
@actors = actors.dup
# Checks Actors List
max = @actors == $game_party.actors ? 3 : 0
@actors.push(nil) until @actors.size > max
# Sets Up Item Max
@item_max = @actors.size
# Draw Sprites
draw_sprites
# Draws Info
draw_info
end
#--------------------------------------------------------------------------
# Draws Sprites
#--------------------------------------------------------------------------
def draw_sprites
@sprite_contents.bitmap.clear
# Draws actors
for i in 0...@actors.size
actor = @actors[i]
y = i * 64 + 8
if actor == nil
draw_sprite(20, y + 48, "Empty", 0, @pose, @frame)
else
draw_sprite(20, y + 48, actor.character_name, actor.character_hue , @pose, @frame)
end
end
end
#--------------------------------------------------------------------------
# Draws Information
#--------------------------------------------------------------------------
def draw_info
contents.clear
# Draws actors
for i in 0...@actors.size
actor = @actors[i]
y = i * 64 + 8
if actor == nil
contents.font.size = 40
contents.font.color = disabled_color
contents.draw_text(60, y - 8, contents.width, 64, "Empty Position")
else
contents.font.size = 22
# Draws Name
contents.font.color = normal_color
contents.draw_text(60, y, 90, 24, actor.name)
# Draws Class
contents.draw_text(60, y + 24, 90, 24, $data_classes[actor.class_id].name)
# Draws Level
contents.font.color = system_color
contents.draw_text(160, y, 100, 24, "Level")
contents.font.color = normal_color
contents.draw_text(160, y, 100, 24, actor.level.to_s, 2)
# Draws State
state = make_battler_state_text(actor, 112, true)
contents.font.color = actor.hp == 0 ? knockout_color : normal_color
contents.draw_text(160, y + 24, 100, 24, state)
# Draws Experience
contents.font.color = system_color
contents.draw_text(274, y, 160, 24, "Exp")
contents.font.color = normal_color
contents.draw_text(274, y, 160, 24, actor.exp.to_s, 2)
# Draws Next Level Bar
draw_bar(270, y + 26, actor.exp, actor.next_exp_s.to_i, 168)
# Draws Next Level
contents.font.color = system_color
contents.draw_text(274, y + 24, 160, 24, "Next Level")
contents.font.color = normal_color
contents.draw_text(274, y + 24, 160, 24, actor.next_rest_exp_s.to_s, 2)
# Draw HP Bar
draw_bar(446, y + 2, actor.hp, actor.maxhp)
# Draw MP Bar
draw_bar(446, y + 26, actor.sp, actor.maxsp)
# Draws HP
contents.font.size = 22
contents.font.color = system_color
contents.draw_text(452, y, 160, 24, $data_system.words.hp)
contents.font.size = 16
contents.font.color = actor.hp == 0 ? knockout_color : normal_color
contents.draw_text(452, y, 140, 24, "#{actor.hp} / #{actor.maxhp}", 2)
# Draws SP
contents.font.size = 22
contents.font.color = system_color
contents.draw_text(452, y + 24, 160, 24, $data_system.words.sp)
contents.font.size = 16
contents.font.color = actor.sp == 0 ? knockout_color : normal_color
contents.draw_text(452, y + 24, 140, 24, "#{actor.sp} / #{actor.maxsp}", 2)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
draw_sprites
end
#--------------------------------------------------------------------------
# * Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
draw_sprites
end
end
#==============================================================================
# ** Window Class Changing
#==============================================================================
class Window_Class_Changing < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 320)
# Sets Cursor Height
self.cursor_height = 72
# Sets Index
self.index = 0
# Animated Sprite Counters
@pose, @frame = 0, 0
# Window Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Refreshes Window Contents
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clears Contents
contents.clear
# Duplicates Actors
@actors = $game_party.actors.dup
# Checks Actors List
@actors.push(nil) until @actors.size > 3
# Sets Up Item Max
@item_max = @actors.size
# Draw Actors Info
contents.clear
for i in 0...@item_max
actor = @actors[i]
y = i * 72
# Draws Animated Sprite
if actor == nil
draw_sprite(20, y + 66, "Empty", 0, @pose, @frame, false)
contents.font.color = disabled_color
contents.draw_text(32, y + 2, contents.width - 40, 24, "", 2)
contents.draw_text(32, y + 24, contents.width - 40, 24, "Empty", 2)
contents.draw_text(32, y + 46, contents.width - 40, 24, "", 2)
else
draw_sprite(20, y + 66, actor.character_name, actor.character_hue , @pose, @frame, false)
contents.font.color = normal_color
# Draws Name
contents.draw_text(32, y + 2, contents.width - 40, 24, actor.name, 2)
# Draws Class
contents.draw_text(32, y + 24, contents.width - 40, 24, $data_classes[actor.class_id].name, 2)
# Draws Level
contents.draw_text(32, y + 46, contents.width - 40, 24, "Level: #{actor.level}", 2)
end
end
end
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh
end
#--------------------------------------------------------------------------
# Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh
end
end
#==============================================================================
# ** Window Character Status
#==============================================================================
class Window_Character_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize
super(160, 64, 480, 416)
# Animation Varaibles
@pose, @frame = 0, 0
# Window Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Refreshes Contents
refresh($game_party.actors[0])
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
# Clears Contents
contents.clear
# Stores Actor
@actor = actor
if actor == nil
draw_sprite(contents.width / 2, contents.height / 2, "Empty", 0, @pose, @frame, false)
# Draws Empty Text
contents.font.size = 48
contents.font.color = system_color
contents.font.color.alpha = disabled_color.alpha
contents.draw_text(0, contents.height / 2, contents.width, 48, "Empty Position", 1)
else
draw_sprite(40, 80, actor.character_name, actor.character_hue , @pose, @frame, false)
contents.font.size = 22
contents.font.color = normal_color
# Draws Name
contents.draw_text(-8, 4, 96, 24, actor.name, 1)
# Draws State
state = make_battler_state_text(actor, 112, true)
contents.font.color = actor.hp == 0 ? knockout_color : normal_color
contents.draw_text(96, 8, 96, 24, state, 1)
# Draws Class
contents.font.color = system_color
contents.draw_text(96, 32, 96, 24, actor.class_name, 1)
# Draws Level
contents.font.color = system_color
contents.draw_text(96, 56, 96, 24, "Level :")
contents.font.color = normal_color
contents.draw_text(96, 56, 96, 24, actor.level.to_s, 2)
# Draws Experience
contents.font.color = system_color
contents.draw_text(224, 8, 224, 24, "Experience :")
contents.font.color = normal_color
contents.draw_text(216, 8, 224, 24, actor.exp_s, 2)
# Next Level Experience
contents.font.color = system_color
contents.draw_text(224, 32, 224, 24, "Next Level :")
contents.font.color = normal_color
contents.draw_text(216, 32, 224, 24, actor.next_rest_exp_s, 2)
# Draws Next Level Bar
draw_bar(224, 58, actor.exp, actor.next_exp_s.to_i, 216)
# Draws HP Bar
draw_bar(32, 126, actor.hp, actor.maxhp, 228, 24)
# Draws HP
contents.font.color = system_color
contents.draw_text(40, 126, 224, 24, "HP")
contents.font.color = normal_color
contents.draw_text(32, 126, 224, 24, "#{actor.hp} / #{actor.maxhp}", 2)
# Draws SP Bar
draw_bar(32, 158, actor.sp, actor.maxsp, 228, 24)
# Draws SP
contents.font.color = system_color
contents.draw_text(40, 158, 224, 24, "SP")
contents.font.color = normal_color
contents.draw_text(32, 158, 224, 24, "#{actor.sp} / #{actor.maxsp}", 2)
# Draws Equiped Items
draw_item_name($data_weapons[actor.weapon_id], 36, 190, 224, 2, 0)
draw_item_name($data_armors[actor.armor1_id], 36, 222, 224, 2, 1)
draw_item_name($data_armors[actor.armor2_id], 36, 254, 224, 2, 2)
draw_item_name($data_armors[actor.armor3_id], 36, 286, 224, 2, 3)
draw_item_name($data_armors[actor.armor4_id], 36, 318, 224, 2, 4)
# Draws Stats
stat_names = [$data_system.words.str, $data_system.words.dex, $data_system.words.agi,
$data_system.words.int, $data_system.words.atk, $data_system.words.pdef, $data_system.words.mdef, "Evasion"]
stats = [actor.str, actor.dex, actor.agi, actor.int, actor.atk, actor.pdef, actor.mdef, actor.eva]
for i in 0...stats.size
contents.font.color = system_color
contents.draw_text(278, 108 + i * 32, 170, 24, stat_names[i])
contents.font.color = normal_color
contents.draw_text(270, 108 + i * 32, 170, 24, stats[i].to_s, 2)
end
end
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh(@actor)
end
#--------------------------------------------------------------------------
# Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh(@actor)
end
end
#==============================================================================
# ** Window_Class_Status
#=====================
use the goddamn codeboxes, like the first segment
about learning RGSS. *points*
http://www.crankeye.com/forums/viewtopic.php?t=6237