Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Row Changer v1.2 (Updated, again ...), Change party members row ...
originalwij
post Jun 1 2009, 01:21 PM
Post #1


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




Row Changer

Version: 1.2
Author: OriginalWij
Release Date:6/2/2009


Introduction:
This script enables a custom scene to change the row that a party member is in.
The default system lets you initially set the row by class, but has no option
to change it. This script enables you to adjust the row on-the-fly.

Features:
v1.0
  • ability to adjust a party member's row
  • optimized "odds" calculation to make rows more effective
  • works with party's of 4 to 8 characters
  • all texts and colors are customizable
  • displays character status
v1.1
  • fixed bug when multiple players have the same class
v1.2
  • fixed party change and status display bugs

Customization
All customizable options are listed at the top of the script

Compatibility
Should be compatible with most scripts.
Only overwrites the odds calculation in Game_Actor

Screenshot
Attached File  Screenshot.png ( 134.8K ) Number of downloads: 333


Script
[Show/Hide] Script v1.2
CODE

#==============================================================================
# Row Changer
#==============================================================================
# Author : OriginalWij
# Version : 1.2
#==============================================================================

#==============================================================================
# v1.0
# - Initial Release
# v1.1
# - Fixed bug when multiple players have the same class
# v1.2
# - Fixed party change and status display bugs
#==============================================================================

#==============================================================================
# To call: $scene = Scene_Row.new
#==============================================================================

#==============================================================================
# Config
#==============================================================================

module ROW
# Maximum party size (range = 4 to 8)
ROW_SIZE = 4
# Row text
ROW_TEXT = 'Row: '
# Row title texts
REAR_TEXT = 'Rear'
MIDL_TEXT = 'Middle'
FRNT_TEXT = 'Front'
# Row colors
COLOR = [] # <== Do NOT Modify
COLOR[0] = Color.new( 0, 255, 0) # Rear
COLOR[1] = Color.new(255, 255, 0) # Middle
COLOR[2] = Color.new(255, 0, 0) # Front
# Background color
BACK_COLOR = Color.new(0,0,0)
# Border color
BORDER_COLOR = Color.new(255,255,255)
# Class title text
CLASS = 'Class:'
# Row window back opacity
OPACITY = 175
end

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
alias rc_game_actor_initialize initialize unless $@
def initialize(actor_id)
rc_game_actor_initialize(actor_id)
@row = self.class.position
end
#--------------------------------------------------------------------------
# Get Row (New)
#--------------------------------------------------------------------------
def row
return @row
end
#--------------------------------------------------------------------------
# Set Row (New)
#--------------------------------------------------------------------------
def row=(new_row)
@row = new_row
end
#--------------------------------------------------------------------------
# Get Ease of Hitting (Overwrite)
#--------------------------------------------------------------------------
def odds
return 8 - self.row * 3 # make rows more effective
end
end

#==============================================================================
# Window_Status
#==============================================================================

class Window_Status < Window_Base
#--------------------------------------------------------------------------
# Variables (Added)
#--------------------------------------------------------------------------
Row_Text = ROW::ROW_TEXT
Row = []
Row[0] = ROW::FRNT_TEXT
Row[1] = ROW::MIDL_TEXT
Row[2] = ROW::REAR_TEXT
#--------------------------------------------------------------------------
# Draw Basic Information (Mod)
#--------------------------------------------------------------------------
alias rc_window_status_draw_basic_info draw_basic_info unless $@
def draw_basic_info(x, y)
rw = self.contents.text_size(Row_Text).width
self.contents.font.color = system_color
self.contents.draw_text(288, 0, 100, WLH, Row_Text)
self.contents.font.color = ROW::COLOR[2 - @actor.row]
self.contents.draw_text(288 + rw, 0, 100, WLH, Row[@actor.row])
self.contents.font.color = normal_color
rc_window_status_draw_basic_info(x, y)
end
end

#==============================================================================
# Row_Window (New)
#==============================================================================

