estriole

EST - SUIKODEN FORMATION

Jan 10th, 2013
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.24 KB | None | 0 0
  1. $imported = {} if $imported.nil?
  2. $imported["EST SUIKODEN FORMATION"] = true
  3. =begin
  4.  ** EST - SUIKODEN FORMATION v 1.1
  5.  author : estriole
  6.  licences:
  7.  Free to use in all project (except the one containing pornography)
  8.  as long as i credited (ESTRIOLE).
  9.  
  10.  version history
  11.  v 1.1 -> add patch if not using yanfly ace menu engine script.
  12.  v 1.0 -> initial release
  13.  
  14.  basicly this script change the yanfly formation to party (since it's set
  15.  the party members in battle). set the max battle members to 6. then disable
  16.  the variable that can change the max battle members ingame.
  17.  then create new command in menu named formation which is the real formation
  18.  the real formation will set the placement of the party members in battle
  19.  
  20.  requirement :
  21.  have the script in this following order for the best result:
  22.   yanfly party system 1.08
  23.   victor basic module 1.17
  24.   victor animated battle 1.04
  25.   victor actor battler 1.05
  26.  
  27.   yanfly ace battle engine 1.22
  28.   yanfly enemy hp bar 1.10
  29.   yanfly ace menu engine 1.07
  30.   yanfly attack replace 1.01
  31.   yea compatibility patch 1.0
  32.   EST- Victor Battle Patch 1.0 (or higher)
  33.   ve - custom action (optional)
  34.  
  35.   EST - ENEMY POSITION 1.7 (or higher)
  36.   EST - PERMANENT STATE 1.0 (or higher)
  37.   EST - BATTLESTART ADD STATE 1.0 (or higher)
  38.   this script (EST - SUIKODEN FORMATION 1.1)
  39.  
  40.  
  41. =end
  42. module YEA
  43.   module PARTY
  44.     MAX_BATTLE_MEMBERS   = 6      # set Maximum party member to 6
  45.     MAX_MEMBERS_VARIABLE = 0      # disable variable to change max members
  46.   end
  47. end
  48.  
  49. module ESTRIOLE
  50.   #--------------------------------------------------------------------------
  51.   #   YEA Ace Menu Engine - Custom Menu Command Setting
  52.   #--------------------------------------------------------------------------
  53.   # This setting only takes effect when YEA - Ace Menu Engine is installed
  54.   # in the same project.
  55.   #
  56.   # To add the Formation scene to Ace Menu Engine, look for a
  57.   # configuration setting called "- Main Menu Settings -". There is a
  58.   # variable called COMMANDS that has an array of orange symbols. Add
  59.   # the symbol :est_formation to the COMMANDS array to add the crafting
  60.   # command to your menu. not needed anymore. will auto added to below party command
  61.   # (old formation command)
  62.   #
  63.   # The setting here working exactly the same as the CUSTOM_COMMAND
  64.   # setting in Ace Menu Engine. For more information, please refer to
  65.   # the Ace Menu Engine script.
  66.   EST_FORMATION_CUSTOM_COMMAND = {
  67.   #             ["Display Name", EnableSwitch, ShowSwitch,      Handler Method],
  68.     :est_formation => [  "Formation",           0,          0, :command_est_formation],
  69.   } # <- Do not delete.
  70.   ###############################################################################
  71. end
  72.  
  73. if $imported["YEA-AceMenuEngine"]
  74. YEA::MENU::CUSTOM_COMMANDS.merge!(ESTRIOLE::EST_FORMATION_CUSTOM_COMMAND)
  75. index, target = nil
  76. for i in 0..YEA::MENU::COMMANDS.size-1
  77.  index = i if YEA::MENU::COMMANDS[i] == :formation
  78. end
  79. target = index - YEA::MENU::COMMANDS.size if index !=nil
  80. YEA::MENU::COMMANDS.insert(target,:est_formation) if target!=nil
  81. YEA::MENU::COMMANDS.insert(-1,:est_formation)if target==nil
  82.  
  83. #==============================================================================
  84. # ++ Scene_Menu
  85. #==============================================================================
  86.  
  87. end # if $imported["YEA-AceMenuEngine"]
  88.  
  89. class Window_MenuCommand < Window_Command
  90.   def add_formation_command
  91.     add_command("Party", :formation, formation_enabled)
  92.     return unless !$imported["YEA-AceMenuEngine"]
  93.     add_command("Formation", :est_formation, formation_enabled)
  94.   end
  95. end
  96.  
  97. class Scene_Menu < Scene_MenuBase
  98.   alias est_formation_changer_create_command_window create_command_window
  99.   def create_command_window
  100.     est_formation_changer_create_command_window
  101.     return unless !$imported["YEA-AceMenuEngine"]
  102.     @command_window.set_handler(:est_formation, method(:command_est_formation))
  103.   end
  104.   def command_est_formation
  105.     SceneManager.call(Scene_Formation)
  106.   end
  107. end
  108.  
  109. class Game_Party < Game_Unit
  110.   def swap_form (index1, index2)
  111.   temp = @battle_members_array[index1]  
  112.   @battle_members_array[index1] = @battle_members_array[index2]  
  113.   @battle_members_array[index2] = temp
  114.   end  
  115.   def rearrange_form(array)
  116.     for i in 0..array.size-1
  117.     @actors[i] = array[i]
  118.     end
  119.     $game_player.refresh
  120.   end
  121. end
  122.  
  123. class Scene_Formation < Scene_MenuBase
  124.   def start
  125.     super
  126.     create_status_window
  127.   end
  128.   def create_status_window
  129.     @status_window = Window_Formation.new(100, 0)
  130.     @status_window.select_last
  131.     @status_window.activate
  132.     @status_window.set_handler(:ok,     method(:on_formation_ok))
  133.     @status_window.set_handler(:cancel, method(:on_formation_cancel))
  134.   end
  135.  
  136.   def on_formation_ok
  137.     if @status_window.pending_index >= 0
  138.       $game_party.swap_form(@status_window.index,
  139.                              @status_window.pending_index)
  140.       formlist = $game_party.battle_members_array - [0]                      
  141.       $game_party.rearrange_form(formlist)
  142.       #$game_party.swap_order(@status_window.index,
  143.       #                       @status_window.pending_index)
  144.       @status_window.pending_index = -1
  145.       @status_window.redraw_item(@status_window.index)
  146.     else
  147.       @status_window.pending_index = @status_window.index
  148.     end
  149.     @status_window.activate
  150.   end
  151.   def on_formation_cancel
  152.     if @status_window.pending_index >= 0
  153.       @status_window.pending_index = -1
  154.       @status_window.activate
  155.     else
  156.       @status_window.unselect
  157.       SceneManager.return
  158.     end
  159.   end
  160. end
  161.  
  162. class Window_Formation < Window_Selectable
  163.   attr_reader   :pending_index            # 保留位置(並び替え用)
  164.   def initialize(x, y)
  165.     super(x - ((col_max-3)*100/2), y, col_max * 100 + 11 + (col_max*11), 190*2+30)
  166.     @pending_index = -1
  167.     refresh
  168.     @actor = nil
  169.   end
  170.    
  171.   def col_max
  172.   return 3
  173.   end
  174.  
  175.   def item_max
  176.     return 6#$game_party.battle_members.size
  177.   end
  178.   def spacing
  179.     return 10
  180.   end
  181.  
  182.   def item_width
  183.   return 100
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 項目の高さを取得
  187.   #--------------------------------------------------------------------------
  188.   def item_height
  189.   return 190
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 項目の描画
  193.   #--------------------------------------------------------------------------
  194.   def getrange(actor)
  195.     attack_skill = $data_skills[actor.attack_skill_id]
  196.     attack_range = attack_skill.scope
  197.     case attack_range
  198.     when 81; return 'B' #back row > ???
  199.     when 82; return 'F' #front row > ???
  200.     when 83; return '★B' #front row > ???
  201.     when 84; return '★F' #front row > ???
  202.     when 85; return 'Z' #flying row > ???
  203.     when 86; return '★Z' #allflying row > ???
  204.     when 87; return 'W' #underwater row > ???
  205.     when 88; return '★W' #allunderwater row > ???
  206.     when 89; return 'G' #underground row > ???
  207.     when 90; return '★G' #allunderground row > ???
  208.     when 91; return 'E' #either row > spears
  209.     when 92; return '★E' #either row > spears
  210.     when 97; return 'S' #short range > knuckles
  211.     when 98; return 'M' #mid range > swords
  212.     when 99; return 'L' #long range > guns
  213.     when 100; return '★S' #short range > knuckles
  214.     when 101; return '★M' #mid range > swords
  215.     when 102; return '★L' #long range > guns
  216.     when 1; return 'A' #all target > magic
  217.     when 2; return '★A' #all target > magic
  218.     else
  219.     return '?' #all pos
  220.     end
  221.   end
  222.  
  223.   def draw_item(index)
  224.     actor = $game_actors[$game_party.battle_members_array[index]]
  225.     enabled = $game_party.battle_members.include?(actor)
  226.     rect = item_rect(index)
  227.     draw_item_background(index) if actor != nil
  228.     draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) if actor != nil
  229. #    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  230.     if actor != nil
  231.     statx = rect.x + 1
  232.     staty = rect.y + 83 + line_height / 2
  233.     draw_actor_name(actor, statx, staty)  
  234.    
  235.     contents.font.size = 22 if $imported["YEA-AdjustLimits"] == true
  236.     draw_actor_level(actor, statx +43, staty + line_height * 1 + 2)
  237.     reset_font_settings if $imported["YEA-AdjustLimits"] == true
  238.    
  239.     draw_icon(116, statx + 1, staty + line_height * 1, enabled)
  240.     range = getrange(actor)
  241.     draw_text(statx + 24, staty + line_height * 1, 20, line_height, range)    
  242.     draw_current_and_max_values(statx, staty + line_height * 2, rect.width-4, actor.hp, actor.mhp,
  243.                                     hp_color(actor), normal_color)  
  244.     draw_current_and_max_values(statx, staty + line_height * 3 , rect.width-4, actor.mp, actor.mmp,
  245.                                     mp_color(actor), normal_color)  
  246.     end
  247.   end
  248.   def draw_actor_name(actor, x, y, width = 100)
  249.     change_color(hp_color(actor))
  250.     draw_text(x, y, width, line_height, actor.name)
  251.   end  
  252.   #--------------------------------------------------------------------------
  253.   # ● 項目の背景を描画
  254.   #--------------------------------------------------------------------------
  255.   def draw_item_background(index)
  256.     if index == @pending_index
  257.       contents.fill_rect(item_rect(index), pending_color)
  258.     end
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● 決定ボタンが押されたときの処理
  262.   #--------------------------------------------------------------------------
  263.   def process_ok
  264.     super
  265.     $game_party.menu_actor = $game_party.battle_members[index] if $game_party.battle_members[index] != nil
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 前回の選択位置を復帰
  269.   #--------------------------------------------------------------------------
  270.   def select_last
  271.     select($game_party.menu_actor.index || 0)
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 保留位置(並び替え用)の設定
  275.   #--------------------------------------------------------------------------
  276.   def pending_index=(index)
  277.     last_pending_index = @pending_index
  278.     @pending_index = index
  279.     redraw_item(@pending_index)
  280.     redraw_item(last_pending_index)
  281.   end
  282. end
Advertisement
Add Comment
Please, Sign In to add comment