Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
zahraa

question about Party Changing System by Leon_Westbrooke (solved by Lizzie S)

Question

you can lock a party member with this script.but this script locks actor in place.i want to make actors "only" unavailable remove from visible party.i want to be able to change actor place.what shold i change in this script?

 

 

#===================================

# Party Changing System by Leon_Westbrooke

# -v 1.2

#----------------------------------------------------------------------

# Instructions: Place above main, but below all other default scripts.

#

# Features:

# -Allows the player to make a party from the minimum to maximum size.

# -Extra members are limitless.

# -You can remove a person from the party and put it into reserve using:

# $game_party.remove_actor_to_party(actor_id)

# -You can remove a person from the reserve if they exist, and them into

# the party:

# $game_party.add_actor_to_party(actor_id)

# -You can lock a character in reserve or active party by using:

# $game_party.locked.push(actor_id)

# -You can set the maximum and minimum number of the party in-game using:

# $game_party.min_size = x

# $game_party.max_size = x

# (NOTE: Do NOT make the max size lower than the minimum size.)

# -Allows you to use the default add/remove actors command.

# (NOTE: If you remove an actor with this method, he is gone from both

# the party and the reserve members.)

#

# Credits:

# This setup uses SephirothSpawn's coding to simplify the cursor's position.

#

#

# Command Quick-list:

# $game_party.remove_actor_from_party(actor_id)

# -Removes an actor from the party, and puts them in reserve.

# $game_party.add_actor_to_party(actor_id)

# -Replaces the last actor in the party with the actor in reserve.

# $game_party.locked.push(actor_id)

# -Locks the actor in place.

# $game_party.min_size = x

# $game_party.max_size = x

# -Sets the minimum and maximum party size.

#

#

# Notes:

# This script rewrites these methods from Game_Party:

# add_actor

# remove_actor

#===================================

#==================================================

# Game_Party

#==================================================

class Game_Party

attr_accessor :party_members

attr_accessor :move

attr_accessor :locked

attr_accessor :min_size

attr_accessor :max_size

alias leon_partyswitch_gameactor_initialize initialize

def initialize

leon_partyswitch_gameactor_initialize

@party_members = [4]

# Edit :This is to change if an actor is locked or not. To lock them, add

# their id to the array below.

@locked = [1]

@max_size = 4

@min_size = 1

end

 

def add_actor(actor_id)

actor = $game_actors[actor_id]

if @actors.size < @max_size

unless @actors.include?(actor)

unless @party_members.include?(actor.id)

@actors.push(actor)

$game_player.refresh

end

end

else

unless @party_members.include?(actor.id)

unless @actors.include?(actor)

@party_members.push(actor.id)

$game_player.refresh

end

end

end

end

def remove_actor(actor_id)

@actors.delete($game_actors[actor_id])

@party_members.delete(actor_id)

$game_player.refresh

end

def remove_actor_from_party(actor_id)

if @actors.include?($game_actors[actor_id])

unless @party_members.include?(actor_id)

@party_members.push(actor_id)

@party_members.sort!

end

end

@actors.delete($game_actors[actor_id])

$game_player.refresh

end

def add_actor_to_party(actor_id)

if @party_members.include?(actor_id)

if @actors[@max_size - 1] != nil

@party_members.push(@actors[@max_size - 1].id)

@actors.delete_at(@max_size - 1)

end

@actors.push($game_actors[actor_id])

@party_members.delete(actor_id)

end

end

end

#==================================================

# END Game_Party

#==================================================

#==============================================================================

# ** 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

#============================================================

 

#==================================================

# Window_Party_Info

#==================================================

class Window_Party_Info < Window_Base

def initialize

super(0, 0, 640, 64)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

def refresh

self.contents.clear

self.contents.draw_text(0, 0, 614, 32, " party members.", 1)

end

end

#==================================================

# END Window_Party_Info

#==================================================

 

#==================================================

# Window_Party_Slots

#==================================================

class Window_Party_Slots < Window_Selectable

def initialize

super(0, 64, 320, 416)

@item_max = 4

self.contents = Bitmap.new(width - 32, height - 32)

self.index = 0

self.active = true

refresh

end

def actors

if @data[index] != nil

return @data[index]

end

end

def refresh

@data = []

