Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: [VX] Combat avec Battlers Mar 21 Avr 2009 - 10:10 | |
| Auteur : DerVVulfman Source: RPG Creative. Ce script permet d'ajouter des "Battlers" pour les héros dans RMVX. Marche. script à mettre au dessus de Main: - Code:
-
#============================================================================== # ** Actor_Battler Module #------------------------------------------------------------------------------ # A module containing configurable data for the Actor Battler Graphic system. #==============================================================================
module Actor_Battler # Actor battler array ACTOR = Array.new # Do not touch -_^
#======================================================================== # ** C O N F I G U R A T I O N S Y S T E M ** # #======================================================================== # --Positioning-- # Actor Battler positioning system # CENTER_X = true # If true, centers actors rather than default lineup. DEFAULT_X = 5 # Default party Max SCREEN_Y = 400 # Vertical height of battlers TRANSPARENT = true # If true, makes lightly transparent until attacking. # --Actor List-- # Add your actor battlers here # # Actor# Filename, Hue (optional) ACTOR[1] = ["Kurea"] ACTOR[2] = ["Safi"] ACTOR[3] = ["Rain", 0] ACTOR[4] = ["Ylva", 0] ACTOR[5] = ["Lawrence", 0] ACTOR[6] = ["Oscar", 0] ACTOR[7] = ["Vera", 0] ACTOR[8] = ["Elmer", 0]
#======================================================================== # ** E N D O F C O N F I G U R A T I O N ** # #======================================================================== end
#============================================================================== # ** RPG Module #------------------------------------------------------------------------------ # A module containing RPGVX Data Structures. #============================================================================== module RPG #============================================================================ # ** Actor #---------------------------------------------------------------------------- # Data class for actors #============================================================================ class Actor #------------------------------------------------------------------------ # * Alias Listings #------------------------------------------------------------------------ alias actorbattler_init initialize #------------------------------------------------------------------------ # * Object Initialization #------------------------------------------------------------------------ def initialize # Perform the original call actorbattler_init @battler_name = "" @battler_hue = 0 end end end
#============================================================================== # ** Game_Temp #------------------------------------------------------------------------------ # This class handles temporary data that is not included with save data. # The instance of this class is referenced by $game_temp. #==============================================================================
class Game_Temp #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :battle_main_phase # battle flag: main phase #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias actorbattler_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Perform the original call actorbattler_initialize # Set the main phase flag to false @battle_main_phase = false end end
#============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles system-related data. Also manages vehicles and BGM, etc. # The instance of this class is referenced by $game_system. #==============================================================================
class Game_System #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :actorbattler_max # Max. size for centered battlers #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias actorbattler_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Perform the original call actorbattler_initialize # Set 'Centered' battler max to 4 (default) @actorbattler_max = Actor_Battler::DEFAULT_X end end
#============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # This class handles actors. It's used within the Game_Actors class # ($game_actors) and referenced by the Game_Party class ($game_party). #==============================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :screen_x # battle screen X coordinate attr_accessor :screen_y # battle screen Y coordinate #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias actorbattler_init initialize #-------------------------------------------------------------------------- # * Object Initialization # actor_id : actor ID #-------------------------------------------------------------------------- def initialize(actor_id) # Perform the original call actorbattler_init(actor_id) # Apply battler graphic @battler_name = Actor_Battler::ACTOR[actor_id][0] # Apply battler hue if exists, else default of '0' if Actor_Battler::ACTOR[actor_id][1] != nil @battler_hue = Actor_Battler::ACTOR[actor_id][1] else @battler_hue = 0 end end #-------------------------------------------------------------------------- # * Change Battler # battler_name : new battler graphic filename # battler_hue : new battler hue setting (default = 0) #-------------------------------------------------------------------------- def set_battler(battler_name = "", battler_hue = 0) @battler_name = battler_name @battler_hue = battler_hue end #-------------------------------------------------------------------------- # * Use Sprites? #-------------------------------------------------------------------------- def use_sprite? return true end #-------------------------------------------------------------------------- # * Get Battle Screen X-Coordinate #-------------------------------------------------------------------------- def screen_x if self.index != nil if Actor_Battler::CENTER_X # Return after calculating x-coords of centered party members return self.index * (544 / $game_system.actorbattler_max) + ($game_system.actorbattler_max - $game_party.members.size) * (272 / $game_system.actorbattler_max) + (272 / $game_system.actorbattler_max) else # Return after calculating x-coords of default-aligned party members return self.index * 136 + 68 end else return 0 end end #-------------------------------------------------------------------------- # * Get Battle Screen Y-Coordinate #-------------------------------------------------------------------------- def screen_y return Actor_Battler::SCREEN_Y end #-------------------------------------------------------------------------- # * Get Battle Screen Z-Coordinate #-------------------------------------------------------------------------- def screen_z # Return after calculating z-coordinate by order of members in party if self.index != nil return $game_party.members.size - self.index else return 0 end end end
#============================================================================== # ** Sprite_Battler #------------------------------------------------------------------------------ # This sprite is used to display battlers. It observes a instance of the # Game_Battler class and automatically changes sprite conditions. #==============================================================================
class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias actorbattler_update update #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Perform the original call actorbattler_update # If the actor battlers are lightly transparent until they act if Actor_Battler::TRANSPARENT == true # If the battler is a visible actor battler if @battler.is_a?(Game_Actor) and @battler_visible # Bring opacity level down a bit when not in main phase if $game_temp.battle_main_phase self.opacity += 3 if self.opacity < 255 else self.opacity -= 3 if self.opacity > 207 end end end end end
#============================================================================== # ** Spriteset_Battle #------------------------------------------------------------------------------ # This class brings together battle screen sprites. It's used within the # Scene_Battle class. #==============================================================================
class Spriteset_Battle #-------------------------------------------------------------------------- # * Create Actor Sprite # Removes the 'empty' battler image used by the default system and # replaces it. It also observes the actual size of the party and # not a predetermined 4-party limit. #-------------------------------------------------------------------------- def create_actors @actor_sprites = [] for actor in $game_party.members.reverse @actor_sprites.push(Sprite_Battler.new(@viewport2, actor)) end end #-------------------------------------------------------------------------- # * Update Actor Sprite #-------------------------------------------------------------------------- def update_actors # Reset actor battler sprites if party size increases if $game_party.members.size > @actor_sprites.size dispose_actors create_actors end for sprite in @actor_sprites sprite.update end end end
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # This class performs battle screen processing. #==============================================================================
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias actorbattler_s start alias actorbattler_spcs start_party_command_selection alias actorbattler_pv process_victory alias actorbattler_ea execute_action #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start actorbattler_s $game_temp.battle_main_phase = false end #-------------------------------------------------------------------------- # * Start party command selection #-------------------------------------------------------------------------- def start_party_command_selection actorbattler_spcs if $game_temp.in_battle $game_temp.battle_main_phase = false end end #-------------------------------------------------------------------------- # * Victory Processing #-------------------------------------------------------------------------- def process_victory $game_temp.battle_main_phase = false actorbattler_pv end #-------------------------------------------------------------------------- # * Start Execution of Battle Processing #-------------------------------------------------------------------------- def execute_action actorbattler_ea $game_temp.battle_main_phase = true end end Démo: |
|
Elekami Fondateur
Messages postés : 19071 Date d'inscription : 19/07/2008 Jauge LPC :
| Sujet: Re: [VX] Combat avec Battlers Mar 21 Avr 2009 - 10:11 | |
| Explication en Anglais: - Code:
-
#============================================================================== # ** Actor Battler Graphics #------------------------------------------------------------------------------ # by DerVVulfman # version 1.0 # 03-01-2008 # RGSS2 #------------------------------------------------------------------------------ # # INTRODUCTION: # # This system permits you to include 'Actor Battler' graphics that were not # included in the RPGMaker VX system. This script mimics many of the lost # features, and includes a new one: Actor Battler Centering. # #------------------------------------------------------------------------------ # # USAGE: # # --Positioning-- # A nice feature to this system is the ability to adjust the left/right & # up/down position of your battlers. # # Actually, the vertical up/down position can be adjusted by changing the # value of the SCREEN_Y variable. The left/right positioning is a little # different. # # The CENTER_X value is a true/false value that sets whether the battlers # line up from the left and space themselves out in the manner of the de- # fault RPGMaker XP or whether the system calculates and centers them ac- # ross the screen. # # The DEFAULT_X value establishes how many actors are typically shown in # the battlefield. While this is the default value, the maximum value used # can be changed with a script call. # # Finally, the TRANSPARENT value is another true/false value that you can # use to make the battlers lightly transparent until they're about to per- # form an attack. Another feature from RPGMaker XP. # # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # # --The Actor List-- # This system DOES require you to edit the configuration system to list all # of the 'actor' battlers that you are using. It is assumed that these # battlers will be in the 'Graphics\Battlers' folder with the rest of the # enemy battlers. # # Each value in the ACTOR array holds two values: filename and hue. This # not only allows you to add battle graphics for your heroes, but adjusts # the character's hue as well. If you do not include the hue setting, it # goes to the default setting of '0'. # #------------------------------------------------------------------------------ # # SCRIPT CALLS: # # There's only two script calls that you need to know. # # --Changing Battlers-- # Given that this system allows you to use 'Actor' battlers, you may find a # need to 'change' the battler in-game. Unfortunately, this cannot be done # with a pre-rendered map event, so I had to make a script call: # # $game_actors[ID].set_battler("filename", hue) # # By using this call, you can change the graphic and hue of a battler while # the game is running. # # As an example: $game_actors[1].set_battler("Ylva") # # ...would set actor #1's battler to use "Ylva.png" as the graphic desired. # You may note that the 'hue' was not included in this call. The default # value of '0' was used. # # NOTE: Just calling $game_actors[2].set_battler() would erase the battler # from actor #2, rendering it invisible on the battlefield. # # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # # --Changing Position Value-- # This script allows you to have the battlers centered in the battlefield # and spaced out evenly. Under most circumstances, you have four members # in your party. But what if you want to increase the number of members # to 5 or 6? # # Now, this system does not increase the number of members in your party, # but it is already set up to adjust the spacing of your members in the # battlefield. With a simple script call: # # $game_system.actorbattler_max = 7 # # You can make the system space the battlers on the field with the under- # standing that up to 7 members are in the party. # #------------------------------------------------------------------------------ # # EDITS AND MODIFICATIONS: # # This system Aliases the following methods: # * initialize (RPG::Actor) # * initialize (Game_Temp) # * initialize (Game_System) # * initialize (Game_Actor) # * update (Sprite_Battler) # * start (Scene_Battle) # * start_party_command_selection (Scene_Battle) # * process_victory (Scene_Battle) # * execute_action (Scene_Battle) # # This system redefines the following methods: # * use_sprite? (Game_Actor) # * create_actors (Spriteset_Battle) # * update_actors (Spriteset_Battle) # # #------------------------------------------------------------------------------ # # TERMS AND CONDITIONS: # # Free to use, even in commercial projects. Just note that I need some form # of due credit... even a mere mention in some end titles. # #============================================================================== |
|