The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Evrae on March 31, 2006, 08:31:10 PM

Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on March 31, 2006, 08:31:10 PM
Greetings

Does anyone has/know a script for RPG Maker XP, where you can reorganize or change your party members?
Example:
The total heros on the game are 7 and you want to choose which heroes are active in your party, so, in the Main Menu you have an option where you can choose which heros you want in your active party.
The other feature we search on this script is: considering you have an active party of 2, 3 or 4 members, you can reorganize the order of the characters, being able to choose who is the party leader that you control on the maps.

If anyone could give some guide of any source who has this script, it would be very pleasing.

Looking foward some answers

Cheers!
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on March 31, 2006, 09:54:28 PM
#==============================================================================#
#===================?===Party Changing Script by Xk8===?=====================#
#==============================================================================#
#=====Special Thanks to Minkoff and Prexus for helping out with coding and=====#
#============teaching me more knowledge to complete this script.===============#
#==============================================================================#
#######
# added by Blizzard:
# find "for i in 1...XXXXX" and change XXXXX to the number of your partymembers
# game variable 100 is used for party change during battle
# set it to 1 before calling this script from a battle
#######
#?installation instructions: #
# 1.paste script above Main #
# 2.paste this in Scene_Save, in it's appropiate place: #
# Marshal.dump($party_variables, file) <- above line 83, #
# below Marshal.dump($game_player, file) #
# 3.paste this in Scene_Load, in it's appropiate place: #
# $party_variables = Marshal.load(file) <- above line 83, #
# below $game_player = Marshal.load(file) #
#4.add this definition in Game_Actors, above the last 'end': #
# def size #
# return @data.size #
# end #
#==============================================================================#
#?hero 1 is automaticallly mandatory, meaning, you can't remove him/her from #
#the party. to change this, enter this line somewhere in the scene or a map: #
# $party_variables.mandatory[0] = false #
#or, change this line : #
#@mandatory = [true, false, false, false, false, false, false, false] #
#into this line: #
#@mandatory = [false, false, false, false, false, false, false, false] #
#same goes for other heroes. #
#==============================================================================#
#?heroes 1-5 are automatically available, because in a 4 member party, member #
#5 should trigger the party switching event. #
#to make other actors available, enter this line in a Call Script, whenever you#
#want the hero to be available: #
# $party_variables.available[actor_id] = true #
#where actor_id is the id of the hero, starting at 0, where 0 is hero 1. #
#to remove a hero from the reserves, enter this line, like the above: #
# $party_variables.available[actor_id] = false #
#==============================================================================#
#?the script contains all the heroes in the database, lining them up from hero#
#1 to the last hero, in the same order as the database, so there is no need to #
#modify the script when you add heroes to the game #
#==============================================================================#
#?The script can be called using this line: #
# $scene = Scene_Change.new #
#this line must be pasted in either a 'Call Script' command of in another #
#Scene_ (e.g. Scene_Menu) #


#IMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANT======#
#ooh ooh something important....at the very BOTTOM of the script, you'll see
#the variables @mandatory and @available...

#each value represents an actor, so you understand that, when you have 12 #
#heroes in your party, those variables should also have 12 true/false values. #
#IMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANTIMPORTANT======#


#==============================================================================#
#?I hope you enjoy this script.. #
# -Xk8 #
#==============================================================================#
#==============================================================================#
class Window_Change < Window_Base

def initialize(actor)
super(0, 0, 480, 264)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@actor = actor
refresh
end

def refresh

# Minkoff Label
@actor = $game_party.actors[0] if !@actor.is_a?(Game_Actor)
# /Minkoff Label

