Formation Bonus

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Vlue, May 20, 2014.

    Tags:
  1. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Formation Bonus v1.1a + Actor Sprites v1.0
    By Vlue
    Introduction
    Allows actors to be rearranged in a 3x3 grid to form some sort of formation. Set formations can provide percentage bonuses to all actors when they are achieved; For example, you can set a bonus of 20% atk when three actors are in the front row, and so on.
    Other options include physical/magical damage changes based on row position. (i.e less damage taken while in the back row)
    Should work with any script that displays actor sprites in battle, as long as this script is placed below it.
    Also included in this topic is a stand-alone script that displays actor sprites in battle, for those who don't have one.

    Features
    - Rearrange actors in a 3x3 grid.
    - Provide bonuses when certain formation patterns are achieved
    - Provide bonuses/unbonuses based on row position

    - Display actor sprites in battle

    Screenshots
    [​IMG]
    Picture is a little misleading, the actor direction has been fixed to reflect how it should be. (Looking to the left)

    How to Use
    Plug and play. Set up formations if and as needed.

    Script
    Formation Bonus Script: http://pastebin.com/dQ20UFkY
    Actor Sprites script: http://pastebin.com/KCm56d0b

    Credit and Thanks
    - By Vlue
    - Free to use in any project, commercial or otherwise, with credit given

    Author's Notes
    I regret not including a banana in this topic.
     
    #1
  2. leedragoon

    leedragoon Villager Member

    Messages:
    28
    Likes Received:
    1
    First Language:
    English
    This is really awesome, I think a lot of people would like to have a script like this.
     
    #2
    Vlue likes this.
  3. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,600
    Likes Received:
    2,358
    Location:
    Canada / Quebec
    First Language:
    French
    impressive but I am just curious if it will be compatible with special sideview battle system....

    What I wanted to mean exemple if you put the character in front ...this will be place the character in the coordinated

    exemple

    Actor Position = [ 500,500]

    (is for the character who are put in this place

    and exemple if you put the bad actor in front line it provock a bad bonus~

    like exemple if the (call it leon the mage) is in the back line everyone get a magical bonus ...but  if you put the poor leon in the front line everyone get bad bonus~

    I hope you understand what I try to explain~
     
    #3
  4. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    It should be compatible with most sideview battle systems, though this one should be placed below them for it the best chance of compatibility.
     
    #4
  5. Dream3r

    Dream3r 90% Dreamer, 100% Dedicated Veteran

    Messages:
    530
    Likes Received:
    374
    First Language:
    English
    Oh my you're on fire with these scripts.  I believe I tried to get you to do one of these for me before and it wasn't nearly as easy to work with XD

    It's okay we abandoned side view anyways
     
    #5
    Vlue likes this.
  6. leedragoon

    leedragoon Villager Member

    Messages:
    28
    Likes Received:
    1
    First Language:
    English
    Had a problem with the side view script putting the lead character at 0,0 when it wasn't also used with the formation script. I fixed it by doing this.

    ACTOR_FORMATION = {

      0 => [430,170],

      1 => [450,200],

      2 => [470,230],

      3 => [490,260],

      4 => [510,290]

    }
     

    Could just have been something else I had running, but I figured I'd let you know.

     

    I also noticed that when I collect five or more characters, but my system only allows for four in battle, the extra characters appear in the formation scene. 
     
    Last edited by a moderator: Jun 4, 2014
    #6
  7. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    wow, the bonuses part reminds me of Valkyrie Profile: Covenant of the Plume, though since that one was a tactical style battle system, the formations are done right in battle... nice script :)
     
    #7
  8. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Are you overwriting the default formation scene with this or created a new one?

    Because Im using Yanfly's Formation scene and wasnt planning on changing it. But these bonuses are kinda too good to pass upon. *.*
     
    #8
  9. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    It creates a new scene for the formation. There really wasn't a default formation 'scene', the button just let you rearrange the order of your party while remaining in the menu.
     
    #9
  10. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Ohh, yeah, I totally forgot how the default "Formation" command worked, I instantly got Yanfly's implemented in my game. :D

    Alrighty, another thing to play with then. Thanks for the scripts!
     
    #10
  11. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Sorry for the doublepost, just wanted to share some information about this script and some compatibility issues.
     
    First, let me just thank you again Vlue for this awesome script! Finally, no more static, forever standing at the same time actors in battle!
     
    Okay, here are the things I did to make everything work without any script conflicting with each other:
     
    1. Vlue's Formation Bonus + Yanfly's Party System:
     

    # These 2 scripts use the same button from the menu by default. # Obviously, anyone who uses both scripts would not want it like this.# So, let's fix this little issue!# Let's start with commenting out these lines in the Formation Bonus script:class Scene_Menu  def command_formation    SceneManager.call(Scene_Formation)  endend# This will eliminate the button for this script, so we will need to make a new one to use.# To do that insert these lines below the commented lines from before:class Window_MenuCommand < Window_Command  alias formation1_command add_original_commands  def add_original_commands    formation1_command    add_command("Formation1", :formation1)  endend# Now the only thing we need to do is to insert these lines below the above lines:if $imported["YEA-AceMenuEngine"] #This line is optional only for Yanfly's Menu Engine scriptclass Scene_Menu < Scene_MenuBase  alias formation1_menu13211             create_command_window  #--------------------------------------------------------------------------  # * Create Command Window  #--------------------------------------------------------------------------  def create_command_window    formation1_menu13211()    @command_window.set_handler:)formation1,    method:)command_formation1))  end  #--------------------------------------------------------------------------  # * New Formation Command  #--------------------------------------------------------------------------  def command_formation1    SceneManager.call(Scene_Formation)  end endend  #This line is optional only for Yanfly's Menu Engine script# With this, there should be a new button for calling the Formation Bonus Scene.# Note that this actually names your command button as 'Formation1' which is not a very decorative name for it...# For renaming it to whatever you want, just change the "Formation1" to anything you like at 'Window_MenuCommand'.# There, now you can call Vlue's Formation Bonus Scene and Yanfly's Party System Scene without any of them conflicting # with each other. Nice!# Extra note:# If you are inserting the new command button with Yanfly's Menu Engine script, # you do NOT need to add 'Window_MenuCommand' or else you will get a duplicate command button.# Use either the normal way or Yanly's Menu Engine way, but not both!
     
    2. Eliminating every non-battle party members from the position selection window:

    Code:
    # By default, all of your actors will appear in the Formation Bonus Scene, but only in the actual position window.# There is no way to select them, but still, they will be there if your active party member's size is lower than the # whole party size, aka you got more characters than you can take into battle. This is annoying for two reasons:# 1. Not very decorative, which is the least of our problem now.# 2. They will count to the actual formation. Just an example:#    We got a 3-man battle party system, so 3 characters can participate in the battle at max.#    During the game, we recruited 3 other characters to the party. Now we got 6 party members total.#    But we can still take only 3 into the battle. So, logically, the other 3 should not appear at all in the Formation Bonus Scene,#    because they are not in the battle, which also means they should not be in the formation at all.#    Yet, by default, they are. They will count toward the needed positions also, which actually breaks the whole system. # But with my really little edit below, this can be fixed.# However, by doing these edits, you will not be able to change your active party members from the menu# without Yanfly's Party System script. What? Ohh, right, you were not able to do that from the moment you # inserted the Formation Bonus script. Which is another side effect which will need to be fixed for those who are not using# Yanfly's Party System. But, as I don't really need it, I am not planning to do anything about this one for now.# The thing that needs to be edited for this is 'def item_max' as that one is actually bound # by your maximum battle members' number. You would also need to change which number from the items (items are your actors now)# are counted towards the formation bonus, and which one will actually appear in the position window. This number should be# equal to your maximum battle members' size. And that should be the basics of it, but it is always easier in theory than # in practice, so I will just leave it in theory for now. # If you don't want to bother with this, just use Yanfly's Party System, easy "fix". # So, after all these words, let's get started! # Search for the first two lines like this in the script:     members.each do |actor| # And replace both of them with this:     battle_members.each do |actor| # This will hide any actor that is currently not in your active battle party from the Formation Bonus Scene. # And that's all, folks! This was a really quick one, right?
    3. Vlue's Formation Bonus + Yami's Battle Symphony

    # Here's the thing:# Vlue's Formation Bonus script will break the moving animation (any kind of it) in Yami's Battle Symphony.# We will fix that one too with the edits below! # First, head over to Vlue's script and at the top of the script, insert these lines: $imported = {} if $imported.nil?$imported["Formation-Bonus"] = true # Second, find the following(s): def screen_xdef screen_y # Comment out these (the whole definition, not only the single lines!). # There, you are done here, move over to the Symphony script.# Find the following lines: def set_default_position # Here you need to replace the following lines:       @origin_x = @screen_x = @destination_x = SYMPHONY::View::ACTORS_POSITION[index][0]      @origin_y = @screen_y = @destination_y = SYMPHONY::View::ACTORS_POSITION[index][1] # With these lines:     if $imported["Formation-Bonus"]      @origin_x = @screen_x = @destination_x = FORMATION_LOCATIONS[@formation_slot][0] + 180      @origin_y = @screen_y = @destination_y = FORMATION_LOCATIONS[@formation_slot][1] + 180    else      @origin_x = @screen_x = @destination_x = SYMPHONY::View::ACTORS_POSITION[index][0]      @origin_y = @screen_y = @destination_y = SYMPHONY::View::ACTORS_POSITION[index][1]    end # Notice the numbers '180' at the end of those 2 lines there? That will be the offset of your actors horizontally and vertically.# That one is necessary, because 'FORMATION_LOCATIONS[@formation_slot]' will return the direct co-ordinates on the screen # of your actors from the Formation Bonus scene, so it is very likely that your actors will be in some rather "unusual" places# on the battle screen without these offsets. Edit those numbers freely to change your actors' position in the battle, and yet# maintain the original formation of your actors. # Moving on, we are not done here just yet...# Scroll a bit down and you should see the following line:   def correct_origin_position # Here we need to replace these lines:     @origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][0]    @origin_y = @screen_y = SYMPHONY::View::ACTORS_POSITION[index][1] # With these:     if $imported["Formation-Bonus"]      @origin_x = @screen_x = FORMATION_LOCATIONS[@formation_slot][0] + 180      @origin_y = @screen_y = FORMATION_LOCATIONS[@formation_slot][1] + 180    else    @origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][0]    @origin_y = @screen_y = SYMPHONY::View::ACTORS_POSITION[index][1]    end # The numbers at the end ('180') are for the same reason like before, and they should be the same numbers as above.# Do NOT insert different numbers here than those you set above or "strange" things will happen! # And this should be it! We managed to mix the 2 scripts with 100% working functions from both scripts. Enjoy!

    4. Vlue's Formation Bonus script + GaryCXJk's Class Extensions script

         (for showing combination class/subclass names in the Formation Bonus Scene)

     


    # Yeah, by default, the Formation Bonus script will ignore combination class and secondary class names.# With this little edit, we can fix it easily! # If it is not already present in GaryCXJk's Class Extensions script, than insert the following lines at the top:# (I think it is already there, but I'm not sure about it.) $imported = {} if $imported.nil?$imported["CXJ-ClassExtensions"] = true # Done here, move over to the Formation Bonus script.# Find this line:# (It is possible that you won't find it like this, # because I edited the placement of the text already when I added in this fix. # In this case, just search for 'contents.width,line_height,@actor.class.name,', it is in the 'Window_FormStat' section.) draw_text(-4,line_height+12,contents.width,line_height,@actor.class.name,2) # And replace it with these:     if $imported["CXJ-ClassExtensions"]         if @actor.subclass.nil?        text = @actor.class.name      elsif !@actor.class.combined_name[@actor.subclass_id].nil?        text = @actor.class.combined_name[@actor.subclass_id]      else        fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT        text = sprintf(fmt, @actor.class.name, @actor.subclass.name)      end        draw_text(-4,line_height+12,contents.width,line_height,text,2)              else        draw_text(-4,line_height+12,contents.width,line_height,@actor.class.name,2)      end    end # With this, it will show your primary (default) class name, your secondary class name (if any), # and your combination class name (if any) too. # For the second and third one, you need GaryCXJk's Class Extensions script to show, obviously. # And we are done with this too! Yay!



    5. Vlue's Formation Bonus Script edit for 4x4 grid (16 slots total)

    A little picture of it, if anyone wonders how it looks like:

    formation.PNG

    # Yeah, 3x3 grid is solid enough, if someone got only 4 active party member. # Well, I got 6, and 6 out of 9 slots didn't give me much choice of creating different formations,# so I decided to modify the script for a 4x4 grid for more places and more possibilities.# It is not a very hard edit, but I'm not sure that I remember every thing I changed in the script, # so I will just paste the whole script here, saving you the time of editing many little things,# and also saving your time of reporting errors and my time of replying with corrections for them.# NOTE: The following edited script is optimized for a game resolution of 800x600!#    Many things are edited, and some things (like text and other info) will not show at all on lower resolution (out of screen).#    You can, of course, edit any placement of texts/windows shown, or comment out anything that you don't want to show up, if you wish. # The following edited version of Vlue's Formation Bonus Script features:# - All the related fixes/edits made by me mentioned above.# - 4x4 grid (16 slots total) to place your actors on, gives much more possibilities of combinations.# - Extra stats shown: Hit Rate, Critical Rate, Evasion.# - Extra information shown: The selected actor's: Name, Title (requires Blackmourning's Title System Script)# - Changed the actor's graphic shown in the Status Window of the Formation Bonus Scene.#  Instead of the actor's sprite, it will now show the actor's face graphic.# - The default help window is disabled. Instead of that, a new window is created which will display different text,#  depending on where the active cursor is (in the character selection window or in the position selection window).# - Text and information placement changed, some windows are resized and moved to suit 800x600 resolution. # Extra note: # While I actually implemented showing the Title of the actor's on this scene, I don't recommend using that Title script yet,# because it got some compatibility issues with Yanfly's Class System Script. # The issue happens when you change your primary (main/default) class while having a title which gives stat increase equipped.# I will try to fix this too, as a matter of fact, already tried it, but so far nothing I tried fixed it.# But if you don't use Yanfly's Class System, you might as well ignore this note. # Things yet to be implemented:# - While the position selection window is active (aka selecting the position of the selected actor), #     showing the movement of the actual selected actor's sprite graphic on the screen in real time.#  If the cancel button is pressed, the actor would jump back to it's original placement.# - Giving the bonus only to the actors present in the active formation. #  This would enable lesser formations with fewer battle members, like at the start of the game, #  without actually breaking the bigger formations designed for later stages of your game.#  It would also enable the next thing on the list.# - Multiple active formations at the same time (I thought about 2 at max, to not complicate it too much).#  This one won't really be helpful unless you got 6 active battle members like me.#  I want to be able to set my actors in lesser formations, like 3 in one formation, and 3 in another one.#  Why? I will leave that to your imagination, the possibilities are almost endless!# - Locked formations. #  That's right, I want to be able to lock every single formation until my lead character actually learns them in the game.#  I think it should be obvious why, but for a simple example: to prevent OP formations on earlier stages of my game.# This is all I can think of now, but my braincells are always thinking, so this list might expand,# or get smaller when I (or anyone else) actually implement them. This is if Vlue allows it, of course. # Okay, time to actually post the script, right? Here it is: #Formation Bonus v1.2a - Edited by Sixth#----------##Features: Rearrange actors by rows and make formations, granting bonuses#           based on what row and formation the actors are in.##Usage:    Plug and play, customize as needed.##----------##-- Script by: V.M of D.T##- Questions or comments can be:#    posted on the thread for the script#    given by email: sumptuaryspade@live.ca#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames##--- Free to use in any project, commercial or non-commercial, with credit given# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)$imported = {} if $imported.nil?$imported["Formation-Bonus"] = true#Location for actor sprites in battle (3x3 grid only right now):#                                     (Or not, made it 4x4 now! Yay!)FORMATION_LOCATIONS = [  [375,200],[425,200],[475,200],[525,200],  [395,230],[445,230],[495,230],[545,230],  [415,260],[465,260],[515,260],[565,260],  [435,290],[485,290],[535,290],[585,290]] #Icon to be displayed as formation slot in the Formation Changing Scene.FORMATION_ICON = 430#Change in damage given/recieved based on row position:#Front row, middle left row, middle right row, back rowFORMATION_ROW_ATK = [1.0, 0.8, 0.7, 0.5]FORMATION_ROW_DEF = [1.0, 0.8, 0.7, 0.5]FORMATION_ROW_MAT = [1.0, 1.0, 1.0, 1.0]FORMATION_ROW_MDF = [1.0, 1.0, 1.0, 1.0]FORMATION_ROW_TGR = [1.5, 1.0, 0.8, 0.6] #The special Formations actors can be placed in:# id => { :name => "name of formation", :slots = [slots to be filled], ... }#   Slot ids are:#                   0, 1, 2, 3#                    4, 5, 6, 7#                     8, 9,10,11#                      12,13,14,15##  Stat options are: :hp, :mp, :atk, :def, :mat, :mdf, :agi, :luk#  Formation bonuses apply to all actors.# Example:#  1 => { :name => "Back Row", :slots => [2,5,8], :hp => 20, :mp => 5,}FORMATION_BONUS = { 0 => {},  1 => { :name => "Caution!",  :slots => [2,5,6,9,10,14], :hp => 10, :mdf => 10,},  2 => { :name => "Retreat!",  :slots => [3,6,7,10,11,15], :mat => 10, :def => 10,},  3 => { :name => "Charge!",   :slots => [0,4,5,8,9,12], :atk => 10,},  4 => { :name => "Surround!", :slots => [1,4,7,8,11,13], :mdf => 10, :agi => 10,},  5 => { :name => "Pierce!",   :slots => [1,4,5,6,7,9], :atk => 10, :mat => 10, :luk => 10,},  6 => { :name => "Pierce!",   :slots => [5,8,9,10,11,13], :atk => 10, :mat => 10, :luk => 10,},  7 => { :name => "'X' Marks the Way!", :slots => [0,2,5,9,12,14], :hp => 5, :mp => 5, :atk => 5, :mat => 5,},  8 => { :name => "Tactical!", :slots => [3,4,6,8,10,15], :hp => 5, :mp => 5, :atk => 5, :def => 5, :mat => 5, :mdf => 5, :agi => 5, :luk => 5,}}class Game_Actor < Game_Battler  attr_accessor :formation_slot  alias formation_init initialize  alias formation_param param  def initialize(actor_id)    formation_init(actor_id)    @formation_slot = -1  end #uncomment def screen_x and def screen_y if you don't use Yami's Battle Symphony  #def screen_x   # FORMATION_LOCATIONS[@formation_slot][0]  #end  #def screen_y  #  FORMATION_LOCATIONS[@formation_slot][1]  #end   def front_row?    [0,4,8,12].include?(@formation_slot)  end  def middle_left_row?    [1,5,9,13].include?(@formation_slot)  end  def middle_right_row?    [2,6,10,14].include?(@formation_slot)  end  def back_row?    [3,7,11,15].include?(@formation_slot)  end  def param(param_id)    sym = [:hp,:mp,:atk,:def,:mat,:mdf,:agi,:luk]    value = formation_param(param_id)    if $game_party.short_form[sym[param_id]]      value *= ($game_party.short_form[sym[param_id]] * 0.01 + 1)    end    [[value, param_max(param_id)].min, param_min(param_id)].max.to_i  endend class Game_Enemy < Game_Battler  def front_row?    true  end  def middle_left_row?    false  end  def middle_right_row?    false  end  def back_row?    false  endend class Game_Battler  def tgr    return sparam(0) * FORMATION_ROW_TGR[3] if back_row?    return sparam(0) * FORMATION_ROW_TGR[2] if middle_right_row?    return sparam(0) * FORMATION_ROW_TGR[1] if middle_left_row?    return sparam(0) * FORMATION_ROW_TGR[0]  end  def make_damage_value(user, item)    value = item.damage.eval(user, self, $game_variables)    value *= item_element_rate(user, item)    value *= pdr if item.physical?    value *= mdr if item.magical?    value *= rec if item.damage.recover?    value *= row_defense if item.physical? && !item.damage.recover?    value *= row_attack(user) if item.physical? && !item.damage.recover?    value *= row_magic_attack(user) if item.magical? && !item.damage.recover?    value *= row_magic_defense if item.magical? && !item.damage.recover?    value = apply_critical(value) if @result.critical    value = apply_variance(value, item.damage.variance)    value = apply_guard(value)    @result.make_damage(value.to_i, item)  end  def row_defense    return FORMATION_ROW_DEF[1] if middle_left_row?    return FORMATION_ROW_DEF[2] if middle_right_row?    return FORMATION_ROW_DEF[3] if back_row?    return FORMATION_ROW_DEF[0]  end  def row_attack(user)    return FORMATION_ROW_ATK[3] if user.back_row?    return FORMATION_ROW_ATK[1] if user.middle_left_row?    return FORMATION_ROW_ATK[2] if user.middle_right_row?    return FORMATION_ROW_ATK[0]  end  def row_magic_defense    return FORMATION_ROW_MDF[1] if middle_left_row?    return FORMATION_ROW_MDF[2] if middle_right_row?    return FORMATION_ROW_MDF[3] if back_row?    return FORMATION_ROW_MDF[0]  end  def row_magic_attack(user)    return FORMATION_ROW_MAT[3] if user.back_row?    return FORMATION_ROW_MAT[2] if user.middle_right_row?    return FORMATION_ROW_MAT[1] if user.middle_left_row?    return FORMATION_ROW_MAT[0]  endend class Game_Party  attr_accessor  :formation_id  def first_available_slot  end  def formation_slot(id)    battle_members.each do |actor|      return actor if actor.formation_slot == id    end    return nil  end  def formation_name    return current_formation[:name] if current_formation    return "-----"  end  def setup_starting_members    @actors = $data_system.party_members.clone    iter = 0    battle_members.each do |actor|      actor.formation_slot = iter      iter += 1    end    current_formation  end  def current_formation    FORMATION_BONUS.each do |sym, form|      next if sym == 0      valid = true      form[:slots].each do |val|        valid = false unless formation_slot(val)      end      next unless valid      @formation_id = sym      return FORMATION_BONUS[sym]    end    @formation_id = 0    return nil  end  def short_form    @formation_id = 0 unless @formation_id    FORMATION_BONUS[@formation_id]  end  def add_actor(actor_id)    return if @actors.include?(actor_id)    @actors.push(actor_id)    16.times do |i|      if formation_slot(i).nil?        $game_actors[actor_id].formation_slot = i        break      end    end    $game_player.refresh    $game_map.need_refresh = true  end  def remove_actor(actor_id)    return unless @actors.include?(actor_id)    @actors.delete(actor_id)    $game_actors[actor_id].formation_slot = -1    $game_player.refresh    $game_map.need_refresh = true  endend class Scene_Formation < Scene_Base  def start    super       @list_window = Window_FormList.new    @list_window.y = 0    @list_window.set_handler:)ok, method:)list_ok))    @list_window.set_handler:)cancel, method:)list_cancel))     @bonus_window = Window_FormBonus.new    @form_window = Window_Formation.new    @form_window.set_handler:)ok, method:)form_ok))    @form_window.set_handler:)cancel, method:)form_cancel))    @stat_window = Window_FormStat.new    @stat_window.y = @list_window.height        @helpy_window = Window_Helpy.new#(@bonus_window.x, 0, @bonus_window.width, 48)    @helpy_window.x = @list_window.width    @helpy_window.width = @bonus_window.width        @list_window.select(0)    @list_window.activate  end  def update    super    if @list_window.active      @stat_window.set_actor(@list_window.current_item)      @helpy_window.contents.draw_text(0, 0, 300, 24, "Select a party member.", 0)    elsif @form_window.active      if @form_window.current_item        @stat_window.set_actor(@form_window.current_item)      else        @stat_window.set_actor(@list_window.current_item)              end      @helpy_window.contents.draw_text(0, 0, 300, 24, "Select a position.", 0)    end  end  def list_ok    @form_window.select(@list_window.current_item.formation_slot)    @form_window.activate    @helpy_window.refresh  end  def list_cancel    SceneManager.return  end  def form_ok    index = @form_window.current_index    actor = @list_window.current_item    if $game_party.formation_slot(index)      $game_party.formation_slot(index).formation_slot = actor.formation_slot    end    actor.formation_slot = index    @form_window.refresh    @bonus_window.refresh    @stat_window.refresh    @helpy_window.refresh    form_cancel  end  def form_cancel    @form_window.select(-1)    @list_window.activate    @helpy_window.refresh  endend class Window_Helpy < Window_Selectable   def initialize    super(Graphics.width/5*2, 0, Graphics.width/5*3, 48)    refresh  end    def refresh    contents.clear  end    def open    refresh    super  end  end class Window_FormList < Window_Selectable  def initialize    super(0,48,Graphics.width/5*2, 24 * 7)    refresh  end  def item_max    $game_party.battle_members.size  end  def draw_item(index)    actor = $game_party.battle_members[index]    rect = item_rect(index)    draw_text(rect, actor.name)    draw_text(rect, "Lvl        ",2)    draw_text(rect, actor.level,2)  end  def current_item    return $game_party.battle_members[@index] if @index >= 0    return nil  endend class Window_FormBonus < Window_Base  def initialize     super(Graphics.width/5*2,48+(Graphics.height-48)/3*2,Graphics.width/5*3,(Graphics.height-48)/3)    refresh  end  def refresh    contents.clear    change_color(system_color)    draw_text(0,0,contents.width,line_height,"Bonuses:")    return unless $game_party.current_formation    change_color(normal_color)    form = $game_party.current_formation    xx = 6;yy = line_height;iter = 1    form.each do |key, val|      next unless [:hp,:mp,:atk,:def,:mat,:mdf,:agi,:luk].include?(key)      case key      when :hp        text = sprintf("%s %+d%", Vocab::hp, val.to_s)      when :mp        text = sprintf("%s %+d%", Vocab::mp, val.to_s)      when :atk        text = sprintf("%s %+d%", Vocab::param(2), val.to_s)      when :def        text = sprintf("%s %+d%", Vocab::param(3), val.to_s)      when :mat        text = sprintf("%s %+d%", Vocab::param(4), val.to_s)      when :mdf        text = sprintf("%s %+d%", Vocab::param(5), val.to_s)      when :agi        text = sprintf("%s %+d%", Vocab::param(6), val.to_s)      when :luk        text = sprintf("%s %+d%", Vocab::param(7), val.to_s)      end      draw_text(xx,yy,contents.width/3,line_height,text)      xx += contents.width/3      if iter % 3 == 0        xx = 5; yy += line_height      end      iter += 1    end  endend class Window_Formation < Window_Selectable  def initialize    super(Graphics.width/5*2,48,Graphics.width/5*3,(Graphics.height-48)/3*2)    refresh  end  def refresh    contents.clear    xx = contents.width/4;yy = contents.height/3;iter = 0    4.times do      4.times do        draw_icon(FORMATION_ICON,xx,yy,$game_party.formation_slot(iter))        if $game_party.formation_slot(iter)          draw_actor_graphic($game_party.formation_slot(iter),xx-4,yy-16)        end        xx += 50        iter += 1      end      xx -= 200      yy += 30;xx += 20    end    change_color(system_color)    draw_text(0,0,contents.width,line_height,"Formation: ")    change_color(normal_color)    draw_text(106,0,contents.width,line_height,$game_party.formation_name)  end  def item_rect(index)    xx = contents.width/4;yy = contents.height/3    xx += index % 4 * 50    xx += 20 * (index / 4).to_i    yy += 30 * (index / 4).to_i    Rect.new(xx,yy,24,24)  end  def col_max; 4; end  def row_max; 4; end  def item_max; 16; end  def current_item    $game_party.formation_slot(@index) ? $game_party.formation_slot(@index) : nil  end  def current_index    @index  end  def draw_actor_graphic(actor,x,y)    new_bitmap = Cache.character(actor.character_name)    next_bitmap = new_bitmap.clone    xx = actor.character_index % 4 * new_bitmap.width/4    yy = actor.character_index / 4 * new_bitmap.height/2    next_bitmap.blt(0,0,next_bitmap,Rect.new(xx,yy,next_bitmap.width/4,next_bitmap.height/2))    contents.blt(x,y,next_bitmap,Rect.new(0,next_bitmap.height/8,next_bitmap.width/12,next_bitmap.height/8))  endend class Window_FormStat < Window_Base  def initialize    super(0,48+(24*7),Graphics.width/5*2,line_height*18)    refresh  end  def refresh    contents.clear    change_color(system_color)    draw_text(standard_padding*2+88,0+12,contents.width,line_height,"Name:")    draw_text(standard_padding*2+88,line_height+12,contents.width,line_height,"Class:")    draw_text(standard_padding*2+88,line_height*2+12,contents.width,line_height,"Title:") if $imported["Title-System"]    draw_text(75,line_height*4+8,contents.width/2,line_height,"Status:",1)    draw_text(75,line_height*5+10,contents.width/2,line_height,Vocab::param(0))    draw_text(75,line_height*6+10,contents.width/2,line_height,Vocab::param(1))    draw_text(75,line_height*7+10,contents.width/2,line_height,Vocab::param(2))    draw_text(75,line_height*8+10,contents.width/2,line_height,Vocab::param(3))    draw_text(75,line_height*9+10,contents.width/2,line_height,Vocab::param(4))    draw_text(75,line_height*10+10,contents.width/2,line_height,Vocab::param(5))    draw_text(75,line_height*11+10,contents.width/2,line_height,Vocab::param(6))    draw_text(75,line_height*12+10,contents.width/2,line_height,Vocab::param(7))    draw_text(75,line_height*13+10,contents.width/2,line_height,Vocab::x_param(0))    draw_text(75,line_height*14+10,contents.width/2,line_height,Vocab::x_param(2))    draw_text(75,line_height*15+10,contents.width/2,line_height,Vocab::x_param(1))    return unless @actor    change_color(normal_color)    draw_actor_face(@actor,0,0)    draw_text(-4,0+12,contents.width,line_height,@actor.name,2)    draw_text(-4,line_height*2+12,contents.width,line_height,Vocab.titles_name(@actor.title_id),2) if $imported["Title-System"]    draw_text(75,line_height*5+10,contents.width/2,line_height,@actor.mhp,2)    draw_text(75,line_height*6+10,contents.width/2,line_height,@actor.mmp,2)    draw_text(75,line_height*7+10,contents.width/2,line_height,@actor.atk,2)    draw_text(75,line_height*8+10,contents.width/2,line_height,@actor.def,2)    draw_text(75,line_height*9+10,contents.width/2,line_height,@actor.mat,2)    draw_text(75,line_height*10+10,contents.width/2,line_height,@actor.mdf,2)    draw_text(75,line_height*11+10,contents.width/2,line_height,@actor.agi,2)    draw_text(75,line_height*12+10,contents.width/2,line_height,@actor.luk,2)    value1 = eval("@actor.#{:hit}")    text1 = sprintf("%d%", value1 * 100)    value2 = eval("@actor.#{:cri}")    text2 = sprintf("%d%", value2 * 100)    value3 = eval("@actor.#{:eva}")    text3 = sprintf("%d%", value3 * 100)    draw_text(75,line_height*13+10,contents.width/2,line_height,text1,2)    draw_text(75,line_height*14+10,contents.width/2,line_height,text2,2)    draw_text(75,line_height*15+10,contents.width/2,line_height,text3,2)        if $imported["CXJ-ClassExtensions"]         if @actor.subclass.nil?        text = @actor.class.name      elsif !@actor.class.combined_name[@actor.subclass_id].nil?        text = @actor.class.combined_name[@actor.subclass_id]      else        fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT        text = sprintf(fmt, @actor.class.name, @actor.subclass.name)      end        draw_text(-4,line_height+12,contents.width,line_height,text,2)              else        draw_text(-4,line_height+12,contents.width,line_height,@actor.class.name,2)      end    end    def set_actor(actor)    return if @actor == actor    @actor = actor    refresh  endend #class Scene_Menu#  def command_formation#    SceneManager.call(Scene_Formation)#  end#end ################################################################################## Uncomment this if you don't use (or don't know how to use) Yanfly's Menu Engine# to show the new command button in the main menu for this scene.#################################################################################=beginclass Window_MenuCommand < Window_Command  alias formation1_command add_original_commands  def add_original_commands    formation1_command    add_command("Formation1", :formation1)  endend=end################################################################################## Uncomment this if you don't use (or don't know how to use) Yanfly's Menu Engine# to show the new command button in the main menu for this scene.################################################################################# if $imported["YEA-AceMenuEngine"] #optional line class Scene_Menu < Scene_MenuBase   #--------------------------------------------------------------------------  # * For Creating An Alias  #--------------------------------------------------------------------------   alias formation1_menu13211             create_command_window   #--------------------------------------------------------------------------  # * Create Command Window  #--------------------------------------------------------------------------   def create_command_window    formation1_menu13211()    @command_window.set_handler:)formation1,    method:)command_formation1))  end   #--------------------------------------------------------------------------  # * [Save] Command  #--------------------------------------------------------------------------  def command_formation1    SceneManager.call(Scene_Formation)  end endend #optional line class Window_MenuCommand  def formation_enabled    true  endend # This is it! Enjoy!
    This is all I edited in this script.

    I don't ask for any credits, but don't forget to give credits to Vlue! :p

    For Vlue:

    If there is anything you want to be removed, I will remove it, of course. 

    Wanted to PM you first before I post these, but for some reason I get an error every time I try to send one. Ohh, well, gonna try again one last time.
     
    Last edited by a moderator: Jul 17, 2014
    #11
    BCj, Dream3r and Omnimental like this.
  12. Omnimental

    Omnimental Veteran Veteran

    Messages:
    237
    Likes Received:
    83
    Location:
    Canada
    First Language:
    English
    I love all of you.  Just saying.  This is EXACTLY what I was looking for.

    Also, head's up Vlue, the default script still has the 'front row' formation effect on what is technically now the side of the battlers grid.
     
    #12
  13. blamethepoet

    blamethepoet Veteran Veteran

    Messages:
    38
    Likes Received:
    3
    First Language:
    Italian
    does it also work with Holder battlers for battle symphony?
     
    #13
  14. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Read my "3. Vlue's Formation Bonus + Yami's Battle Symphony" part of my last post here.


    Do the steps mentioned and it will work with Battle Symphony flawlessly.


    I guess Vlue put his own $imported tags by now, so you can use those instead of the one I made for it if you want.
     
    #14
  15. Danstandard

    Danstandard Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    Finnish
    Atelier RGSS has come out with a new battler sprite system. Just as I got this working with Symphony...

    Haven't had any crashes so far, but the formation lineup doesn't update when you change formation. Bonuses seem to work, though.
     
    #15
  16. Arkaik

    Arkaik Veteran Veteran

    Messages:
    76
    Likes Received:
    13
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hey!

    I'm trying to use this Formation Bonus Script with TheoAllen's Side Battle System, it works with no problem, but the characters position doesn't change. What can I do to it work appropriately?
     
    #16
  17. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Basically, it is the same like with Symphony.

    TSBS got a hard-coded X and Y position for actors in battle. It can be edited in the 'Config 1' part of TSBS, the setting is named 'ActorPos' and is a multilevel array containing the X and Y position of all the actors.

    If you search for 'ActorPos' with a full script list search (CTRL+SHIFT+F), you will find these lines in the 'Implementation' part:

    # -------------------------------------------------------------------------- # New method : Original X position # -------------------------------------------------------------------------- def original_x ActorPos[index][0] || 0 rescue 0 end # -------------------------------------------------------------------------- # New method : Original Y position # -------------------------------------------------------------------------- def original_y ActorPos[index][1] || 0 rescue 0 end
    This is the part you need to change.

    Try to change the parts above with this:

    # -------------------------------------------------------------------------- # New method : Original X position # -------------------------------------------------------------------------- def original_x FORMATION_LOCATIONS[@formation_slot][0] + offset || 0 rescue 0 end # -------------------------------------------------------------------------- # New method : Original Y position # -------------------------------------------------------------------------- def original_y FORMATION_LOCATIONS[@formation_slot][1] + offset || 0 rescue 0 end
    Note the 'offset' I added to each values. If you don't add these values, the position of the actors in the battle will be the direct co-ordinates from the formation scene itself, meaning that you could get some rather weird position for your actors in the battle. Their formation remains relative to each other, but you might need to offset the formation position on the screen itself to display it correctly in the battle. That is why I put that 'offset' value there. Basically, it is an integer number and represents pixels. Use it to fine tune the position of the formation as one in the battle itself. If you don't need to offset the positions, just delete that part.

    I haven't tested this, but in theory, this should work just fine. Let me know if it doesn't for some reason.
     
    #17
    Dream3r likes this.
  18. Arkaik

    Arkaik Veteran Veteran

    Messages:
    76
    Likes Received:
    13
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hey Sixth!

    I'm really thankful for your attempt to help me, but i it doesn't works.  :(

    When i search for 'ActorPos' i found it:

     
    #18
  19. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You need to use the full list search with CTRL+SHIFT+F, not the normal search with CTRL+F.


    If you search the full list, you will find the mentioned parts, it is needed for TSBS, there is no way that you don't have it.
     
    #19
  20. Arkaik

    Arkaik Veteran Veteran

    Messages:
    76
    Likes Received:
    13
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I found it!

    I did what you tell me to do.

    Now it works, but i found another problem:

    The actor position now works like if the actors were behind the enemies and high above of them (out of the screen).

    I tried to put the formation script below the TSBS scripts and the actor sprite is showed as intended to be, but the actor is behind and above yet. 
     
    #20

Share This Page