CrowMakerVX

CharacterEditor

Jan 13th, 2013
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 31.06 KB | None | 0 0
  1. ################################################################################
  2. #                            CHARACTER EDITOR
  3. #                                 with
  4. #                        Extended Actor Parameters
  5. #                               By: Ixfuru
  6. ################################################################################
  7. # This is a rather simplistic Character Editor/Creator that I put together.  
  8. # This scirpt allows you to alter the graphics used for actors through a
  9. # Creation Scene.  You can add files to the selectable images which will
  10. # allow you to offer any face/character graphic combination as choice to the
  11. # player.  This would also be good for the beginnig of projects, where the
  12. # player can select his/her character before beginning the quest.
  13. # Just place the script above Main and below Materials in the script editor of
  14. # your project.   Then, when you want to call the scene, use the script call:
  15. #
  16. #       $scene = Scene_CharCreate.new(party_position, false)
  17. #
  18. # Replace party_position with the position of the actor in your party.  For
  19. # the leader of the party, place 0.  By default, You could change Ralph with:
  20. #                 $scene = Scene_CharCreate.new(0, false)
  21. #
  22. # The boolean should be kept at false for now, as it makes reference to a script
  23. # I'm not quite finished with yet.  With that script, you'll be able to access
  24. # this editor from the main menu.
  25. #
  26. ################################################################################
  27. # Read through each of the customization options in the module carefully to
  28. # understand the setup of this script.  By default, I set up the module to
  29. # provide most of the faces and characters in the RTP.  You'll notice that I
  30. # commented out some filenames in the MALES and FEMALES sections because they
  31. # were custom graphics and unless you picked up the demo, they will cause an
  32. # error when they are not found in your project.  If you got the demo, feel free
  33. # to uncomment the lines and everything should run smoothly.
  34. # Also, if you do, be sure to give credit to FenixFyre and RPGLover who made
  35. # these graphics.
  36. ################################################################################
  37. # You can use this script in any NON-COMMERCIAL project you wish.  If you want to
  38. # make something commercial which includes the script, just contact me at
  39. # RPGMakerVX.net or on RMRK.net and we'll discuss it.
  40. # Either way, you MUST credit IXFURU in the final project if you use it.
  41. ################################################################################
  42.  
  43. ################################################################################
  44. #*******************************************************************************
  45. #                       MODULE CHARCREATE
  46. ################################################################################
  47. module CharCreate
  48.  
  49.   #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  50.   #                         BEGIN CUSTOMIZATION
  51.   #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  52.  
  53.   #                       SECTION ONE
  54.   #
  55.   # In this section, you will place the selectable graphics you wish to include
  56.   # in the editor scene.  These will be the faces and character graphics the
  57.   # player can choose from when editting/creating their characters.  To set it
  58.   # up, use this formula:
  59.   #      
  60.   #             ID => [face/char graphic, face/char index]
  61.   #
  62.   # An important note is that you must have a matching face and character to
  63.   # any filenames you place in the formula.   If not, an error will be thrown.
  64.   # Also, the ID, should be an integer equal or above zero in numeric order.  The
  65.   # graphic is the sheet you want to use, and the index is the actual index of the
  66.   # character you wish to be able to select. This formula is applicable for both
  67.   # the MALES and FEMALES portion of the module.
  68.  
  69.   MALES = {#<<<Don't delete this!
  70.  
  71.   0 => ["Actor1", 0],
  72.   1 => ["Actor1", 2],
  73.   2 => ["Actor1", 6],
  74.   3 => ["Actor1", 7],
  75.   4 => ["Actor2", 2],
  76.   5 => ["Actor2", 4],
  77.   6 => ["Actor2", 6],
  78.   7 => ["Actor3", 0],
  79.   8 => ["Actor3", 2],
  80.   9 => ["Actor3", 4],
  81.   10 => ["Actor3", 6],
  82.   11 => ["Evil", 0],
  83.   12 => ["Evil", 1],
  84.   13 => ["Evil", 2],
  85.   14 => ["Evil", 3],
  86.   15 => ["Evil", 4],
  87.   16 => ["Evil", 5],
  88.   17 => ["Evil", 6],
  89.   18 => ["Evil", 7],
  90.   19 => ["Monster", 2],
  91.   20 => ["Monster", 4],
  92.   21 => ["People1", 4],
  93.   22 => ["People1", 6],
  94.   23 => ["People2", 0],
  95.   24 => ["People2", 2],
  96.   25 => ["People2", 3],
  97.   26 => ["People2", 4],
  98.   27 => ["People2", 6],
  99.   28 => ["People3", 1],
  100.   29 => ["People3", 3],
  101.   30 => ["People3", 4],
  102.   31 => ["People4", 0],
  103.   32 => ["People4", 2],
  104.   33 => ["People4", 4],
  105.   34 => ["People4", 5],
  106.   35 => ["People4", 6],
  107.   36 => ["People4", 7],
  108.   37 => ["Spiritual", 7],
  109. #~   38 => ["FenixFyre", 2],
  110. #~   39 => ["RPGLover", 0],
  111. #~   40 => ["RPGLover", 1],
  112. #~   41 => ["RPGLover", 2],
  113. #~   42 => ["RPGLover", 4],
  114. #~   43 => ["RPGLover", 5],
  115.  
  116.   }#<<<Don't delete this!
  117.  
  118.   FEMALES = {#<<<Don't delete this!
  119.  
  120.   0 => ["Actor1", 1],
  121.   1 => ["Actor1", 3],
  122.   2 => ["Actor1", 4],
  123.   3 => ["Actor1", 5],
  124.   4 => ["Actor2", 0],
  125.   5 => ["Actor2", 1],
  126.   6 => ["Actor2", 3],
  127.   7 => ["Actor2", 5],
  128.   8 => ["Actor2", 7],
  129.   9 => ["Actor3", 1],
  130.   10 => ["Actor3", 3],
  131.   11 => ["Actor3", 5],
  132.   12 => ["Actor3", 7],
  133.   13 => ["Monster", 5],
  134.   14 => ["People1", 5],
  135.   15 => ["People1", 7],
  136.   16 => ["People2", 1],
  137.   17 => ["People2", 5],
  138.   18 => ["People2", 7],
  139.   19 => ["People3", 0],
  140.   20 => ["People3", 2],
  141.   21 => ["People3", 5],
  142.   22 => ["People3", 7],
  143.   23 => ["People4", 1],
  144.   24 => ["People4", 3],
  145.   25 => ["Spiritual", 0],
  146.   26 => ["Spiritual", 1],
  147.   27 => ["Spiritual", 3],
  148.   28 => ["Spiritual", 4],
  149.   29 => ["Spiritual", 5],
  150.   30 => ["Spiritual", 6],
  151. #~   31 => ["FenixFyre", 1],
  152. #~   32 => ["FenixFyre", 0],
  153. #~   33 => ["RPGLover", 3],
  154.  
  155.   }#<<<Don't delete this!
  156.  
  157.   #                              SECTION TWO
  158.   #
  159.   # Hometowns are a custom string associated with the actors.  You can use any
  160.   # text you want in the array, as long as it's "" double quoted.
  161.  
  162.   HOMETOWNS = ["Bell Toll", "Rychestown", "Metchfield", "Blumbogan", "Strott"]
  163.  
  164.   #                       SECTION THREE
  165.   #
  166.   # These are the commands you wish to appear in the scene.  The 'categories' the
  167.   # player gets to select from.  These are just strings.  So you must have
  168.   # a double quoted text for each of these.
  169.  
  170.   NAME_COMMAND = "Select Name"
  171.   GENDER_COMMAND = "Select Gender"
  172.   CHARACTER_COMMAND = "Select Character"
  173.   CLASS_COMMAND = "Select Class"
  174.   HOMETOWN_COMMAND = "Select Hometown"
  175.   READY_COMMAND = "READY!"
  176.  
  177.   #                        SECTION FOUR
  178.   #
  179.   # The following are miscellaneous items which are found in the script.  They
  180.   # control sound effects, strings, colors, etc.  An explanatin is found next
  181.   # to each of the constants.
  182.  
  183.   READY_COMMAND_COLOR = 23       # This is the color of the READY_COMMAND string
  184.  
  185.   PREVIEW_NAME_COLOR = 5             #Color of Actors name in preview window
  186.   PREVIEW_GENDER_COLOR = 10           # Color of gender string in preview window
  187.   PREVIEW_CLASS_COLOR = 15            # color of class name in preview window
  188.   PREVIEW_HOMETOWN_COLOR = 20         # color of hometown in preveiew window
  189.  
  190.   AVAILABLE_CLASSES = 8             # Amount of classes to choose from.  (1 - X)
  191.  
  192.   CCS_USE_RECRUIT_SHOPS = false       # Are you using my recruit shop script?
  193.   CCS_USE_MENUFURU = false           # Are you using my menu overhaul script?
  194.  
  195.   # These strings are used to set gender of specific actors found in your
  196.   # party at the beginning of the game.
  197.  
  198.   ACTOR_INITIAL_GENDER = {#<<<Don't touch this!
  199.  
  200.     1 => "Male",
  201.     2 => "Female",
  202.     3 => "Male",
  203.     4 => "Female",
  204.  
  205.   }#<<<<Don't touch this!
  206.  
  207.   HOMETOWN_TAG = "HOME"              # This is the sytem tag for where hometown
  208.   #                                      is found in the status window
  209.   GENDER_COLORS = [1, 27]           # These are the text colors used for display
  210.   #                                     of Gender marker.  By default, it's
  211.   #                                   blue and pink. [male, female]
  212.  
  213.   #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  214.   #                            END CUSTOMIZATION
  215.   #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  216.  
  217. end
  218.  
  219. ################################################################################
  220. #*******************************************************************************
  221. #                           GAME TEMP
  222. ################################################################################
  223. class Game_Temp
  224.  
  225.   attr_accessor :chosen_gender
  226.  
  227.   alias ccs_gtemp_initialize initialize unless $@
  228.   def initialize
  229.     ccs_gtemp_initialize
  230.     @chosen_gender = 0
  231.   end
  232.  
  233. end
  234.  
  235. ################################################################################
  236. #*******************************************************************************
  237. #                            GAME ACTOR
  238. ################################################################################
  239. class Game_Actor < Game_Battler
  240.  
  241.   include CharCreate
  242.  
  243.   attr_accessor :hometown
  244.   attr_accessor :wisdom
  245.   attr_accessor :gender
  246.  
  247.   alias ccs_gactor_setup setup unless $@
  248.   def setup(actor_id)
  249.     ccs_gactor_setup(actor_id)
  250.     @hometown = "none"
  251.     @wisdom = 0
  252.     if ACTOR_INITIAL_GENDER.include?(actor_id)
  253.       @gender = ACTOR_INITIAL_GENDER[actor_id]
  254.     else
  255.       @gender = ""
  256.     end
  257.   end
  258.  
  259.   def wisdom_is(value)
  260.     if @wisdom >= value
  261.       return true
  262.     else
  263.       return false
  264.     end
  265.   end
  266.  
  267.   def hometown_is(string)
  268.     if @hometown == string
  269.       return true
  270.     else
  271.       return false
  272.     end
  273.   end
  274.  
  275. end
  276.  
  277. ################################################################################
  278. #*******************************************************************************
  279. #                         WINDOW BASE
  280. ################################################################################
  281. class Window_Base < Window
  282.  
  283.   include CharCreate
  284.  
  285.   #-----------------------------------------------------------------------------
  286.   #                       Draw Selectable Actor
  287.   #-----------------------------------------------------------------------------
  288.   def draw_selectable_actor(key, x, y)
  289.     draw_face(key[0], key[1], x, y)
  290.     draw_character(key[0], key[1], x + 110, y + 32)
  291.   end
  292.  
  293.   #-----------------------------------------------------------------------------
  294.   #                         Creation Rect
  295.   #-----------------------------------------------------------------------------
  296.   def creation_rect(index)
  297.     cursor = Rect.new(0, 0, 0, 0)
  298.     cursor.width = (contents.width + @spacing) / @column_max - @spacing
  299.     cursor.height = 96
  300.     cursor.x = index % @column_max * (cursor.width + @spacing)
  301.     cursor.y = index / @column_max * cursor.height
  302.     return cursor
  303.   end
  304.  
  305.    
  306. end
  307.  
  308. ################################################################################
  309. #*******************************************************************************
  310. #                      WINDOW STATUS
  311. ################################################################################
  312. class Window_Status < Window_Base
  313.  
  314.   include CharCreate
  315.  
  316.   alias ccs_winstatus_refresh refresh unless $@
  317.   def refresh
  318.     ccs_winstatus_refresh
  319.     self.contents.font.color = system_color
  320.     self.contents.draw_text(0, 130, self.width, WLH, HOMETOWN_TAG)
  321.     self.contents.font.color = normal_color
  322.     self.contents.draw_text(70, 130, self.width, WLH, @actor.hometown)
  323.     if @actor.gender == "Male"
  324.       self.contents.font.color = text_color(GENDER_COLORS[0])
  325.       self.contents.draw_text(110, 30, self.width, WLH, "M")
  326.     elsif @actor.gender == "Female"
  327.       self.contents.font.color = text_color(GENDER_COLORS[1])
  328.       self.contents.draw_text(110, 30, self.width, WLH, "F")
  329.     end
  330.   end
  331.  
  332. end
  333.  
  334. ################################################################################
  335. #*******************************************************************************
  336. #                        WINDOW NAME EDIT
  337. ################################################################################
  338. class Window_NameEdit < Window_Base
  339.  
  340.   attr_accessor :creation
  341.  
  342.   alias ccs_wnedit_refresh refresh unless $@
  343.   def refresh
  344.     if @creation
  345.       self.contents.clear
  346.       name_array = @name.split(//)
  347.       for i in 0...@max_char
  348.         c = name_array[i]
  349.         c = '_' if c == nil
  350.         self.contents.draw_text(item_rect(i), c)#, 1)
  351.       end
  352.     else
  353.       ccs_wnedit_refresh
  354.     end
  355.   end
  356.  
  357. end
  358.  
  359. ################################################################################
  360. #*******************************************************************************
  361. #                        WINDOW CREATION COMMANDS
  362. ################################################################################
  363. class Window_CreationCommands < Window_Selectable
  364.  
  365.   include CharCreate
  366.  
  367.   def initialize(x, y, width, height)
  368.     super(x, y, width, height)
  369.     c1 = NAME_COMMAND
  370.     c2 = GENDER_COMMAND
  371.     c3 = CHARACTER_COMMAND
  372.     c4 = CLASS_COMMAND
  373.     c5 = HOMETOWN_COMMAND
  374.     c6 = READY_COMMAND
  375.     @commands = [c1, c2, c3, c4, c5, c6]
  376.     @item_max = @commands.size
  377.     refresh
  378.     self.index = 0
  379.   end
  380.  
  381.   def refresh
  382.     self.contents.clear
  383.     create_contents
  384.     for i in 0...@item_max
  385.       draw_items(i)
  386.     end
  387.   end
  388.  
  389.   def draw_items(index)
  390.     rect = item_rect(index)
  391.     rect.x += 4
  392.     rect.width -= 8
  393.     self.contents.clear_rect(rect)
  394.     self.contents.draw_text(rect, @commands[index])
  395.   end
  396.  
  397. end
  398.  
  399. ################################################################################
  400. #*******************************************************************************
  401. #                          WINDOW GENDER SELECT
  402. ################################################################################
  403. class Window_GenderSelect < Window_Selectable
  404.  
  405.   include CharCreate
  406.  
  407.   def initialize(x, y, width, height, actor)
  408.     super(x, y, width, height)
  409.     @actor = actor
  410.     c1 = "Male"
  411.     c2 = "Female"
  412.     @commands = [c1, c2]
  413.     @item_max = @commands.size
  414.     refresh
  415.     self.index = 0
  416.   end
  417.  
  418.   def refresh
  419.     self.contents.clear
  420.     for i in 0...@item_max
  421.       draw_items(i)
  422.     end
  423.   end
  424.  
  425.   def draw_items(index)
  426.     rect = item_rect(index)
  427.     rect.x += 4
  428.     rect.width -= 8
  429.     self.contents.clear_rect(rect)
  430.     self.contents.draw_text(rect, @commands[index])
  431.   end
  432.  
  433. end
  434.  
  435. ################################################################################
  436. #*******************************************************************************
  437. #                         WINDOW HOMETOWN SELECT
  438. ################################################################################
  439. class Window_HometownSelect < Window_Selectable
  440.  
  441.   include CharCreate
  442.  
  443.   def initialize(x, y, width, height)
  444.     super(x, y, width, height)
  445.     @commands = HOMETOWNS
  446.     @item_max = @commands.size
  447.     refresh
  448.     self.index = 0
  449.   end
  450.  
  451.   def refresh
  452.     self.contents.clear
  453.     for i in 0...@item_max
  454.       draw_items(i)
  455.     end
  456.   end
  457.  
  458.   def draw_items(index)
  459.     rect = item_rect(index)
  460.     rect.x += 4
  461.     rect.width -= 8
  462.     self.contents.clear_rect(rect)
  463.     self.contents.draw_text(rect, @commands[index])
  464.   end
  465.  
  466. end
  467.  
  468. ################################################################################
  469. #*******************************************************************************
  470. #                        WINDOW CHARACTER SELCTION
  471. ################################################################################
  472. class Window_CharacterSelect < Window_Selectable
  473.  
  474.   include CharCreate
  475.  
  476.   attr_accessor :keys
  477.   attr_accessor :item_max
  478.  
  479.   def initialize(x, y, width, height)
  480.     super(x, y, width, height)
  481.     case $game_temp.chosen_gender
  482.     when 0
  483.       @keys = MALES
  484.     when 1
  485.       @keys = FEMALES
  486.     end
  487.     @item_max = @keys.size
  488.     refresh
  489.     self.index = 0
  490.   end
  491.  
  492.   def refresh
  493.     self.contents.clear
  494.     create_contents
  495.     for i in 0...@item_max
  496.       draw_items(i)
  497.     end
  498.   end
  499.  
  500.   def draw_items(index)
  501.     rect = creation_rect(index)
  502.     rect.x += 4
  503.     rect.width -= 8
  504.     self.contents.clear_rect(rect)
  505.     draw_selectable_actor(@keys[index], rect.x, rect.y)
  506.   end
  507.  
  508.   def create_contents
  509.     self.contents.dispose
  510.     self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
  511.   end
  512.  
  513.   def update_cursor
  514.     if @index < 0                   # If the cursor position is less than 0
  515.       self.cursor_rect.empty        # Empty cursor
  516.     else                            # If the cursor position is 0 or more
  517.       row = @index / @column_max    # Get current row
  518.       if row < top_row              # If before the currently displayed
  519.         self.top_row = row          # Scroll up
  520.       end
  521.       if row > bottom_row           # If after the currently displayed
  522.         self.bottom_row = row       # Scroll down
  523.       end
  524.       rect = creation_rect(@index)      # Get rectangle of selected item
  525.       rect.y -= self.oy             # Match rectangle to scroll position
  526.       self.cursor_rect = rect       # Refresh cursor rectangle
  527.     end
  528.   end
  529.  
  530.   #--------------------------------------------------------------------------
  531.   # * Get Top Row
  532.   #--------------------------------------------------------------------------
  533.   def top_row
  534.     return self.oy / 96
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # * Set Top Row
  538.   #     row : row shown on top
  539.   #--------------------------------------------------------------------------
  540.   def top_row=(row)
  541.     row = 0 if row < 0
  542.     row = row_max - 1 if row > row_max - 1
  543.     self.oy = row * 96
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # * Get Number of Rows Displayable on 1 Page
  547.   #--------------------------------------------------------------------------
  548.   def page_row_max
  549.     return (self.height - 32) / 96
  550.   end
  551.  
  552.  
  553.  
  554. end
  555.  
  556. ################################################################################
  557. #*******************************************************************************
  558. #                       WINDOW CLASS SELECTION
  559. ################################################################################
  560. class Window_ClassSelect < Window_Selectable
  561.  
  562.   include CharCreate
  563.  
  564.   def initialize(x, y, width, height)
  565.     super(x, y, width, height)
  566.     @commands = []
  567.     for i in 1..AVAILABLE_CLASSES
  568.       @commands.push($data_classes[i].name)
  569.     end
  570.     @item_max = @commands.size
  571.     refresh
  572.     self.index = 0
  573.   end
  574.  
  575.   def refresh
  576.     self.contents.clear
  577.     for i in 0...@item_max
  578.       draw_items(i)
  579.     end
  580.   end
  581.  
  582.   def draw_items(index)
  583.     rect = item_rect(index)
  584.     rect.x += 4
  585.     rect.width -= 8
  586.     self.contents.clear_rect(rect)
  587.     self.contents.draw_text(rect, @commands[index])
  588.   end
  589.  
  590. end
  591.  
  592. ################################################################################
  593. #*******************************************************************************
  594. #                      WINDOW CHARACTER PREVIEW
  595. ################################################################################
  596. class Window_CharacterPreview < Window_Base
  597.  
  598.   include CharCreate
  599.  
  600.   def initialize(x, y, width, height, actor)
  601.     super(x, y, width, height)
  602.     @actor = actor
  603.     refresh
  604.   end
  605.  
  606.   def refresh
  607.     self.contents.clear
  608.     draw_actor_face(@actor, 0, 0)
  609.     draw_actor_graphic(@actor, 450, 90)
  610.     self.contents.font.color = system_color
  611.     self.contents.draw_text(110, 0, self.width, WLH, "Name:")
  612.     self.contents.draw_text(110, WLH, self.width, WLH, "Gender:")
  613.     self.contents.draw_text(110, WLH * 2, self.width, WLH, "Class:")
  614.     self.contents.draw_text(300, 0, self.width, WLH, "Hometown:")
  615.     self.contents.font.color = text_color(PREVIEW_NAME_COLOR)
  616.     self.contents.draw_text(190, 0, self.width, WLH, @actor.name)
  617.     self.contents.font.color = text_color(PREVIEW_GENDER_COLOR)
  618.     self.contents.draw_text(190, WLH, self.width, WLH, @actor.gender)
  619.     self.contents.font.color = text_color(PREVIEW_CLASS_COLOR)
  620.     draw_actor_class(@actor, 190, WLH * 2)
  621.     self.contents.font.color = text_color(PREVIEW_HOMETOWN_COLOR)
  622.     self.contents.draw_text(410, 0, self.width, WLH, @actor.hometown)
  623.     self.contents.font.color = normal_color
  624.   end
  625.  
  626. end
  627.  
  628. ################################################################################
  629. #*******************************************************************************
  630. #                          WINDOW CONFIRMATION
  631. ################################################################################
  632. class Window_Confirmation < Window_Selectable
  633.  
  634.   include CharCreate
  635.  
  636.   def initialize(x, y, width, height)
  637.     super(x, y, width, height)
  638.     @commands = ["Confirm", "Back"]
  639.     @item_max = @commands.size
  640.     refresh
  641.     self.index = 0
  642.   end
  643.  
  644.   def refresh
  645.     self.contents.clear
  646.     for i in 0...@item_max
  647.       draw_items(i)
  648.     end
  649.   end
  650.  
  651.   def draw_items(index)
  652.     rect = item_rect(index)
  653.     rect.x += 4
  654.     rect.width -= 8
  655.     self.contents.clear_rect(rect)
  656.     self.contents.draw_text(rect, @commands[index])
  657.   end
  658.  
  659. end
  660.  
  661. ################################################################################
  662. #*******************************************************************************
  663. #                             SCENE NAME
  664. ################################################################################
  665. class Scene_Name < Scene_Base
  666.  
  667.   def initialize(creation = false)
  668.     @creation = creation
  669.   end
  670.    
  671.   alias ccs_sname_start start unless $@
  672.   def start
  673.     ccs_sname_start
  674.     if @creation
  675.       @edit_window.creation = true
  676.       @edit_window.refresh
  677.     end
  678.   end
  679.  
  680.   alias ccs_sname_return_scene return_scene unless $@
  681.   def return_scene
  682.     if @creation
  683.       for i in 0...$game_party.members.size
  684.         if $game_party.members[i] == @actor
  685.           $scene = Scene_CharCreate.new(i)
  686.         end
  687.       end
  688.     else
  689.       ccs_sname_return_scene
  690.     end
  691.   end
  692.  
  693. end
  694.  
  695. ################################################################################
  696. #*******************************************************************************
  697. #                         SCENE CHARCREATE
  698. ################################################################################
  699. class Scene_CharCreate < Scene_Base
  700.  
  701.   include CharCreate
  702.  
  703.   def initialize(member_id, menufuru = false)
  704.     @from_furu = menufuru
  705.     @actor = $game_party.members[member_id]
  706.   end
  707.  
  708.   def start
  709.     @win_commands = Window_CreationCommands.new(0, 0, 180, 180)
  710.     @win_gender = Window_GenderSelect.new(220, 0, 130, 80, @actor)
  711.     @win_hometown = Window_HometownSelect.new(220, 0, 160, 280)
  712.     @win_character = Window_CharacterSelect.new(220, 0, 160, 280)
  713.     @win_class = Window_ClassSelect.new(220, 0, 160, 280)
  714.     @win_preview = Window_CharacterPreview.new(0, 280, 544, 136, @actor)
  715.     @win_confirm = Window_Confirmation.new(220, 0, 160, 80)
  716.     @win_gender.visible = false
  717.     @win_hometown.visible = false
  718.     @win_character.visible = false
  719.     @win_class.visible = false
  720.     @win_confirm.visible = false
  721.     @win_gender.active = false
  722.     @win_hometown.active = false
  723.     @win_character.active = false
  724.     @win_class.active = false
  725.     @win_confirm.active = false
  726.     @win_commands.active = true
  727.   end
  728.  
  729.   #-----------------------------------------------------------------------------
  730.   #                           Update
  731.   #-----------------------------------------------------------------------------
  732.   def update
  733.     @win_commands.update
  734.     if @win_commands.active
  735.       if Input.trigger?(Input::C)
  736.         Sound.play_decision
  737.         case @win_commands.index
  738.         when 0
  739.           $game_temp.name_actor_id = @actor.id
  740.           $game_temp.name_max_char = 12
  741.           $scene = Scene_Name.new(true)
  742.         when 1
  743.           activate_gender_selection
  744.         when 2
  745.           activate_character_selection
  746.         when 3
  747.           activate_class_selection
  748.         when 4
  749.           activate_hometown_selection
  750.         when 5
  751.           activate_confirmation_selection
  752.         end
  753.       end
  754.     elsif @win_gender.active
  755.       update_gender_selection
  756.     elsif @win_character.active
  757.       update_character_selection
  758.     elsif @win_class.active
  759.       update_class_selection
  760.     elsif @win_hometown.active
  761.       update_hometown_selection
  762.     elsif @win_confirm
  763.       update_confirmation_selection
  764.     end
  765.   end
  766.  
  767.   #-----------------------------------------------------------------------------
  768.   #                     Activate Gender Selection
  769.   #-----------------------------------------------------------------------------
  770.   def activate_gender_selection
  771.     @win_gender.visible = true
  772.     @win_commands.active = false
  773.     @win_gender.index = 0
  774.     @win_gender.active = true
  775.   end
  776.  
  777.   #-----------------------------------------------------------------------------
  778.   #                    Activate Character Selection
  779.   #-----------------------------------------------------------------------------
  780.   def activate_character_selection
  781.     @win_character.active = true
  782.     @win_character.visible = true
  783.     @win_commands.active = false
  784.     @win_character.index = 0
  785.   end
  786.  
  787.   #-----------------------------------------------------------------------------
  788.   #                      Activate Class Selection
  789.   #-----------------------------------------------------------------------------
  790.   def activate_class_selection
  791.     @win_class.visible = true
  792.     @win_commands.active = false
  793.     @win_class.index = 0
  794.     @win_class.active = true
  795.   end
  796.  
  797.   #-----------------------------------------------------------------------------
  798.   #                      Activate Hometown Selection
  799.   #-----------------------------------------------------------------------------
  800.   def activate_hometown_selection
  801.     @win_hometown.visible = true
  802.     @win_commands.active = false
  803.     @win_hometown.index = 0
  804.     @win_hometown.active = true
  805.   end
  806.  
  807.   #-----------------------------------------------------------------------------
  808.   #                    Activate Confirmation Selection
  809.   #-----------------------------------------------------------------------------
  810.   def activate_confirmation_selection
  811.     @win_confirm.visible = true
  812.     @win_commands.active = false
  813.     @win_confirm.index = 0
  814.     @win_confirm.active = true
  815.   end
  816.  
  817.  
  818.   #-----------------------------------------------------------------------------
  819.   #                     Update Gender Selection
  820.   #-----------------------------------------------------------------------------
  821.   def update_gender_selection
  822.     @win_gender.update
  823.     if Input.trigger?(Input::C)
  824.       Sound.play_decision
  825.       case @win_gender.index
  826.       when 0
  827.         @actor.gender = "Male"
  828.         $game_temp.chosen_gender = 0
  829.         @win_character.keys = MALES
  830.         @win_character.item_max = @win_character.keys.size
  831.         @win_character.refresh
  832.       when 1
  833.         @actor.gender = "Female"
  834.         $game_temp.chosen_gender = 1
  835.         @win_character.keys = FEMALES
  836.         @win_character.item_max = @win_character.keys.size
  837.         @win_character.refresh
  838.       end
  839.       @win_preview.refresh
  840.     elsif Input.trigger?(Input::B)
  841.       Sound.play_cancel
  842.       back_to_commands
  843.     end
  844.   end
  845.  
  846.   #-----------------------------------------------------------------------------
  847.   #                     Update Character Selection
  848.   #-----------------------------------------------------------------------------
  849.   def update_character_selection
  850.     @win_character.update
  851.     if Input.trigger?(Input::C)
  852.       Sound.play_decision
  853.       cname = @win_character.keys[@win_character.index][0]
  854.       cdex = @win_character.keys[@win_character.index][1]
  855.       @actor.set_graphic(cname, cdex, cname, cdex)
  856.       @win_preview.refresh
  857.       @win_character.refresh
  858.     elsif Input.trigger?(Input::B)
  859.       Sound.play_cancel
  860.       back_to_commands
  861.     end
  862.   end
  863.  
  864.   #-----------------------------------------------------------------------------
  865.   #                     Update Class Selection
  866.   #-----------------------------------------------------------------------------
  867.   def update_class_selection
  868.     @win_class.update
  869.     if Input.trigger?(Input::C)
  870.       Sound.play_decision
  871.       @actor.class_id=(@win_class.index + 1)
  872.       @win_preview.refresh
  873.     elsif Input.trigger?(Input::B)
  874.       Sound.play_cancel
  875.       back_to_commands
  876.     end
  877.   end
  878.  
  879.   #-----------------------------------------------------------------------------
  880.   #                     Update Hometown Selection
  881.   #-----------------------------------------------------------------------------
  882.   def update_hometown_selection
  883.     @win_hometown.update
  884.     if Input.trigger?(Input::C)
  885.       Sound.play_decision
  886.       @actor.hometown = HOMETOWNS[@win_hometown.index]
  887.       @win_preview.refresh
  888.     elsif Input.trigger?(Input::B)
  889.       Sound.play_cancel
  890.       back_to_commands
  891.     end
  892.   end
  893.  
  894.   #-----------------------------------------------------------------------------
  895.   #                      Update Confirmation Selection
  896.   #-----------------------------------------------------------------------------
  897.   def update_confirmation_selection
  898.     @win_confirm.update
  899.     if Input.trigger?(Input::C)
  900.       Sound.play_decision
  901.       case @win_confirm.index
  902.       when 0
  903.         if CCS_USE_RECRUIT_SHOPS
  904.           @actor.is_set = true
  905.         end
  906.         if @from_furu
  907.           $scene = Scene_MenuFuru.new(9)
  908.         else
  909.           $scene = Scene_Map.new
  910.         end
  911.       when 1
  912.         back_to_commands
  913.       end
  914.     elsif Input.trigger?(Input::B)
  915.       Sound.play_cancel
  916.       back_to_commands
  917.     end
  918.   end
  919.  
  920.   #-----------------------------------------------------------------------------
  921.   #                         Back to Commands
  922.   #-----------------------------------------------------------------------------
  923.   def back_to_commands
  924.     case @win_commands.index
  925.     when 1
  926.       @win_gender.active = false
  927.       @win_gender.visible = false
  928.     when 2
  929.       @win_character.active = false
  930.       @win_character.visible = false
  931.     when 3
  932.       @win_class.active = false
  933.       @win_class.visible = false
  934.     when 4
  935.       @win_hometown.active = false
  936.       @win_hometown.visible = false
  937.     when 5
  938.       @win_confirm.active = false
  939.       @win_confirm.visible = false
  940.     end
  941.     @win_commands.active = true
  942.   end
  943.  
  944.   #-----------------------------------------------------------------------------
  945.   #                      Terminate
  946.   #-----------------------------------------------------------------------------
  947.   def terminate
  948.     $game_player.refresh
  949.     @win_commands.dispose
  950.     @win_preview.dispose
  951.     @win_gender.dispose
  952.     @win_character.dispose
  953.     @win_class.dispose
  954.     @win_hometown.dispose
  955.     @win_confirm.dispose
  956.   end
  957.  
  958. end
Advertisement
Add Comment
Please, Sign In to add comment