Huésped Invitado
| Tema: Script SP 0 cuando mueres. Mar Sep 16, 2008 6:47 pm | |
| Hola. Otro de los scripts viejos que encontre en un CD. Creo que los saqué de planeta rpg. Bueno. Este script permite tener 5 heroes en el juego. Aqui el script. - Spoiler:
- Código:
-
#============================================================================== # 5 Actor party #============================================================================== # Raice # Version 1 # 06-21-2006 #------------------------------------------------------------------------------ # I edit game_party, window_menustatus, spriteset_battle, window_battlestatus, # game_actor, and scene_battle #==============================================================================
#============================================================================== # ** Game_Party #------------------------------------------------------------------------------ # This class handles the party. It includes information on amount of gold # and items. Refer to "$game_party" for the instance of this class. #============================================================================== class Game_Party #-------------------------------------------------------------------------- # * Add an Actor # actor_id : actor ID #-------------------------------------------------------------------------- def add_actor(actor_id) # Get actor actor = $game_actors[actor_id] # If the party has less than 5 members and this actor is not in the party if @actors.size < 5 and not @actors.include?(actor) # Add actor @actors.push(actor) # Refresh player $game_player.refresh end end end #============================================================================== # ** Spriteset_Battle #------------------------------------------------------------------------------ # This class brings together battle screen sprites. It's used within # the Scene_Battle class. #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Make viewports @viewport1 = Viewport.new(0, 0, 640, 320) @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)) @actor_sprites.push(Sprite_Battler.new(@viewport2))#adds additional actor # 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] #updates the additional actor sprite @actor_sprites[4].battler = $game_party.actors[4] #added this # 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, 320) 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_MenuStatus #------------------------------------------------------------------------------ # This window displays party member status on the menu screen. #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 64 y = i * 90 #this is the spacing of the actor info in menu actor = $game_party.actors[i] draw_actor_graphic(actor, x - 40, y + 80) draw_actor_name(actor, x, y) draw_actor_class(actor, x + 144, y) draw_actor_level(actor, x, y + 32) draw_actor_state(actor, x + 90, y + 32) draw_actor_exp(actor, x, y + 64) draw_actor_hp(actor, x + 236, y + 32) draw_actor_sp(actor, x + 236, y + 64) end end #-------------------------------------------------------------------------- # * Cursor Rectangle Update #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else # this is the cursor spacing when selecting the actor for skills and such # the index * number has to be the same as the number used above in the refresh self.cursor_rect.set(0, @index * 90, self.width - 32, 96) #self.cursor_rect.set(0, @index * 116, self.width - 32, 96) end end end #============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # This window displays the status of all party members on the battle screen. #============================================================================== class Window_BattleStatus < Window_Base def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] #this i*120 adjusts the hero info spacing in battle actor_x = i * 120 + 4 draw_actor_name(actor, actor_x, 0) draw_actor_hp(actor, actor_x, 32, 120) draw_actor_sp(actor, actor_x, 64, 120) if @level_up_flags[i] self.contents.font.color = normal_color self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!") else draw_actor_state(actor, actor_x, 96) end end end end #============================================================================== # ** Scene_Battle (part 3) #------------------------------------------------------------------------------ # This class performs battle screen processing. #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # * Actor Command Window Setup #-------------------------------------------------------------------------- def phase3_setup_command_window # Disable party command window @party_command_window.active = false @party_command_window.visible = false # Enable actor command window @actor_command_window.active = true @actor_command_window.visible = true # Set actor command window position @actor_command_window.x = @actor_index * 120 #command window spacing in battle # Set index to 0 @actor_command_window.index = 0 end end #============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # This class handles the actor. It's used within the Game_Actors class # ($game_actors) and refers to the Game_Party class ($game_party). #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Get Battle Screen X-Coordinate #-------------------------------------------------------------------------- def screen_x # Return after calculating x-coordinate by order of members in party if self.index != nil return self.index * 120 + 80 #spacing of battlers else return 0 end end end
Creditos a Raice |
|