if self.contents != nil

self.contents.dispose

self.contents = nil

end

for i in 0...$game_party.actors.size

@data.push($game_party.actors)

end

@item_max = (@data.size + 1)

if @item_max > 0

if @item_max > 4

@item_max = 4

end

self.contents = Bitmap.new(width - 32, row_max * 96)

for i in 0...@item_max

draw_item(i)

end

end

end

def draw_item(index)

@actor = @data[index]

y = index * 96

x = 4

if $game_party.locked.include?(@actor.id)

self.contents.font.color = disabled_color

opacity = 128

else

self.contents.font.color = normal_color

opacity = 255

end

if @actor != nil

self.contents.draw_text(x + 100, y, 192, 32, @actor.name)

draw_actor_hp(@actor, x + 100, y + 32)

draw_actor_sp(@actor, x + 100, y + 64)

bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)

cw = bitmap.width / 4

ch = bitmap.height / 4

facing = 0

src_rect = Rect.new(0, facing * ch, cw, ch)

self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)

end

end

def update_cursor_rect

if @index > -1

x = 0

y = index * 96

self.cursor_rect.set(x, y, (self.width - 32), 96)

else

self.cursor_rect.empty

end

end

end

#==================================================

# END Window_Party_Slots

#==================================================

 

#==================================================

# Window_Party_Extras

#==================================================

class Window_Party_Extras < Window_Selectable

def initialize

super(320, 64, 320, 416)

self.cursor_height = 96

self.contents = Bitmap.new(width - 32, height - 32)

self.index = -1

self.active = false

refresh

end

def actors

if @data != nil

return @data[index]

end

end

def refresh

if self.contents != nil

self.contents.dispose

self.contents = nil

end

@data = []

for i in 0...$game_party.party_members.size

@data.push($game_actors[$game_party.party_members])

end

@data.push(nil)

@item_max = @data.size

if @item_max > 0

self.contents = Bitmap.new(width - 32, row_max * 96)

for i in 0...@item_max

draw_item(i)

end

end

end

def draw_item(index)

@actor = @data[index]

y = index * 96

x = 4

if $game_party.locked.include?(@actor.id)

self.contents.font.color = disabled_color

opacity = 128

else

self.contents.font.color = normal_color

opacity = 255

end

if @actor != nil

self.contents.draw_text(x + 100, y, 192, 32, @actor.name)

draw_actor_hp(@actor, x + 100, y + 32)

draw_actor_sp(@actor, x + 100, y + 64)

bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)

cw = bitmap.width / 4

ch = bitmap.height / 4

facing = 0

src_rect = Rect.new(0, facing * ch, cw, ch)

self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)

end

end

end

#===================================

# END Window_Party_Extras

#===================================

 

#===================================

# Scene_Party_Change

#===================================

class Scene_Party_Change

def main

 

@info_window = Window_Party_Info.new

@slot_window = Window_Party_Slots.new

@extra_window = Window_Party_Extras.new

 

Graphics.transition

loop do

Graphics.update

Input.update

update

if $scene != self

break

end

end

Graphics.freeze

 

@info_window.dispose

@slot_window.dispose

@extra_window.dispose

end

def update

@slot_window.update

 

if @slot_window.active

update_slot

return

end

 

if @extra_window.active

update_extra

return

end

end

def update_slot

if Input.trigger?(Input::B)

if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size

$game_player.refresh

$game_system.se_play($data_system.cancel_se)

$scene = Scene_Map.new

else

$game_system.se_play($data_system.buzzer_se)

end

end

 

if Input.trigger?(Input::C)

if $game_party.locked.include?(@slot_window.actors.id) == true

$game_system.se_play($data_system.buzzer_se)

else

$game_system.se_play($data_system.decision_se)

@slot_window.active = false

@extra_window.active = true

@extra_window.index = 0

end

end

end

def update_extra

@extra_window.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

@slot_window.active = true

@extra_window.active = false

@extra_window.index = -1

end

 

if Input.trigger?(Input::C)

$game_system.se_play($data_system.decision_se)

if $game_party.locked.include?(@extra_window.actors.id)

$game_system.se_play($data_system.buzzer_se)

return

end

if @extra_window.actors == nil

if $game_party.actors[@slot_window.index] != nil