class Row_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, 160)
self.back_opacity = ROW::OPACITY
@horiz_size = $game_party.members.size - 1
@max_size = ROW::ROW_SIZE - 1
@max_size = 3 if @max_size < 3
@max_size = 7 if @max_size > 7
@offset = ((7 - @max_size) / 2) * 42 + 90
@offset += 21 if @max_size % 2 == 0
refresh
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x1 = (7 - @max_size) * 18
x2 = 422 - (7 - @max_size) * 18
self.contents.draw_text(x1, 8, 90, WLH, ROW::REAR_TEXT, 1)
self.contents.draw_text(x1, 50, 90, WLH, ROW::MIDL_TEXT, 1)
self.contents.draw_text(x1, 92, 90, WLH, ROW::FRNT_TEXT, 1)
self.contents.draw_text(x2, 8, 90, WLH, ROW::REAR_TEXT, 1)
self.contents.draw_text(x2, 50, 90, WLH, ROW::MIDL_TEXT, 1)
self.contents.draw_text(x2, 92, 90, WLH, ROW::FRNT_TEXT, 1)
for x in 0..@horiz_size
for y in 0..2
@x = x * 42 + @offset
@y = y * 42
self.contents.fill_rect(@x, @y, 40, 40, ROW::COLOR[y])
self.contents.fill_rect(@x + 2, @y + 2, 36, 36, ROW::BACK_COLOR)
end
end
if (@max_size - @horiz_size) > 0
fill = @horiz_size + 1
for x in fill..@max_size
for y in 0..2
@x = x * 42 + @offset
@y = y * 42
self.contents.fill_rect(@x, @y, 40, 40, Color.new(128,128,128))
self.contents.fill_rect(@x + 2, @y + 2, 36, 36, ROW::BACK_COLOR)
end
end
end
for x in 0..@horiz_size
actor = $game_party.members[x]
a_pos = actor.row
draw_actor_graphic(actor, x * 42 + 20 + @offset, (2 - a_pos) * 42 + 36)
end
end
end

#==============================================================================
# Row_Status (New)
#==============================================================================

class Row_Status < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 160, 544, 256)
@actor = actor
self.back_opacity = ROW::OPACITY
refresh
end
#--------------------------------------------------------------------------
# New Actor
#--------------------------------------------------------------------------
def new_actor=(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
self.contents.font.color = system_color
self.contents.draw_text(128, 0, 60, WLH, ROW::CLASS)
self.contents.font.color = normal_color
draw_actor_class(@actor, 188, 0)
draw_actor_face(@actor, 6, 40)
draw_actor_graphic(@actor, 56, 200)
draw_basic_info(128, 32)
draw_parameters(128, 128)
draw_equipments(304, 28)
end
#--------------------------------------------------------------------------
# Draw Basic Information
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x, y - 4)
draw_actor_state(@actor, x, y + WLH)
draw_actor_hp(@actor, x, y + WLH * 2)
draw_actor_mp(@actor, x, y + WLH * 3)
end
#--------------------------------------------------------------------------
# Draw Parameters
#--------------------------------------------------------------------------
def draw_parameters(x, y)
draw_actor_parameter(@actor, x, y + WLH * 0, 0)
draw_actor_parameter(@actor, x, y + WLH * 1, 1)
draw_actor_parameter(@actor, x, y + WLH * 2, 2)
draw_actor_parameter(@actor, x, y + WLH * 3, 3)
end
#--------------------------------------------------------------------------
# Draw Experience Information
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + 40, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + 20, 180, WLH, s1, 2)
self.contents.draw_text(x, y + 60, 180, WLH, s2, 2)
end
#--------------------------------------------------------------------------
# Draw equipments
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
self.contents.font.color = normal_color
self.contents.font.size = 16
item_number = @actor.equips.size
item_number.times { |i|
if !@actor.equips[i]
if i ==1 and @actor.two_hands_legal?
draw_item_name(@actor.equips[i - 1], x , y + WLH * (i + 1), false)
else
text = "- EMPTY -"
self.contents.draw_text(x + 24, y + WLH * (i + 1), 120, WLH, text)
end
else
draw_item_name(@actor.equips[i], x , y + WLH * (i + 1))
end}
self.contents.font.size = Font.default_size
end
end

#==============================================================================
# Row_Cursor_Window (New)
#==============================================================================

class Row_Cursor_Window < Window_Selectable
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize
@max_size = ROW::ROW_SIZE - 1
@max_size = 3 if @max_size < 3
@max_size = 7 if @max_size > 7
x = ((7 - @max_size) / 2) * 42 + 90
x += 21 if @max_size % 2 == 0
super(x, 0, 80, 160)
@column_max = 1
@item_max = 3
self.index = 0
self.opacity = 0
end
#--------------------------------------------------------------------------
# Update Cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # No cursor
self.cursor_rect.empty
elsif @index < @item_max # Normal
self.cursor_rect.set(0, @index * 42, 40, 40)
elsif @index >= 100 # Self
self.cursor_rect.set(0, (@index - 100) * 42, 40, 40)
else # All
self.cursor_rect.set(0, 0, 40, @item_max * 40)
end
end
end

#==============================================================================
# Column_Cursor_Window (New)
#==============================================================================

