Group: Member
Posts: 5
Type: None
RM Skill: Undisclosed
I've edited Kylock's Dynamic Party Positions addon to be er... more dynamic? Thought people might want it for their stuff. Here's the it does:
Now I was going to write it as a separate script, but looking at it, it seemed like it would be better suited as an edit to Kylock's script as it completely reworks the majority of his code.
Dynamic Party Positions ++ (Row Changer support) Created by Kylock (All credit to him!) Edited (because I needed to) by Scott Ewart (Yamiscott)
What it does
NEW! Now the script changes the positions upon Row Edit, if Row Changer is being used.
NEW! Reworked the method that you edit the positions, now you set the max Y distance you want the party to fall down to and the offsets you require between party members.
NEW! Edits have been moved to the top so they are easier to find.
Changes the visual positions of party members based on row position and party member permission (altered in this version, still true though)
Requirements
Mostly the same stuff as before:
Required:
RPG Tankentai Sideview Battle System
Optional:
OriginalWij's Row Changer
KGC LargeParty
Screenshot:
Show
How to use it Edit the values with your own offsets:
XPOS_START - This is the X point where your party starts. XOFFSET - This is the general X offset between each character not taking row into account for that waterfall effect. YPOS_START - This is the Y point where your party starts. YOFFSET_MAX - This is the full vertical length that your party will span, it's then divided by your party size so you use the full height at even gaps. ROW_FRONT - The front row offset, normally set to 1 ROW_MID - The middle row offset ROW_BACK - The back row offset
Visual representation:
Show
Script
Show Code
CODE
#================================================================ ============= # Kylock's Dynamic Party Positions for RPG Tankentai Sideview Battle System # By Kylock # With Row Changer support #============================================================================= # This add-on by Kylock will dynamically change the positioning of # party members in battle depending on the amount of party members that # are fighting. This script has no effect on anything else besides how # actor sprites are positioned. # # To customize coordinates, read the comments in the middle of this script. # # The ACTOR_POSITION array and MAX_MEMBERS value in the SBS Configurations # script are overwritten by this script. # # Positions will not be dynamic when used in Battle Test. # # *Installation: # This script add-on should be placed below the Sideview scripts in the # script editor. KGC_LargeParty should be placed BELOW this add-on if you are # using that script. # # *Script comments added by Mr. Bubble. # #============================================================================= # Dynamic additions by Scott Ewart (Yamiscott) #============================================================================= # # Now the script changes the positions upon Row Edit, if Row Changer is being # used. # # Also it reworks the method that you edit the positions, now you set the max # Y distance you want the party to fall down to and the offsets you require # between party members. # # Edits have been moved to the top so they are easier to find. # #=============================================================================
module N01 MAX_BATTLE_MEMBERS = 4 # Max battle members in a party. This value is # overwritten by KGC_LargeParty. #-------------------------------------------------------------------------- # Variables to be edited by you! # # Here you need to set the start points and offsets of your party #-------------------------------------------------------------------------- XPOS_START = 420 # This is the X start position of your party.
XOFFSET = 10 # The waterfall position effect.
YPOS_START = 140 # Y start position of your party
YOFFSET_MAX = 60 # MAX Y Offset, then we divid this by the party for # Kylocks original effect ROW_FRONT = 0 # This is how large the gap is between members based on ROW_MID = 20 # row positions. ROW_BACK = 40
end
class Game_Party < Game_Unit #-------------------------------------------------------------------------- # * Constants #-------------------------------------------------------------------------- MAX_MEMBERS = N01::MAX_BATTLE_MEMBERS # Maximum number of party members #-------------------------------------------------------------------------- # Gathering the Edits values #-------------------------------------------------------------------------- XPOS_START = N01::XPOS_START XOFFSET = N01::XOFFSET YPOS_START = N01::YPOS_START YOFFSET_MAX = N01::YOFFSET_MAX ROW_FRONT = N01::ROW_FRONT ROW_MID = N01::ROW_MID ROW_BACK = N01::ROW_BACK def add_actor(actor_id) if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id) @actors.push(actor_id) $game_player.refresh update_formation end end def setup_starting_members @actors = [] for i in $data_system.party_members @actors.push(i) end update_formation end def remove_actor(actor_id) @actors.delete(actor_id) $game_player.refresh update_formation end #-------------------------------------------------------------------------- # Update visual positions #-------------------------------------------------------------------------- def update_formation # Create the actors array containing the ids of all the party members. actors = Array.new for i in $data_system.party_members actors.push(i) end # Create the final array allpos = Array.new # This is an automated method of Kylocks space based on party members. # We divide the max offset by the number of party members beyond P1. yoffset = YOFFSET_MAX / (actors.size - 1) for i in actors # We need the get the row data and to do that we have to reference the # actor. thisactor = $game_actors[i] # as i is the id, we want the party position, therefore the index key. partyplace = actors.index(i) # Now a switch for the row. Future proof too case thisactor.row # Here we set the X positions of the characters based on row position # and x offset. when 0: xplace = XPOS_START + ROW_FRONT + (XOFFSET * partyplace) when 1: xplace = XPOS_START + ROW_MID + (XOFFSET * partyplace) when 2: xplace = XPOS_START + ROW_BACK + (XOFFSET * partyplace) end # Here we set the Y positions of your party. yplace = YPOS_START + (yoffset * (partyplace)) # Now we bring it all together. pos = Array.new pos.push(xplace) pos.push(yplace) # and add that to the main array. allpos.push(pos) end # Then apply it to the ACTOR_POSITION variable that is used by SBS. $ACTOR_POSITION = allpos end end
module N01 #-------------------------------------------------------------------------- # ● Settings #-------------------------------------------------------------------------- # Actor starting posistions # X Y X Y X Y X Y #$ACTOR_POSITION = [[440,200],[480,160],[455,200],[505,220],[480,260]] # Maximum party members that can fight at the same time. # Remember to add to the ACTOR_POSITION array to accomodate. MAX_MEMBER = N01::MAX_BATTLE_MEMBERS end
class Game_Actor < Game_Battler def base_position # Actor positions for Battle Test only. $ACTOR_POSITION = [[430,140],[480,160],[455,200],[505,220],[480,260]] if $BTEST base = $ACTOR_POSITION[self.index] @base_position_x = base[0] @base_position_y = base[1] # バックアタック時はX軸を逆に @base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK end #-------------------------------------------------------------------------- # Update on changes to rows via OriginalWij's Row Changer #-------------------------------------------------------------------------- def row=(new_row) @row = new_row lets_update = Game_Party.new lets_update.update_formation end end
Obviously, all kudos to Kylock, I just edited it to work with Row changer and gutted the edit process. I've never scripted for RPG Maker before, but I know my way round enough programming languages to get by. Never posted anything before though. If anyone feels this should be a seperate script, I can do that, but as mentioned it reworks far too much of the original script that I felt it should be an edit not a new one, requiring the original and my edit seems a little overkill to get this effect.
Enjoy!
This post has been edited by yamiscott: Sep 11 2010, 11:05 AM