$game_party.party_members.push($game_party.actors[@slot_window.index].id)

$game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)

$game_party.party_members.sort!

@slot_window.refresh

@extra_window.refresh

@slot_window.active = true

@extra_window.active = false

@extra_window.index = -1

else

@slot_window.active = true

@extra_window.active = false

@extra_window.index = -1

end

else

if $game_party.actors[@slot_window.index] != nil

hold = @extra_window.actors

$game_party.party_members.push($game_party.actors[@slot_window.index].id)

$game_party.actors[@slot_window.index] = hold

$game_party.party_members.delete_at(@extra_window.index)

$game_party.party_members.sort!

@slot_window.refresh

@extra_window.refresh

@slot_window.active = true

@extra_window.active = false

@extra_window.index = -1

else

$game_party.actors[@slot_window.index] = @extra_window.actors

$game_party.party_members.delete_at(@extra_window.index)

$game_party.party_members.sort!

@slot_window.refresh

@extra_window.refresh

@slot_window.active = true

@extra_window.active = false

@extra_window.index = -1

end

end

end

end

end

 

 

 

 

thanks!

Edited by zahraa

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

3 things...

 

1. You should use a code inside of spoiler, so the indents stay, making it easier to read the code.

 

2. I'm so touched many of my scripts are STILL being used!

 

3. I'll look into it right now. happy.png

 

 

 

EDIT: I'mma have to rewrite this script some, and add a new window. It'll take a little time, but I'll get it done asap.

Share this post


Link to post
Share on other sites
  • 0

Okay, I do believe this should make you VERY happy:

 

 

#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.2
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.
#
#  Features:
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#	   $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#	 the party:
#	   $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#	   $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#	   $game_party.min_size = x
#	   $game_party.max_size = x
#	   (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#	   (NOTE: If you remove an actor with this method, he is gone from both
#			  the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#	  -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#	  -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#	  -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#	  -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#	  add_actor
#	  remove_actor
#===================================