class Column_Cursor_Window < Window_Selectable
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize
@max_size = ROW::ROW_SIZE - 1
@max_size = 3 if @max_size < 3
@max_size = 7 if @max_size > 7
x = ((7 - @max_size) / 2) * 42 + 90
x += 21 if @max_size % 2 == 0
super(x, 0, $game_party.members.size * 42 + 32, 160, 2)
@column_max = $game_party.members.size
@item_max = $game_party.members.size
self.index = 0
self.opacity = 0
end
#--------------------------------------------------------------------------
# Update Cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # No cursor
self.cursor_rect.empty
elsif @index < @item_max # Normal
self.cursor_rect.set(@index * 42, 0, 40, 124)
elsif @index >= 100 # Self
self.cursor_rect.set((@index - 100) * 42, 0, 40, 124)
else # All
self.cursor_rect.set(0, 0, 40, @item_max * 124)
end
end
end

#==============================================================================
# Scene_Row (New)
#==============================================================================

class Scene_Row < Scene_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
def initialize
@horiz_size = $game_party.members.size - 1
@max_size = ROW::ROW_SIZE - 1
@max_size = 3 if @max_size < 3
@max_size = 7 if @max_size > 7
@x = ((7 - @max_size) / 2) * 42 + 90
@x += 21 if @max_size % 2 == 0
end
#--------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------
def start
super
create_menu_background
@row_window = Row_window.new
@row_status = Row_Status.new($game_party.members[0])
@row_cursor_window = Row_Cursor_window.new
@column_cursor_window = Column_Cursor_window.new
@row_cursor_window.visible = false
@row_cursor_window.active = false
@column_cursor_window.active = true
end
#--------------------------------------------------------------------------
# Terminate
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@column_cursor_window.dispose
@row_cursor_window.dispose
@row_window.dispose
@row_status.dispose
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@row_window.update
@row_status.update
@column_cursor_window.update
@row_cursor_window.update
if @column_cursor_window.active
update_column_selection
elsif @row_cursor_window.active
update_row_selection
end
end
#--------------------------------------------------------------------------
# Update Column Selection
#--------------------------------------------------------------------------
def update_column_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
Sound.play_decision
@actor_selected = $game_party.members[@column_cursor_window.index].id
@row_cursor_window.x = @x + @column_cursor_window.index * 42
ga_pos = $game_actors[@actor_selected].row
@row_cursor_window.index = (2 - ga_pos)
@column_cursor_window.active = @column_cursor_window.visible = false
@row_cursor_window.active = @row_cursor_window.visible = true
elsif Input.repeat?(Input::LEFT) or Input.repeat?(Input::RIGHT)
@row_status.new_actor = $game_party.members[@column_cursor_window.index]
end
end
#--------------------------------------------------------------------------
# Update Row Selection
#--------------------------------------------------------------------------
def update_row_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@row_cursor_window.active = @row_cursor_window.visible = false
@column_cursor_window.active = @column_cursor_window.visible = true
elsif Input.trigger?(Input::C)
Sound.play_decision
rcw_i = @row_cursor_window.index
$game_actors[@actor_selected].row = (2 - rcw_i)
@row_window.refresh
@row_cursor_window.active = @row_cursor_window.visible = false
@column_cursor_window.active = @column_cursor_window.visible = true
end
end
end


DEMO
Updated to v1.2
Attached File  RowChanger12.zip ( 355.04K ) Number of downloads: 182


Installation
Place above Main (plug and play).
Set whatever options you want in the config section (top of script).

FAQ
Comments and suggestions for improvement/next version welcome.

Terms and Conditions
Free to use. Please credit me.

Credits
Me


__________________________




Go to the top of the page
 
+Quote Post
   
Yanfly
post Jun 1 2009, 02:05 PM
Post #2


Level 19
Group Icon

Group: Revolutionary
Posts: 384
Type: None
RM Skill: Undisclosed






Hmmm, I was worried about this but I tested it out and if you change the row positions, any character of the same class is to moved that row, too, rather than the individual actor itself.

Probably the thing you have to do is make the row positions an actor-based instance variable and have odds calculate off of that instead. =]

PS: I love the interface!


__________________________
Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 1 2009, 03:30 PM
Post #3


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




thanks for catching that one ... huh.gif
I always miss the easy ones laugh.gif

... unfortunately, the system assigns row by class (as set in the Database)
I think I can script a work around though ....


__________________________




Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 1 2009, 06:46 PM
Post #4


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




... fixed it

Updated to v1.1 (see original post)


__________________________




Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 2 2009, 10:26 AM
Post #5


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




Updated to v1.2 (see original post)


__________________________




Go to the top of the page
 
+Quote Post
   
draken29
post Jan 2 2010, 08:00 AM
Post #6


Level 14
Group Icon

Group: Revolutionary
Posts: 255
Type: Event Designer
RM Skill: Intermediate




Can we called it from the menu instead of a scene ?


__________________________
[Show/Hide] Profile Card

Profile Card by HayzenTZ


Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 02:56 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker