——— — Before you ask! Read! ;) —
You must have 30+ Posts to create a topic here!
— Thanks for reading! — ———
|
|
  |
Individual battlestatus windows?, Each character get's their own? |
|
|
|
|
Feb 19 2012, 03:38 AM
|

Level 50

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed

|
CODE #============================================================================== # ** XP: Night_Runner's Individual Battlestatus Windows #------------------------------------------------------------------------------ # History: # Date Created: 19/Feb/2012 # Created for: Wonderjosh # @> http://www.rpgrevolution.com/forums/index.php?showtopic=55412 # # Description: # This script has individual battlestatus windows for each actor, lines # 64 - 75 make the active battler's window move up a bit. # # How to Install: # Copy this entire script. In your game editor select Tools >> Script # Editor. Along the left hand side scroll to the bottom, right click on # 'Main' and select 'Insert'. Past on the right. #==============================================================================
#============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # This array holds each battle window #==============================================================================
class Window_BattleStatus #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Create an array of battlestatus windows @battle_windows = [] # Populate the battlestatus windows for i in 0..3 @battle_windows[i] = Window_IndividualBattleStatus.new(i) end end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up(actor_index) # Tell the appropriate window to run the level up algorithm @battle_windows[actor_index].level_up end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # For each window, refresh @battle_windows.each { |window| window.refresh } end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # For each window, update @battle_windows.each { |window| window.update } end #-------------------------------------------------------------------------- # * Active Actor Index #-------------------------------------------------------------------------- def active_actor_index=(active_index) # Loop through each window for i in 0...@battle_windows.size # Get the window for this loop window = @battle_windows[i] # If it is active, move up (to 300 pixels form the top) if i == active_index window.y = [window.y - 2, 300].max # If it is not active, move it back (2 picels at a time) else window.y = [window.y + 2, 320].min end end end end
#============================================================================== # ** Window_IndividualBattleStatus #------------------------------------------------------------------------------ # This window displays the status of each party members on the battle screen. #==============================================================================
class Window_IndividualBattleStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_index) @actor_index = actor_index super(actor_index * 640 / 4, 320, 640 / 4, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = false refresh end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up @level_up_flags = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear actor = $game_party.actors[@actor_index] draw_actor_name(actor, 0, 0) draw_actor_hp(actor, 0, 32, 120) draw_actor_sp(actor, 0, 64, 120) if @level_up_flags self.contents.font.color = normal_color self.contents.draw_text(0, 96, 120, 32, "LEVEL UP!") else draw_actor_state(actor, 0, 96) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end end end
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # Edited to tell the status window which actors are acitve #==============================================================================
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- alias nr_individualbattlewindows_update update unless $@ #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) # Run the original update nr_individualbattlewindows_update(*args) # If the active battler is an actor, tell the battlestatus windows array # which actor is active if @active_battler.is_a?(Game_Actor) actor_index = $game_party.actors.index(@active_battler) @status_window.active_actor_index = actor_index # If an enemy is active, then set no window as active else @status_window.active_actor_index = -1 end end end
#============================================================================== # ** End of Script. #============================================================================== I'm not particularly happy about the black background underneath the windows, would you like me to do something about it? I was thinking either make the battlestatus windows smaller so it has a boarder of black, like in earthbound, or I could add a snippet of code to allow the battle back to take up the full screen, or I could just increase the height of the windows as the actor is selected.
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Feb 19 2012, 08:07 AM
|

Level 3

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed

|
QUOTE (Night_Runner @ Feb 19 2012, 05:38 AM)  CODE #============================================================================== # ** XP: Night_Runner's Individual Battlestatus Windows #------------------------------------------------------------------------------ # History: # Date Created: 19/Feb/2012 # Created for: Wonderjosh # @> http://www.rpgrevolution.com/forums/index.php?showtopic=55412 # # Description: # This script has individual battlestatus windows for each actor, lines # 64 - 75 make the active battler's window move up a bit. # # How to Install: # Copy this entire script. In your game editor select Tools >> Script # Editor. Along the left hand side scroll to the bottom, right click on # 'Main' and select 'Insert'. Past on the right. #==============================================================================
#============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # This array holds each battle window #==============================================================================
class Window_BattleStatus #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Create an array of battlestatus windows @battle_windows = [] # Populate the battlestatus windows for i in 0..3 @battle_windows[i] = Window_IndividualBattleStatus.new(i) end end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up(actor_index) # Tell the appropriate window to run the level up algorithm @battle_windows[actor_index].level_up end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # For each window, refresh @battle_windows.each { |window| window.refresh } end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # For each window, update @battle_windows.each { |window| window.update } end #-------------------------------------------------------------------------- # * Active Actor Index #-------------------------------------------------------------------------- def active_actor_index=(active_index) # Loop through each window for i in 0...@battle_windows.size # Get the window for this loop window = @battle_windows[i] # If it is active, move up (to 300 pixels form the top) if i == active_index window.y = [window.y - 2, 300].max # If it is not active, move it back (2 picels at a time) else window.y = [window.y + 2, 320].min end end end end
#============================================================================== # ** Window_IndividualBattleStatus #------------------------------------------------------------------------------ # This window displays the status of each party members on the battle screen. #==============================================================================
class Window_IndividualBattleStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_index) @actor_index = actor_index super(actor_index * 640 / 4, 320, 640 / 4, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = false refresh end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up @level_up_flags = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear actor = $game_party.actors[@actor_index] draw_actor_name(actor, 0, 0) draw_actor_hp(actor, 0, 32, 120) draw_actor_sp(actor, 0, 64, 120) if @level_up_flags self.contents.font.color = normal_color self.contents.draw_text(0, 96, 120, 32, "LEVEL UP!") else draw_actor_state(actor, 0, 96) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end end end
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # Edited to tell the status window which actors are acitve #==============================================================================
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- alias nr_individualbattlewindows_update update unless $@ #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) # Run the original update nr_individualbattlewindows_update(*args) # If the active battler is an actor, tell the battlestatus windows array # which actor is active if @active_battler.is_a?(Game_Actor) actor_index = $game_party.actors.index(@active_battler) @status_window.active_actor_index = actor_index # If an enemy is active, then set no window as active else @status_window.active_actor_index = -1 end end end
#============================================================================== # ** End of Script. #============================================================================== I'm not particularly happy about the black background underneath the windows, would you like me to do something about it? I was thinking either make the battlestatus windows smaller so it has a boarder of black, like in earthbound, or I could add a snippet of code to allow the battle back to take up the full screen, or I could just increase the height of the windows as the actor is selected. Hey man, this is great! But yeah, maybe if the windows were smaller AND allow the battle back to take up the screen would be awesome! Sheesh, you are such a help, haha. And for everyone else, here's a link to a screenshot of a battle scene from Earthbound (Mother 2). For those who've never heard of it or just never played it, it's probably one of the quirkiest, most fun, RPG's out there. With a killer soundtrack to boot. I'm a big fan, as you can tell by my avatar if you know the game, haha. Click here for the screenshot. EDIT: When there's less than 4 players in the party, I get an error saying: Script 'Window_Base' line123: NoMethodError occurred. undefined method 'name' for nil:NilClass. Darn those NoMethodErrors, always getting in the way, haha.
This post has been edited by Wonderjosh: Feb 19 2012, 08:11 AM
|
|
|
|
|
|
|
|
|
Feb 20 2012, 05:25 AM
|

Level 50

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed

|
Attempt 2: CODE #============================================================================== # ** XP: Night_Runner's Individual Battlestatus Windows #------------------------------------------------------------------------------ # History: # Date Created: 19/Feb/2012 # Created for: Wonderjosh # @> http://www.rpgrevolution.com/forums/index.php?showtopic=55412 # # Description: # This script has individual battlestatus windows for each actor, lines # 64 - 75 make the active battler's window move up a bit. # # How to Install: # Copy this entire script. In your game editor select Tools >> Script # Editor. Along the left hand side scroll to the bottom, right click on # 'Main' and select 'Insert'. Past on the right. #==============================================================================
#============================================================================== # ** Customization #==============================================================================
module NR_IndividualBattlestatusWindows WindowWidth = 120 # Width of the individual windows (pixels) WindowHeight = 150 # Height of the individual windows (pixels) WindowDistBottom = 20 # Distance between the bottom of the screen and # individual windows (pixels) MoveUpDist = 20 # Amount to move the active actor's window up # by (pixels) WindowMoveSpeed = 2 # Speed to move up at (pixels/frame) TextDY = 32 # Distance between each line of text (pixels) ShowState = true # Append a Status/Level up line (true/false) end
#============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # Edited to have the actors match the window positions #==============================================================================
class Game_Actor #-------------------------------------------------------------------------- # * Get Battle Screen X-Coordinate #-------------------------------------------------------------------------- def screen_x # Return after calculating x-coordinate by order of members in party if self.index != nil num_actors = $game_party.actors.size ww = NR_IndividualBattlestatusWindows::WindowWidth x = 320 - num_actors * ww / 2 + self.index * ww + ww / 2 return x else return 0 end end end
#============================================================================== # ** Spriteset_Battle #------------------------------------------------------------------------------ # Edited to allow a fullscreen backdrop. #==============================================================================
class Spriteset_Battle #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Make viewports @viewport1 = Viewport.new(0, 0, 640, 480) #NREdit @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport4 = Viewport.new(0, 0, 640, 480) @viewport2.z = 101 @viewport3.z = 200 @viewport4.z = 5000 # Make battleback sprite @battleback_sprite = Sprite.new(@viewport1) # Make enemy sprites @enemy_sprites = [] for enemy in $game_troop.enemies.reverse @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy)) end # Make actor sprites @actor_sprites = [] @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) # Make weather @weather = RPG::Weather.new(@viewport1) # Make picture sprites @picture_sprites = [] for i in 51..100 @picture_sprites.push(Sprite_Picture.new(@viewport3, $game_screen.pictures[i])) end # Make timer sprite @timer_sprite = Sprite_Timer.new # Frame update update end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update actor sprite contents (corresponds with actor switching) @actor_sprites[0].battler = $game_party.actors[0] @actor_sprites[1].battler = $game_party.actors[1] @actor_sprites[2].battler = $game_party.actors[2] @actor_sprites[3].battler = $game_party.actors[3] # If battleback file name is different from current one if @battleback_name != $game_temp.battleback_name @battleback_name = $game_temp.battleback_name if @battleback_sprite.bitmap != nil @battleback_sprite.bitmap.dispose end @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name) @battleback_sprite.src_rect.set(0, 0, 640, 480) #NREdit end # Update battler sprites for sprite in @enemy_sprites + @actor_sprites sprite.update end # Update weather graphic @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.update # Update picture sprites for sprite in @picture_sprites sprite.update end # Update timer sprite @timer_sprite.update # Set screen color tone and shake position @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake # Set screen flash color @viewport4.color = $game_screen.flash_color # Update viewports @viewport1.update @viewport2.update @viewport4.update end end
#============================================================================== # ** Window_IndividualBattleStatus #------------------------------------------------------------------------------ # This window displays the status of each party members on the battle screen. #==============================================================================
class Window_IndividualBattleStatus < Window_Base #-------------------------------------------------------------------------- # * Include Modules #-------------------------------------------------------------------------- include NR_IndividualBattlestatusWindows #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :active_battler #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_index) @actor_index = actor_index num_actors = $game_party.actors.size x = 320 - num_actors * WindowWidth / 2 + @actor_index * WindowWidth y = 480 - WindowHeight - WindowDistBottom super(x, y, WindowWidth, WindowHeight) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = false @active_battler = false refresh end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up @level_up_flags = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear actor = $game_party.actors[@actor_index] return if not actor.is_a?(Game_Actor) width = self.contents.width draw_actor_name(actor, 0, 0 * TextDY) draw_actor_hp(actor, 0, 1 * TextDY, width) draw_actor_sp(actor, 0, 2 * TextDY, width) if @level_up_flags self.contents.font.color = normal_color self.contents.draw_text(0, 3 * TextDY, width, 32, "LEVEL UP!") else draw_actor_state(actor, 0, 3 * TextDY, width) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end # Move the window upper_y = 480 - WindowDistBottom - WindowHeight if @active_battler == true self.y = [self.y - WindowMoveSpeed, upper_y - MoveUpDist].max else self.y = [self.y + WindowMoveSpeed, upper_y].min end end end
#============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # This array holds each battle window #==============================================================================
class Window_BattleStatus #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Create an array of battlestatus windows @battle_windows = [] # Populate the battlestatus windows for i in 0...$game_party.actors.size @battle_windows[i] = Window_IndividualBattleStatus.new(i) end end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up(actor_index) # Make sure that the window exists if not @battle_windows[actor_index].is_a?(Window_InidivdualBattleStatus) return end # Tell the appropriate window to run the level up algorithm @battle_windows[actor_index].level_up end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # For each window, refresh @battle_windows.each { |window| window.refresh } end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # For each window, update @battle_windows.each { |window| window.update } end #-------------------------------------------------------------------------- # * Active Actor Index #-------------------------------------------------------------------------- def active_actor_index=(active_index) # Loop through each window for i in 0...@battle_windows.size # Get the window for this loop window = @battle_windows[i] # If it is active, move up (to 300 pixels form the top) window.active_battler = (i == active_index) end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose # For each window, dispose @battle_windows.each { |window| window.dispose end end
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # Edited to tell the status window which actors are acitve #==============================================================================
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- alias nr_ibw_phase3_update update unless $@ alias nr_ibw_phase3_setup_command_window phase3_setup_command_window unless $@ #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) # Run the original update nr_ibw_phase3_update(*args) # If the active battler is an actor, tell the battlestatus windows array # which actor is active if @active_battler.is_a?(Game_Actor) actor_index = $game_party.actors.index(@active_battler) @status_window.active_actor_index = actor_index # If an enemy is active, then set no window as active else @status_window.active_actor_index = -1 end end #-------------------------------------------------------------------------- # * Actor Command Window Setup #-------------------------------------------------------------------------- def phase3_setup_command_window(*args) # Run the original phase3_setup_command_window nr_ibw_phase3_setup_command_window(*args) # Get where to show the window num_actors = $game_party.actors.size ww = NR_IndividualBattlestatusWindows::WindowWidth aw = @actor_command_window.width x = 320 - num_actors * ww / 2 + @actor_index * ww + (ww - aw) / 2 wh = NR_IndividualBattlestatusWindows::WindowHeight wdb = NR_IndividualBattlestatusWindows::WindowDistBottom muh = NR_IndividualBattlestatusWindows::MoveUpDist y = 480 - wh - wdb - muh - @actor_command_window.height # Set actor command window position @actor_command_window.x = x @actor_command_window.y = y end end
#============================================================================== # ** End of Script. #============================================================================== That should fix up everything you've mentioned. On a youtube video I found of Earthworm 1, the battle system had the 'attack', 'defend', etc options along the top, would you be interested in that incorporated into this script?
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Feb 20 2012, 08:43 AM
|

Level 3

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed

|
QUOTE That should fix up everything you've mentioned. On a youtube video I found of Earthworm 1, the battle system had the 'attack', 'defend', etc options along the top, would you be interested in that incorporated into this script? Hey sure! I'm using a script that gives each character their own set of battle commands for their skills, too, so I'll post that if you need to make it compatible. Maybe try to see if it can be set up so I can switch the commands at the top on or off if the default style works better? If that's too much, don't worry! EDIT: Also, is it possible to have the battler move up with the window when it's their turn as well? I think I might have a little icon of the character's face resting on the top of each character's window, if that's possible. Also I put the code in, and it works with less than 4 characters now AND the battle back fits the screen, so thank you! Though I'm getting an error when the battle finishes: Script 'Window_Base' line 30: RGSSError occurred. disposed window But other than that, it works great! Here's the battle command script. I don't think this really has anything to do with the error, but I'm no scripter, so I really can't say for sure. I had found it on a forum and the author didn't list their credit in the code, so I figured I'd include it in there (I'm assuming they're the author since they had posted it to help out someone else): CODE #abbey's Individual Battle Commands
class Scene_Battle alias cbs_phase3_setup_command_window phase3_setup_command_window def phase3_setup_command_window cbs_phase3_setup_command_window case $game_party.actors[@actor_index].id when 1 commands = ["Attack", "Crazy", "Defend", "Items"] when 2 commands = ["Attack", "Psycho", "Defend", "Items"] when 3 commands = ["Attack", "Nuts", "Defend", "Items"] when 4 commands = ["Attack", "Loony", "Defend", "Stash"] end @actor_command_window.change_commands(commands) end end class Window_Command def change_commands(commands) @original = @commands unless @original @commands = commands ? commands : @original refresh end end EDIT: The same error occurs when selecting to escape from battle, too!
This post has been edited by Wonderjosh: Feb 21 2012, 01:25 PM
|
|
|
|
|
|
|
|
|
Feb 23 2012, 05:16 AM
|

Level 50

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed

|
That snippet of code if from Kratos's custom battle system  I've got the actor's moving, and I've fixed the issue where the script would error when you finished the battle: CODE #============================================================================== # ** XP: Night_Runner's Individual Battlestatus Windows #------------------------------------------------------------------------------ # History: # Date Created: 19/Feb/2012 # Created for: Wonderjosh # @> http://www.rpgrevolution.com/forums/index.php?showtopic=55412 # # Description: # This script has individual battlestatus windows for each actor, lines # 64 - 75 make the active battler's window move up a bit. # # How to Install: # Copy this entire script. In your game editor select Tools >> Script # Editor. Along the left hand side scroll to the bottom, right click on # 'Main' and select 'Insert'. Past on the right. #==============================================================================
#============================================================================== # ** Customization #==============================================================================
module NR_IndividualBattlestatusWindows WindowWidth = 120 # Width of the individual windows (pixels) WindowHeight = 150 # Height of the individual windows (pixels) WindowDistBottom = 20 # Distance between the bottom of the screen and # individual windows (pixels) MoveUpDist = 20 # Amount to move the active actor's window up # by (pixels) WindowMoveSpeed = 2 # Speed to move up at (pixels/frame) TextDY = 32 # Distance between each line of text (pixels) ShowState = true # Append a Status/Level up line (true/false) end
#============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # Edited to have the actors match the window positions #==============================================================================
class Game_Actor #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :battle_active_y #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- alias nr_ibw_initialize initialize unless $@ alias nr_ibw_screen_y screen_y unless $@ #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) @battle_active_y = 0 return nr_ibw_initialize(*args) end #-------------------------------------------------------------------------- # * Get Battle Screen X-Coordinate #-------------------------------------------------------------------------- def screen_x # Return after calculating x-coordinate by order of members in party if self.index != nil num_actors = $game_party.actors.size ww = NR_IndividualBattlestatusWindows::WindowWidth x = 320 - num_actors * ww / 2 + self.index * ww + ww / 2 return x else return 0 end end #-------------------------------------------------------------------------- # * Get Battle Screen Y-Coordinate #-------------------------------------------------------------------------- def screen_y(*args) return nr_ibw_screen_y(*args) + @battle_active_y end end
#============================================================================== # ** Spriteset_Battle #------------------------------------------------------------------------------ # Edited to allow a fullscreen backdrop. #==============================================================================
class Spriteset_Battle #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Make viewports @viewport1 = Viewport.new(0, 0, 640, 480) #NREdit @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport4 = Viewport.new(0, 0, 640, 480) @viewport2.z = 101 @viewport3.z = 200 @viewport4.z = 5000 # Make battleback sprite @battleback_sprite = Sprite.new(@viewport1) # Make enemy sprites @enemy_sprites = [] for enemy in $game_troop.enemies.reverse @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy)) end # Make actor sprites @actor_sprites = [] @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) # Make weather @weather = RPG::Weather.new(@viewport1) # Make picture sprites @picture_sprites = [] for i in 51..100 @picture_sprites.push(Sprite_Picture.new(@viewport3, $game_screen.pictures[i])) end # Make timer sprite @timer_sprite = Sprite_Timer.new # Frame update update end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update actor sprite contents (corresponds with actor switching) @actor_sprites[0].battler = $game_party.actors[0] @actor_sprites[1].battler = $game_party.actors[1] @actor_sprites[2].battler = $game_party.actors[2] @actor_sprites[3].battler = $game_party.actors[3] # If battleback file name is different from current one if @battleback_name != $game_temp.battleback_name @battleback_name = $game_temp.battleback_name if @battleback_sprite.bitmap != nil @battleback_sprite.bitmap.dispose end @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name) @battleback_sprite.src_rect.set(0, 0, 640, 480) #NREdit end # Update battler sprites for sprite in @enemy_sprites + @actor_sprites sprite.update end # Update weather graphic @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.update # Update picture sprites for sprite in @picture_sprites sprite.update end # Update timer sprite @timer_sprite.update # Set screen color tone and shake position @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake # Set screen flash color @viewport4.color = $game_screen.flash_color # Update viewports @viewport1.update @viewport2.update @viewport4.update end end
#============================================================================== # ** Window_IndividualBattleStatus #------------------------------------------------------------------------------ # This window displays the status of each party members on the battle screen. #==============================================================================
class Window_IndividualBattleStatus < Window_Base #-------------------------------------------------------------------------- # * Include Modules #-------------------------------------------------------------------------- include NR_IndividualBattlestatusWindows #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :active_battler #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor_index) @actor_index = actor_index num_actors = $game_party.actors.size x = 320 - num_actors * WindowWidth / 2 + @actor_index * WindowWidth y = 480 - WindowHeight - WindowDistBottom super(x, y, WindowWidth, WindowHeight) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = false @active_battler = false refresh end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up @level_up_flags = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear actor = $game_party.actors[@actor_index] return if not actor.is_a?(Game_Actor) width = self.contents.width draw_actor_name(actor, 0, 0 * TextDY) draw_actor_hp(actor, 0, 1 * TextDY, width) draw_actor_sp(actor, 0, 2 * TextDY, width) if @level_up_flags self.contents.font.color = normal_color self.contents.draw_text(0, 3 * TextDY, width, 32, "LEVEL UP!") else draw_actor_state(actor, 0, 3 * TextDY, width) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end # Move the window upper_y = 480 - WindowDistBottom - WindowHeight if @active_battler == true self.y = [self.y - WindowMoveSpeed, upper_y - MoveUpDist].max else self.y = [self.y + WindowMoveSpeed, upper_y].min end $game_party.actors[@actor_index].battle_active_y = self.y - upper_y end end
#============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # This array holds each battle window #==============================================================================
class Window_BattleStatus #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Create an array of battlestatus windows @battle_windows = [] # Populate the battlestatus windows for i in 0...$game_party.actors.size @battle_windows[i] = Window_IndividualBattleStatus.new(i) end end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up(actor_index) # Make sure that the window exists if not @battle_windows[actor_index].is_a?(Window_InidivdualBattleStatus) return end # Tell the appropriate window to run the level up algorithm @battle_windows[actor_index].level_up end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # For each window, refresh @battle_windows.each { |window| window.refresh } end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # For each window, update @battle_windows.each { |window| window.update } end #-------------------------------------------------------------------------- # * Active Actor Index #-------------------------------------------------------------------------- def active_actor_index=(active_index) # Loop through each window for i in 0...@battle_windows.size # Get the window for this loop window = @battle_windows[i] # If it is active, move up (to 300 pixels form the top) window.active_battler = (i == active_index) end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose # For each window, dispose @battle_windows.each { |window| window.dispose } end end
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # Edited to tell the status window which actors are acitve #==============================================================================
class Scene_Battle #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- alias nr_ibw_phase3_update update unless $@ alias nr_ibw_phase3_setup_command_window phase3_setup_command_window unless $@ #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) # Run the original update nr_ibw_phase3_update(*args) # If the active battler is an actor, tell the battlestatus windows array # which actor is active if @active_battler.is_a?(Game_Actor) actor_index = $game_party.actors.index(@active_battler) @status_window.active_actor_index = actor_index # If an enemy is active, then set no window as active else @status_window.active_actor_index = -1 end end #-------------------------------------------------------------------------- # * Actor Command Window Setup #-------------------------------------------------------------------------- def phase3_setup_command_window(*args) # Run the original phase3_setup_command_window nr_ibw_phase3_setup_command_window(*args) # Get where to show the window num_actors = $game_party.actors.size ww = NR_IndividualBattlestatusWindows::WindowWidth aw = @actor_command_window.width x = 320 - num_actors * ww / 2 + @actor_index * ww + (ww - aw) / 2 wh = NR_IndividualBattlestatusWindows::WindowHeight wdb = NR_IndividualBattlestatusWindows::WindowDistBottom muh = NR_IndividualBattlestatusWindows::MoveUpDist y = 480 - wh - wdb - muh - @actor_command_window.height # Set actor command window position @actor_command_window.x = x @actor_command_window.y = y end end
#============================================================================== # ** End of Script. #============================================================================== With the 'attack', etc command window, it would make my life much easier if it were just the command window being moved up to the top, but I noticed that earthbound has a lot more changes than just that. Would you like me to just move it to the top, or would you like me to try getting the skill system similar to earthbound as well (where you have the different categories of skills, and each skill in the category has a level 1-4 version)?
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Feb 23 2012, 09:21 AM
|

Level 3

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed

|
QUOTE With the 'attack', etc command window, it would make my life much easier if it were just the command window being moved up to the top, but I noticed that earthbound has a lot more changes than just that. Would you like me to just move it to the top, or would you like me to try getting the skill system similar to earthbound as well (where you have the different categories of skills, and each skill in the category has a level 1-4 version)? Sweet! Works great! And sure, might as well move the command window to the top, haha. Would look much better, too, really. I did post that individual command script I'm using and would like to still be able to use that as well (unless you can come up with something just the same within this script!) And maybe if we can have an escape option for each characters turn, too? Then that way I can get rid of the "Fight" and "Escape" option at the beginning of the battle. I think I saw a script out there that does that. The skill system can stay default since we'd have to go into the menu system and switch that up as well! I don't want to be completely ripping off Earthbound, haha  Though it would be need to have them organized in offensive, recovery and assistance... But that's not really necessary, especially with having to mess around with the menu system, haha. But I suppose if you wanted to tackle that challenge, then by all means! Again, I'm super appreciative for what you've done so far! EDIT: Bug report! Haha. When a character gets a level up, I get this error: Script 'Individual Battlestatus Windows' line 279: NameError occurred. uninitialized constant Window_Battlestatus::Window_IndividualBattleStatus This happens when the battle results window should pop up. I'm thinking it's just a matter of class labels? One being misnamed maybe? But I really don't know, haha. EDITED EDIT: Nevermind the bug. Just was a spelling typo in the script that I totally overlooked, haha. Works beautifully with the correction
This post has been edited by Wonderjosh: Mar 3 2012, 08:56 AM
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|