#==================================================
#  Game_Party
#==================================================
class Game_Party

 attr_accessor :party_members
 attr_accessor :move
 attr_accessor :locked
 attr_accessor :min_size
 attr_accessor :max_size

 alias leon_partyswitch_gameactor_initialize initialize

 def initialize
   leon_partyswitch_gameactor_initialize
   @party_members = []
   #  Edit :This is to change if an actor is locked or not. To lock them, add
   #	    their id to the array below.
   @locked = [1]
   @min_size = 1
   @max_size = 4
 end


 def add_actor(actor_id)
   actor = $game_actors[actor_id]
   if @actors.size < @max_size
  unless @actors.include?(actor)
    unless @party_members.include?(actor.id)
	  @actors.push(actor)
	  $game_player.refresh
    end
  end
   else
  unless @party_members.include?(actor.id)
    unless @actors.include?(actor)
	  @party_members.push(actor.id)
	  $game_player.refresh
    end
  end
   end
 end

 def remove_actor(actor_id)
   @actors.delete($game_actors[actor_id])
   @party_members.delete(actor_id)
   $game_player.refresh
 end

 def remove_actor_from_party(actor_id)
   if @actors.include?($game_actors[actor_id])
  unless @party_members.include?(actor_id)
    @party_members.push(actor_id)
    @party_members.sort!
  end
   end
    @actors.delete($game_actors[actor_id])
   $game_player.refresh
 end

 def add_actor_to_party(actor_id)
   if @party_members.include?(actor_id)
  if @actors[@max_size - 1] != nil
    @party_members.push(@actors[@max_size - 1].id)
    @actors.delete_at(@max_size - 1)
  end
  @actors.push($game_actors[actor_id])
  @party_members.delete(actor_id)
   end
 end
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** 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
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
 def initialize
   super(0, 0, 640, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end

 def refresh
   self.contents.clear
   self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
 end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

 def initialize
   super(0, 64, 320, 416)
   @item_max = 4
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = 0
   self.active = true
   refresh
 end

 def actors
   if @data[index] != nil
  return @data[index]
   end
 end

 def refresh
   @data = []
   if self.contents != nil
  self.contents.dispose
  self.contents = nil
   end
   for i in 0...$game_party.actors.size
  @data.push($game_party.actors[i])
   end
   @item_max = (@data.size + 1)
   if @item_max > 0
  if @item_max > 4
    @item_max = 4
  end
  self.contents = Bitmap.new(width - 32, row_max * 96)
  for i in 0...@item_max
    draw_item(i)
  end
   end
 end

 def draw_item(index)
   @actor = @data[index]
   y = index * 96
   x = 4
   if $game_party.locked.include?(@actor.id)
  self.contents.font.color = Color.new(128, 128, 0, 255) #EDIT
  opacity = 128
   else
  self.contents.font.color = normal_color
  opacity = 255
   end
   if @actor != nil
  self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
  draw_actor_hp(@actor, x + 100, y + 32)
  draw_actor_sp(@actor, x + 100, y + 64)
  bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  facing = 0
  src_rect = Rect.new(0, facing * ch, cw, ch)
  self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
   end
 end

 def update_cursor_rect
   if @index > -1
  x = 0
  y = index * 96
  self.cursor_rect.set(x, y, (self.width - 32), 96)
   else
  self.cursor_rect.empty
   end
 end

end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  *  Window_Party_Slots_Shadow
#==================================================
class Window_Party_Slots_Shadow < Window_Selectable

 def initialize
   super(0, 64, 320, 416)
   @item_max = 4
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = -1
   self.active = false
   self.z += 200
   self.back_opacity = 0
   refresh
 end

 def refresh
   self.contents.clear
 end

 def update_cursor_rect
   if @index > -1
  x = 0
  y = index * 96
  self.cursor_rect.set(x, y, (self.width - 32), 96)
   else
  self.cursor_rect.empty
   end
 end
end
#==================================================
# END Window_Party_Slots_Shadow
#==================================================





#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
 def initialize
   super(320, 64, 320, 416)
   self.cursor_height = 96
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = -1
   self.active = false
   refresh
 end

 def actors
   if @data != nil
  return @data[index]
   end
 end

 def refresh
   if self.contents != nil
  self.contents.dispose
  self.contents = nil
   end
   @data = []
   for i in 0...$game_party.party_members.size
  @data.push($game_actors[$game_party.party_members[i]])
   end
   @data.push(nil)
   @item_max = @data.size
   if @item_max > 0
  self.contents = Bitmap.new(width - 32, row_max * 96)
  for i in 0...@item_max
    draw_item(i)
  end
   end
 end

 def draw_item(index)
   @actor = @data[index]
   y = index * 96
   x = 4
   if $game_party.locked.include?(@actor.id)
  self.contents.font.color = Color.new(128, 128, 0, 255)
  opacity = 128
   else
  self.contents.font.color = normal_color
  opacity = 255
   end
   if @actor != nil
  self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
  draw_actor_hp(@actor, x + 100, y + 32)
  draw_actor_sp(@actor, x + 100, y + 64)
  bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  facing = 0
  src_rect = Rect.new(0, facing * ch, cw, ch)
  self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
   end
 end

end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
 def main

   @info_window = Window_Party_Info.new
   @slot_window = Window_Party_Slots.new
   @extra_window = Window_Party_Extras.new
   @shadow_window = Window_Party_Slots_Shadow.new

   Graphics.transition
   loop do
  Graphics.update
  Input.update
  update
  if $scene != self
    break
  end
   end
   Graphics.freeze

   @info_window.dispose
   @slot_window.dispose
   @extra_window.dispose
   @shadow_window.dispose
 end

 def update
   @slot_window.update

   if @slot_window.active
  update_slot
  return
   end

   if @extra_window.active
  update_extra
  return
   end

   if @shadow_window.active
  update_shadow
  return
   end

 end

 def update_slot
   if Input.trigger?(Input::B)
  if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
    $game_player.refresh
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Map.new
  else
    $game_system.se_play($data_system.buzzer_se)
  end
   end

   if Input.trigger?(Input::C)
  if $game_party.locked.include?(@slot_window.actors.id) == true
    $game_system.se_play($data_system.decision_se)
    @shadow_window.active = true
    @slot_window.active = false
    @shadow_window.index = @slot_window.index
  else
    $game_system.se_play($data_system.decision_se)
    @slot_window.active = false
    @extra_window.active = true
    @extra_window.index = 0
  end
   end
 end

 def update_extra
   @extra_window.update
   if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @slot_window.active = true
  @extra_window.active = false
  @extra_window.index = -1
   end

   if Input.trigger?(Input::LEFT)
  @shadow_window.active = true
  @extra_window.active = false
  @shadow_window.index = @extra_window.index
  @extra_window.index = -1
   end

   if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  if $game_party.locked.include?(@extra_window.actors.id)
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  if @extra_window.actors == nil
    if $game_party.actors[@slot_window.index] != nil
	  $game_party.party_members.push($game_party.actors[@slot_window.index].id)
	  $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    else
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    end
  else
    if $game_party.actors[@slot_window.index] != nil
	  hold = @extra_window.actors
	  $game_party.party_members.push($game_party.actors[@slot_window.index].id)
	  $game_party.actors[@slot_window.index] = hold
	  $game_party.party_members.delete_at(@extra_window.index)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    else
	  $game_party.actors[@slot_window.index] = @extra_window.actors
	  $game_party.party_members.delete_at(@extra_window.index)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    end
  end
   end
 end

 def update_shadow
   @shadow_window.update
   if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @slot_window.active = true
  @shadow_window.active = false
  @shadow_window.index = -1
   end

   if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  hold = $game_party.actors[@shadow_window.index]
  $game_party.actors[@shadow_window.index] = $game_party.actors[@slot_window.index]
  $game_party.actors[@slot_window.index] = hold
  @slot_window.refresh
  @slot_window.active = true
  @shadow_window.active = false
  @shadow_window.index = -1
  return
   end

   if Input.trigger?(Input::RIGHT)
  if $game_party.locked.include?($game_party.actors[@slot_window.index].id)
    $game_system.se_play($data_system.buzzer_se)
  else
    @shadow_window.active = false
    @extra_window.active = true
    @extra_window.index = @shadow_window.index
    @shadow_window.index = -1
  end
   end

 end
end

 

 

Share this post


Link to post
Share on other sites
  • 0

everything is excellent.only one problem.when i call this script : $scene = Scene_Party_Change.new ,and want to back to game,i press Esc but nothing happen

 

Edit :nevermind!!!

 

and a favor:when you go to this party change system,you can put an empty bar in first place(leader place)and if someone do it,there comes an error

you can try this to understand it better

 

.please change this script that it put the first member automatically in leader place,IF THIS WAS EMPTY

 

if you like to help me, PLEASE answer.this is VERY VERY important for me

Edited by zahraa

Share this post


Link to post
Share on other sites
  • 0

everything is excellent.only one problem.when i call this script,i can't back to game.

and a question:my game start with one party member and if someone change member place with one of empty bars,first this error comes:

 

script 'game_player line 106:NoMethodError occurred.

undefined method 'character_name' for nil:NilClass

 

and if you change somethings,character disappear.what is the solution? try this to understand it better.

 

i think you can tell the computer:if leader's place was empty,put the first character in it (with script)

 

please answer to it.this is very very very important for me

 

thank you soooooooooo much

Share this post


Link to post
Share on other sites
  • 0

Ok. I believe I got all the bugs out. I spent like... 5 minutes testing it.

 

 

#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.2
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.
#
#  Features:
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#	   $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#	 the party:
#	   $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#	   $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#	   $game_party.min_size = x
#	   $game_party.max_size = x
#	   (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#	   (NOTE: If you remove an actor with this method, he is gone from both
#			  the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#	  -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#	  -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#	  -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#	  -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#	  add_actor
#	  remove_actor
#===================================

#==================================================
#  Game_Party
#==================================================
class Game_Party

 attr_accessor :party_members
 attr_accessor :move
 attr_accessor :locked
 attr_accessor :min_size
 attr_accessor :max_size
 attr_accessor :actors

 alias leon_partyswitch_gameactor_initialize initialize

 def initialize
   leon_partyswitch_gameactor_initialize
   @party_members = []
   #  Edit :This is to change if an actor is locked or not. To lock them, add
   #	    their id to the array below.
   @locked = [1]
   @min_size = 1
   @max_size = 4
 end


 def add_actor(actor_id)
   actor = $game_actors[actor_id]
   if @actors.size < @max_size
  unless @actors.include?(actor)
    unless @party_members.include?(actor.id)
	  @actors.push(actor)
	  $game_player.refresh
    end
  end
   else
  unless @party_members.include?(actor.id)
    unless @actors.include?(actor)
	  @party_members.push(actor.id)
	  $game_player.refresh
    end
  end
   end
 end

 def remove_actor(actor_id)
   @actors.delete($game_actors[actor_id])
   @party_members.delete(actor_id)
   $game_player.refresh
 end

 def remove_actor_from_party(actor_id)
   if @actors.include?($game_actors[actor_id])
  unless @party_members.include?(actor_id)
    @party_members.push(actor_id)
    @party_members.sort!
  end
   end
   @actors.delete($game_actors[actor_id])
   $game_player.refresh
 end

 def add_actor_to_party(actor_id)
   if @party_members.include?(actor_id)
  if @actors[@max_size - 1] != nil
    @party_members.push(@actors[@max_size - 1].id)
    @actors.delete_at(@max_size - 1)
  end
  @actors.push($game_actors[actor_id])
  @party_members.delete(actor_id)
   end
 end
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** 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
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
 def initialize
   super(0, 0, 640, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end

 def refresh
   self.contents.clear
   self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
 end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

 def initialize
   super(0, 64, 320, 416)
   @item_max = 4
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = 0
   self.active = true
   refresh
 end

 def actors
   if @data[index] != nil
  return @data[index]
   end
 end

 def refresh
   @data = []
   if self.contents != nil
  self.contents.dispose
  self.contents = nil
   end
   for i in 0...$game_party.actors.size
  @data.push($game_party.actors[i])
   end
   @item_max = (@data.size + 1)
   if @item_max > 0
  if @item_max > 4
    @item_max = 4
  end
  self.contents = Bitmap.new(width - 32, row_max * 96)
  for i in 0...@item_max
    draw_item(i)
  end
   end
 end

 def draw_item(index)
   @actor = @data[index]
   y = index * 96
   x = 4
   if $game_party.locked.include?(@actor.id)
  self.contents.font.color = Color.new(128, 128, 0, 255) #EDIT
  opacity = 128
   else
  self.contents.font.color = normal_color
  opacity = 255
   end
   if @actor != nil
  self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
  draw_actor_hp(@actor, x + 100, y + 32)
  draw_actor_sp(@actor, x + 100, y + 64)
  bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  facing = 0
  src_rect = Rect.new(0, facing * ch, cw, ch)
  self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
   end
 end

 def update_cursor_rect
   if @index > -1
  x = 0
  y = index * 96
  self.cursor_rect.set(x, y, (self.width - 32), 96)
   else
  self.cursor_rect.empty
   end
 end

end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  *  Window_Party_Slots_Shadow
#==================================================
class Window_Party_Slots_Shadow < Window_Selectable

 def initialize
   super(0, 64, 320, 416)
   @item_max = 4
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = -1
   self.active = false
   self.z += 200
   self.back_opacity = 0
   refresh
 end

 def refresh
   self.contents.clear
 end

 def update_cursor_rect
   if @index > -1
  x = 0
  y = index * 96
  self.cursor_rect.set(x, y, (self.width - 32), 96)
   else
  self.cursor_rect.empty
   end
 end
end
#==================================================
# END Window_Party_Slots_Shadow
#==================================================





#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
 def initialize
   super(320, 64, 320, 416)
   self.cursor_height = 96
   self.contents = Bitmap.new(width - 32, height - 32)
   self.index = -1
   self.active = false
   refresh
 end

 def actors
   if @data != nil
  return @data[index]
   end
 end

 def refresh
   if self.contents != nil
  self.contents.dispose
  self.contents = nil
   end
   @data = []
   for i in 0...$game_party.party_members.size
  @data.push($game_actors[$game_party.party_members[i]])
   end
   @data.push(nil)
   @item_max = @data.size
   if @item_max > 0
  self.contents = Bitmap.new(width - 32, row_max * 96)
  for i in 0...@item_max
    draw_item(i)
  end
   end
 end

 def draw_item(index)
   @actor = @data[index]
   y = index * 96
   x = 4
   if $game_party.locked.include?(@actor.id)
  self.contents.font.color = Color.new(128, 128, 0, 255)
  opacity = 128
   else
  self.contents.font.color = normal_color
  opacity = 255
   end
   if @actor != nil
  self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
  draw_actor_hp(@actor, x + 100, y + 32)
  draw_actor_sp(@actor, x + 100, y + 64)
  bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  facing = 0
  src_rect = Rect.new(0, facing * ch, cw, ch)
  self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
   end
 end

end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
 def main

   @info_window = Window_Party_Info.new
   @slot_window = Window_Party_Slots.new
   @extra_window = Window_Party_Extras.new
   @shadow_window = Window_Party_Slots_Shadow.new

   Graphics.transition
   loop do
  Graphics.update
  Input.update
  update
  if $scene != self
    break
  end
   end
   Graphics.freeze

   @info_window.dispose
   @slot_window.dispose
   @extra_window.dispose
   @shadow_window.dispose
 end

 def update
   @slot_window.update

   if @slot_window.active
  update_slot
  return
   end

   if @extra_window.active
  update_extra
  return
   end

   if @shadow_window.active
  update_shadow
  return
   end

 end

 def update_slot
   if Input.trigger?(Input::B)
  if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
    $game_player.refresh
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Map.new
  else
    $game_system.se_play($data_system.buzzer_se)
  end
   end

   if Input.trigger?(Input::C)
  if $game_party.locked.include?(@slot_window.actors.id) == true
    $game_system.se_play($data_system.decision_se)
    @shadow_window.active = true
    @slot_window.active = false
    @shadow_window.index = @slot_window.index
  else
    $game_system.se_play($data_system.decision_se)
    @slot_window.active = false
    @extra_window.active = true
    @extra_window.index = 0
  end
   end
 end

 def update_extra
   @extra_window.update
   if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @slot_window.active = true
  @extra_window.active = false
  @extra_window.index = -1
   end

   if Input.trigger?(Input::LEFT)
  @shadow_window.active = true
  @extra_window.active = false
  @shadow_window.index = @extra_window.index
  @extra_window.index = -1
   end

   if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  if $game_party.locked.include?(@extra_window.actors.id)
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  if @extra_window.actors == nil
    if $game_party.actors[@slot_window.index] != nil
	  $game_party.party_members.push($game_party.actors[@slot_window.index].id)
	  $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    else
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    end
  else
    if $game_party.actors[@slot_window.index] != nil
	  hold = @extra_window.actors
	  $game_party.party_members.push($game_party.actors[@slot_window.index].id)
	  $game_party.actors[@slot_window.index] = hold
	  $game_party.party_members.delete_at(@extra_window.index)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    else
	  $game_party.actors[@slot_window.index] = @extra_window.actors
	  $game_party.party_members.delete_at(@extra_window.index)
	  $game_party.party_members.sort!
	  @slot_window.refresh
	  @extra_window.refresh
	  @slot_window.active = true
	  @extra_window.active = false
	  @extra_window.index = -1
    end
  end
   end
 end

 def update_shadow
   @shadow_window.update
   if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  @slot_window.active = true
  @shadow_window.active = false
  @shadow_window.index = -1
   end

   if Input.trigger?(Input::C)
  $game_system.se_play($data_system.decision_se)
  hold = $game_party.actors[@shadow_window.index]
  $game_party.actors[@shadow_window.index] = $game_party.actors[@slot_window.index]
  $game_party.actors[@slot_window.index] = hold
  array = []
  for i in 0...4
    if $game_party.actors[i] != nil
	  array.push($game_party.actors[i])
    end
  end
  $game_party.actors = array
  $game_party.party_members.sort!
  @slot_window.refresh
  @slot_window.active = true
  @shadow_window.active = false
  @shadow_window.index = -1
  return
   end

   if Input.trigger?(Input::RIGHT)
  if $game_party.locked.include?($game_party.actors[@slot_window.index].id)
    $game_system.se_play($data_system.buzzer_se)
  else
    @shadow_window.active = false
    @extra_window.active = true
    @extra_window.index = @shadow_window.index
    @shadow_window.index = -1
  end
   end

 end
end

 

Share this post


Link to post
Share on other sites
  • 0

Excellent Excellent Excellent!!!!!biggrin_002.gif1.png1.png1.png1.png1.png1.png1.png

you did it!yooooohoooooo!clap.gif

thank you one million time!icon12.gificon12.gificon12.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...