self.contents.clear
self.contents.font.size = $fontsize
draw_actor_graphicx(@actor, 420, 50)
draw_actor_namex(@actor, 2, 0)
draw_actor_level(@actor, 152 - 64, 0)
draw_actor_class(@actor, 222 - 64, 0)
draw_actor_hp(@actor, 0, 32, 172)
draw_actor_sp(@actor, 0, 64, 172)
self.contents.font.color = system_color
self.contents.draw_text(240, 0, 80, 32, "EXP")
self.contents.draw_text(240, 32, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(240 + 80, 0, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(240 + 80, 32, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.draw_text(240, 34, 180, 32, "______________")
self.contents.draw_text(0, 66, 180, 32, "______________")
draw_actor_parameter(@actor, 0, 96, 0)
draw_actor_parameter(@actor, 0, 128, 1)
draw_actor_parameter(@actor, 0, 160, 2)
draw_actor_parameter(@actor, 240, 64, 3)
draw_actor_parameter(@actor, 240, 96, 4)
draw_actor_parameter(@actor, 240, 128, 5)
draw_actor_parameter(@actor, 240, 160, 6)

draw_item_namex($data_weapons[@actor.weapon_id], 0, 192)
draw_item_namex($data_armors[@actor.armor1_id], 0, 210)
draw_item_namex($data_armors[@actor.armor2_id], 128, 192)
draw_item_namex($data_armors[@actor.armor3_id], 128, 210)
draw_item_namex($data_armors[@actor.armor4_id], 256, 192)

if $game_party.actors.include?(@actor)
status = "In party"
statuscolor = Color.new(255, 0, 0, 255)
$addable = 0
else
status = "Not in party"
statuscolor = Color.new(0, 255, 0, 255)
$addable = 1
end
self.contents.font.color = normal_color
self.contents.font.size = 14
self.contents.draw_text(256 + 50, 194, 120, 32, "____________")
self.contents.draw_text(256 + 50, 208, 120, 32, "Status:")
self.contents.font.color = statuscolor
self.contents.draw_text(300 + 64, 208, 120, 32, status)
self.contents.font.size = 24
end


def draw_actor_namex(actor, x, y)
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text(x + 2, y, 120, 32, actor.name)
self.contents.draw_text(x - 2, y, 120, 32, actor.name)
self.contents.draw_text(x, y + 2, 120, 32, actor.name)
self.contents.draw_text(x, y - 2, 120, 32, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end

def draw_item_namex(item, x, y)
if item == nil
return
end
self.contents.font.size = 16
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 212, 32, item.name)
end

def draw_actor_graphicx(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, 180)
end
end

class Window_Unlocked < Window_Base

def initialize
super(0, 0, 480, 264)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize

refresh
end

def refresh
self.contents.clear
self.contents.font.size = 72
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text(2, 71, 480, 80, "Character Locked")
self.contents.draw_text(-2, 71, 480, 80, "Character Locked")
self.contents.draw_text(0, 73, 480, 80, "Character Locked")
self.contents.draw_text(0, 69, 480, 80, "Character Locked")
self.contents.draw_text(2, 69, 480, 80, "___________________")
self.contents.draw_text(-2, 69, 480, 80, "___________________")
self.contents.draw_text(0, 71, 480, 80, "___________________")
self.contents.draw_text(0, 67, 480, 80, "___________________")
self.contents.draw_text(2, 10, 480, 80, "___________________")
self.contents.draw_text(-2, 10, 480, 80, "___________________")
self.contents.draw_text(0, 12, 480, 80, "___________________")
self.contents.draw_text(0, 8, 480, 80, "___________________")
self.contents.font.color = normal_color
self.contents.draw_text(0, 71, 480, 80, "Character Locked")
self.contents.draw_text(0, 69, 480, 80, "___________________")
self.contents.draw_text(0, 10, 480, 80, "___________________")

self.contents.font.size = 16
self.contents.font.color = normal_color
self.contents.draw_text(256 + 50, 194, 120, 32, "_________________")
self.contents.draw_text(256 + 50, 208, 120, 32, "Status:")
self.contents.font.color = system_color
self.contents.draw_text(300 + 50, 208, 120, 32, "Not Available")
end
end

class Window_Reserve < Window_Selectable

def initialize(width, commands)
super(0, 0, width, 296)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 18 + 64)
self.contents.font.name = $fontface
self.contents.font.size = 16
refresh
self.index = -1
end

def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 22 * index, self.contents.width - 8, 18)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max

if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 22 - self.oy
self.cursor_rect.set(x, y, cursor_width, 18)
end

def disable_item(index)
draw_item(index, disabled_color)
end
end


class Window_Prompt < Window_Selectable

def initialize(width, commands)
super(0, 0, width, 96)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end

def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
self.contents.font.color = Color.new(255, 0, 0, 255)
if $prompt_text == 0
text = " Party is full.."
elsif $prompt_text == 1
text = " Can't Empty party.."
elsif $prompt_text == 2
text = " Member is mandatory.."
else
text = ""
end
self.contents.draw_text(2, 0, 320, 32, text)
self.contents.draw_text(-2, 0, 320, 32, text)
self.contents.draw_text(0, 2, 320, 32, text)
self.contents.draw_text(0, -2, 320, 32, text)
self.contents.font.color = color
self.contents.draw_text(0, 0, 320, 32, text)
rect = Rect.new(134, 32 * index + 32, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(130, @index * 32 + 32, 36, 32)
end
end
end

class Window_Prompt2 < Window_Selectable

def initialize(width, commands)
super(0, 0, width, 128)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end

def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
self.contents.font.color = Color.new(255, 0, 0, 255)
text = " Add Partymember?"
self.contents.draw_text(2, 0, 320, 32, text)
self.contents.draw_text(-2, 0, 320, 32, text)
self.contents.draw_text(0, 2, 320, 32, text)
self.contents.draw_text(0, -2, 320, 32, text)
self.contents.font.color = color
self.contents.draw_text(0, 0, 320, 32, text)
rect = Rect.new(134, 32 * index + 32, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 32 + 32, self.width - 32, 32)
end
end
end

class Window_Title < Window_Base

def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 36
self.opacity = 0
refresh
end

def refresh
self.contents.clear
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text(4, 0, 180, 50, "Change Party")
self.contents.draw_text(0, 0, 180, 50, "Change Party")
self.contents.draw_text(2, 2, 180, 50, "Change Party")
self.contents.draw_text(2, -2, 180, 50, "Change Party")
self.contents.font.color = normal_color
self.contents.draw_text(2, 0, 180, 50, "Change Party")
self.contents.font.size = $fontsize
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(17, 51, 120, 32, "Options")
self.contents.draw_text(15, 51, 120, 32, "Options")
self.contents.draw_text(16, 52, 120, 32, "Options")
self.contents.draw_text(16, 50, 120, 32, "Options")
self.contents.draw_text(17, 203, 120, 32, "Reserves")
self.contents.draw_text(15, 203, 120, 32, "Reserves")
self.contents.draw_text(16, 204, 120, 32, "Reserves")
self.contents.draw_text(16, 202, 120, 32, "Reserves")
self.contents.draw_text(176, 203, 130, 32, "Reserve Status")
self.contents.draw_text(174, 203, 130, 32, "Reserve Status")
self.contents.draw_text(175, 204, 130, 32, "Reserve Status")
self.contents.draw_text(175, 202, 130, 32, "Reserve Status")
self.contents.font.color = normal_color
self.contents.draw_text(16, 51, 120, 32, "Options")
self.contents.draw_text(16, 203, 120, 32, "Reserves")
self.contents.draw_text(175, 203, 130, 32, "Reserve Status")
end
end

class Window_CurrentParty < Window_Selectable

def initialize
super(0, 0, 480, 200)

self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.opacity = 0
refresh
self.active = false
self.index = -1
end

def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i * 116 + 2
y = 32
actor = $game_party.actors[i]
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(2 + 15, 0, 120, 32, "Current Party")
self.contents.draw_text(-2 + 15, 0, 120, 32, "Current Party")
self.contents.draw_text(15, 2, 120, 32, "Current Party")
self.contents.draw_text(15, -2, 120, 32, "Current Party")
self.contents.font.color = normal_color
self.contents.draw_text(15, 0, 120, 32, "Current Party")
draw_actor_graphicx(actor, x + 20, y + 82)
draw_actor_namex(actor, x, y)
draw_actor_hpx(actor, x - 40, y + 32)
draw_actor_spx(actor, x - 40, y + 64)
end
end

def draw_actor_hpx(actor, x, y, width = 144)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.size = 16
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(hp_x + 2, y, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x - 2, y, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x, y + 2, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x, y - 2, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(hp_x + 50, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 62, y, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 46, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 58, y, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 48, y + 2, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y + 2, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 48, y - 2, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y - 2, 48, 32, actor.maxhp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end

def draw_actor_spx(actor, x, y, width = 144)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.size = 16
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(sp_x + 2, y, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x - 2, y, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x, y + 2, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x, y - 2, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(sp_x + 50, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 62, y, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 46, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 58, y, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 48, y + 2, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y - 2, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 48, y - 2, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y + 2, 48, 32, actor.maxsp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
self.contents.font.size = $fontsize
end
end

def draw_actor_graphicx(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, 180)
end

def draw_actor_namex(actor, x, y)
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 2, y, 120, 32, actor.name)
self.contents.draw_text(x - 2, y, 120, 32, actor.name)
self.contents.draw_text(x, y + 2, 120, 32, actor.name)
self.contents.draw_text(x, y - 2, 120, 32, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index * 116 - 2, 33, 100, 32)
end
end

def update
super
if self.active and @item_max > 0 and @index >= 0

if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end

if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
end
end

class Scene_Change

def initialize(menu_index = 0)
@menu_index = menu_index
end

def main
@spriteset = Spriteset_Map.new
s1 = "add member"
s2 = "remove member"
s3 = "cancel"
@command_window = Window_Command.new(160, [s1, s2, s3])
@command_window.index = @menu_index
@command_window.opacity = 0
@command_window.y = 64
@command_window.back_opacity = 180

@prompt_window = Window_Prompt.new(320, ["Ok"])
@prompt_window.active = false
@prompt_window.visible = false
@prompt_window.x = 320 - @prompt_window.width / 2
@prompt_window.y = 240 - @prompt_window.height / 2
@prompt_window.z = 9999

@prompt_window2 = Window_Prompt2.new(320, ["Yes", "No"])
@prompt_window2.active = false
@prompt_window2.index = -1
@prompt_window2.visible = false
@prompt_window2.x = 320 - @prompt_window.width / 2
@prompt_window2.y = 240 - @prompt_window.height / 2
@prompt_window2.z = 9999


array = []
for i in 1...8 # number of heros! edit required!
actor = $game_actors[i]
if actor != nil
name = actor.name
if $party_variables.available[i - 1] == true
array.push(i.to_s + ". " + name.to_s)
else
array.push("Character Locked")
end
end
end

@reserve_window = Window_Reserve.new(160, array)
@reserve_window.y = 184 + 32
@reserve_window.height = 264
@reserve_window.active = false
@reserve_window.back_opacity = 180

@current_party_window = Window_CurrentParty.new
@current_party_window.x = 160
@current_party_window.y = 32
@current_party_window.active = false
@current_party_window.back_opacity = 180

@actor = $game_actors[@reserve_window.index + 1]
@change_window = Window_Change.new(@actor)
@change_window.x = 160
@change_window.y = 216
@change_window.back_opacity = 180

@dummy_party_window1 = Window_Base.new(160, 64, 480, 120)
@dummy_party_window2 = Window_Base.new(180, 32 + 16, 130, 32)
@dummy_party_window3 = Window_Base.new(0, 64, 160, 120)
@dummy_party_window4 = Window_Base.new(20, 48, 120, 32)
@dummy_party_window5 = Window_Base.new(20, 200, 120, 32)
@dummy_party_window6 = Window_Base.new(180, 200, 144, 32)
@dummy_party_window1.back_opacity = 180
@dummy_party_window3.back_opacity = 180


@title_window = Window_Title.new
@title_window.x = 0
@title_window.y = -20

Graphics.transition
loop do
Graphics.update
Input.update
update

if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@dummy_party_window1.dispose
@dummy_party_window2.dispose
@dummy_party_window3.dispose
@dummy_party_window4.dispose
@dummy_party_window5.dispose
@dummy_party_window6.dispose
@change_window.dispose
@reserve_window.dispose
@prompt_window.dispose
@title_window.dispose
@current_party_window.dispose
@command_window.dispose
end

def update
@change_window.update
@reserve_window.update
@current_party_window.update
@prompt_window2.update
@prompt_window.update
@command_window.update

if @current_party_window.active
update_party
return
end

if @command_window.active
update_command
return
end

if @reserve_window.active
update_reserve
return
end

if @prompt_window.active
update_prompt
return
end

if @prompt_window2.active
update_prompt2
return
end
end

def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if $game_variables[100]==1
 $game_variables[100]=0
 $scene = Scene_Battle.new
else
 $game_variables[100]=0
 $scene = Scene_Map.new
end
return
end

if Input.trigger?(Input::C)
case @command_window.index
when 0
if $game_party.actors.size == 4
$game_system.se_play($data_system.buzzer_se)
@prompt_window.visible = true
@prompt_window.active = true
$prompt_text = 0
@prompt_window.refresh
@command_window.active = false
else
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@reserve_window.active = true
@reserve_window.index = 0
end
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@current_party_window.active = true
@current_party_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
if $game_variables[100]==1
 $game_variables[100]=0
 $scene = Scene_Battle.new
else
 $game_variables[100]=0
 $scene = Scene_Map.new
end
end
end
return
end

def update_party
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@current_party_window.active = false
@current_party_window.index = -1
return
end

if Input.trigger?(Input::C)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
@current_party_window.active = false
@current_party_window.index = -1
@prompt_window.visible = true
@prompt_window.active = true
$prompt_text = 1
@prompt_window.refresh
else
if $party_variables.mandatory[@current_party_window.index] == true
$game_system.se_play($data_system.buzzer_se)
@current_party_window.active = false
@current_party_window.index = -1
@prompt_window.visible = true
@prompt_window.active = true
$prompt_text = 2
@prompt_window.refresh
else
$game_system.se_play($data_system.decision_se)
$game_party.remove_actor($game_party.actors[@current_party_window.index].id)
end
@current_party_window.refresh
@change_window.refresh
end
return
end
end

def update_prompt
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@command_window.active = true
@prompt_window.active = false
@prompt_window.visible = false
return
end
end

def update_prompt2
if Input.trigger?(Input::C)
case @prompt_window2.index
when 0

$game_system.se_play($data_system.decision_se)
$game_party.add_actor(@reserve_window.index + 1)
@change_window.refresh
@current_party_window.refresh

if $game_party.actors.size == 4
@prompt_window2.visible = false
@prompt_window2.active = false
@prompt_window2.index = -1
@command_window.active = true
else
@prompt_window2.active = false
@prompt_window2.visible = false
@prompt_window2.index = -1
@reserve_window.active = true
end
when 1
$game_system.se_play($data_system.buzzer_se)
@prompt_window2.active = false
@prompt_window2.visible = false
@prompt_window2.index = -1
@reserve_window.active = true
return
end
end

if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
@prompt_window2.active = false
@prompt_window2.visible = false
@reserve_window.active = true
@prompt_window2.index = -1
end
end

def update_reserve
@change_window.dispose



if $party_variables.available[@reserve_window.index] == true
changewindow = Window_Change.new($game_actors[@reserve_window.index + 1])
else
changewindow = Window_Unlocked.new
end

@change_window = changewindow
@change_window.back_opacity = 180
@change_window.x = 160
@change_window.y = 216
@old_reserve_window_index = @reserve_window.index
@change_window.refresh if @old_reserve_window_index != @reserve_window.index
@dummy_party_window6.z = 999
@title_window.z = 9990
@prompt_window.z = 9999
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@reserve_window.active = false
@reserve_window.index = -1
end
if Input.trigger?(Input::C)
if changewindow.is_a?(Window_Unlocked)
$game_system.se_play($data_system.buzzer_se)
else
if $addable == 1
$game_system.se_play($data_system.decision_se)
@reserve_window.active = false
@prompt_window2.visible = true
@prompt_window2.active = true
@prompt_window2.index = 0
$prompt_text = 3
@prompt_window2.z = 9999
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
end

class Scene_Title
alias xk8_s_title_main main
def main
xk8_s_title_main
$party_variables = Party_Variables.new
end
end

class Party_Variables

attr_accessor :mandatory
attr_accessor :available

def initialize
@mandatory = [true, false, false, false, false, false, false, false]
@available = [true, true, true, true, true, false, false, false]
end
end
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on March 31, 2006, 10:51:37 PM
Thank you very much Blizzard! Let's test this out  :D
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on March 31, 2006, 11:17:32 PM
When you say to paste above line, you mean to substitute the previous line written?
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 01, 2006, 12:05:14 AM
I
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 01, 2006, 12:38:59 AM
Could you make a little sample demonstration please?
We are still learning this scripting stuff and didn't figure how all this stuff works...  :?
This is our first course on game making and we're still getting the hence of it.
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 01, 2006, 01:14:52 AM
Just go into Scene_Save and under

   Marshal.dump($game_system, file)
   Marshal.dump($game_switches, file)
   Marshal.dump($game_variables, file)
   Marshal.dump($game_self_switches, file)
   Marshal.dump($game_screen, file)
   Marshal.dump($game_actors, file)
   Marshal.dump($game_party, file)
   Marshal.dump($game_troop, file)
   Marshal.dump($game_map, file)
   Marshal.dump($game_player, file)


add this:

Marshal.dump($party_variables, file)

The in Scene_Load under

$game_system        = Marshal.load(file)
   $game_switches      = Marshal.load(file)
   $game_variables     = Marshal.load(file)
   $game_self_switches = Marshal.load(file)
   $game_screen        = Marshal.load(file)
   $game_actors        = Marshal.load(file)
   $game_party         = Marshal.load(file)
   $game_troop         = Marshal.load(file)
   $game_map           = Marshal.load(file)
   $game_player        = Marshal.load(file)


add

$party_variables = Marshal.load(file)

Then open Game_actor and scroll down til the end. It should look like this:

def screen_z
   # ??????????? Z ?????????
   if self.index != nil
     return 4 - self.index
   else
     return 0
   end
 end
end


Replace it with this:

def screen_z
   # ??????????? Z ?????????
   if self.index != nil
     return 4 - self.index
   else
     return 0
   end
 end
 def size
   return @data.size
 end
end


That was pretty unclear in that comment from Xk8... The rest is understandable and NOT necessary.
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 01, 2006, 02:46:49 AM
It works good.
Would be possible using it at battles, the same whay we use on main menu?
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 01, 2006, 09:22:07 AM
Try a skill that calles a common event. In the common event use the call script command and wrtie into it $scene = Scene_Change.new
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 01, 2006, 05:18:25 PM
When this proceed is used, the party change opens, but when it is closed the battle ends.
How could it be done for returning into the same scene?
Title: REQUEST: Party Change/ Reorganize Script
Post by: Supervisor on April 01, 2006, 06:42:34 PM
And again... Blizzard has proven to be the Greatest, The Best and The Master of Scripting...

... Nothing Personal ...
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 01, 2006, 07:00:48 PM
Quote from: SupervisorAnd again... Blizzard has proven to be the Greatest, The Best and The Master of Scripting...

Thanks! :^^:

Ok, listen. I
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 02, 2006, 12:17:05 PM
Hi!

When we use the party change window from the map, or battle, and pulse B to cancel it, it gives a syntax error in the line 688.
And when it is used from the battle and the window is closed by cancel, it comes back to the map scene.
When you said that it must have a command after calling the script of the party change window, you mean to put a comand to set the variable to 1, like:

      Variable: [0100: Party Change] = 1

and then:

      Script: $scene = Scene_Change.new

Though, it must be any mistake on the script on line 688 that giver syntax error everytime, on the map, the party change window is closed by hitting B. When it is used the cancel function, it works well on the map.
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 02, 2006, 02:13:57 PM
Fixed it. Now it will work.
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 02, 2006, 10:00:32 PM
Oh yeah!  :D Now it's fine!
But there is just one litllt thing that doesn't work very well, but its quite irrelevant. When in a battle we change the party, the person that was supposed to attack after the party change user doesn't attack and the action returns to the "Fight/Escape" command.
It is quite irrelevant, but i would like to know if the battle can proceed normally.
Ah! There's one more thing too. Below there, as showed in the SS, how can I fix that font size error?

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fsolemn.no.sapo.pt%2FParty%2520change%2520screenie.jpg&hash=e36bb138f3eb47b20424c49aba5d25546803eea5)


But overall, it is one of the gameplay goals that are achieved already!

Cheers!
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 02, 2006, 11:45:03 PM
This in the corner doesn
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 03, 2006, 12:13:10 AM
Ok, i'll try to do that about the font size.
About the action cancels isnt big deal because it doens't restart the battle completely, it just cancels the next attacks and the battlle proceeds with the monster's and player's same HP/SP and so. :)
Title: REQUEST: Party Change/ Reorganize Script
Post by: Blizzard on April 03, 2006, 12:34:26 AM
Really? When I tried it, I fought against 2 monsters. I killed 1 and after I changed my party and came back into the fight, it was back again. I didn
Title: REQUEST: Party Change/ Reorganize Script
Post by: Evrae on April 03, 2006, 12:43:39 AM
Nop... Is not just you. It happens to me too. When I sue this party change, the monsters come back again. Just the player's Hp/Sp stay the same.
Oh, my... maybe it will be difficult to put that working nicely.