Save-Point
Character Select Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: Character Select Script (/thread-2724.html)



Character Select Script - Selwyn - 03-03-2008

Character Select Script
by Selwyn


INTRODUCTION
Selwyn @ HBGames.Org Mon Jun 19, 2006 Wrote:~~requested by Hitomi Kamimura~~

this allows you to make a party by selecting the characters that will be in it.

paste the script in a new section above main


SCREENSHOTS
[Image: chselect.PNG]


SCRIPT
The Script


HOW TO USE
first, you need to decide what characters you will display on the select screen, go in the database and write down the id of the characters you want.
(example : 1 arshes, 7 gloria, etc...)

once you have those number, use the call script command in an event, and write them in that way : (I took some other to have 6 characters)

Code:
ids = [1, 7, 5, 6, 4, 2]
then, you have to decide how many characters the player will be able to add to the party, let's say 4
so add this after the 'ids = ' thing :
Code:
$scene = Scene_CharSelect.new(ids, 4)
which should look like this :
Code:
ids = [1, 7, 5, 6, 4, 2]
$scene = Scene_CharSelect.new(ids, 4)
and that's done.


TERMS AND CONDITIONS
Enjoy, Give Credit.


RE: Character Select Script - JayRay - 02-25-2017

I sorta love this script, but big problem I see...

when you want to choose from more than 6 IDs, the main window that "SHOULD" scroll down to show all the characters, does not. I also can't see why it can't Any reason why?


RE: Character Select Script - DerVVulfman - 02-26-2017

Because Selwyn did not include redesigned versions of the 'top_row', the 'top_row=' and 'page_row_max' methods within Window_CharSelect. Couple that with a incorrectly designed 'update_cursor_rect' because he DID neglect to include reference to the redesiged methods.

So.... add the following methods to Window_CharSelect:
Code:
#--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of 192
    return self.oy / 192
  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 * 192
  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 32
    return (self.height - 32) / 192
  end

And replace the 'update_cursor_rect' in the class with THIS one:
Code:
#--------------------------------------------------------------------------
  # (>^_^)>   update_cursor_rect
  #--------------------------------------------------------------------------
  def update_cursor_rect
    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 * (148 + 1)
    y = @index / @column_max * 192 - self.oy
    # Update cursor rectangle
    self.cursor_rect.set(x, y, 149, 192)
  end

5 minutes bay bee.


RE: Character Select Script - JayRay - 03-07-2017

You..... are awesome, you know that?