Aventurier Lv.16
Age : 40 Inscrit le : 03/09/2009 Messages : 1503
| Sujet: [Résolu] Je n'ai pas compris comment marche ce script. ^^ Ven 18 Juin 2010 - 15:37 | |
| Le voici - Spoiler:
- Code:
-
#/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\|/ #~ Battler SE (Sideview Battle System Version) #~ By: Rockleedude #~ Version: 3.0 #~ Latest Update: 10/26/2009 #~ #~ This script allows you to add 13 different sound effects to play for #~ actors and enemies in battle. #~ #=============================================================================== #~ Instructions #=============================================================================== #~ To setup the sound effects played for a battler, use the following tag: #~ <battler se (type) (name) v(volume) p(pitch)> #~ (type): One of the 13 types. They are specified in the "For type" section. #~ (name): The name of the song file for the sound effect. Put playnothing to #~ mute the sound effects for that type. #~ (volume): The sound effect's volume. #~ (pitch): The sound effect's pitch. #~ #~ The tags for enemies go into the notes box in the database. #~ The tags for actors go in the customization section below in this script. #~ #~ For type: #~ Put the type corresponding to whichever type of sound effect this sound is. #~ i.e. If this is the sound effect for when the battler takes damage, put take. #~ The 13 types are the following: #~ 1. Take - Played when the battler loses hp or mp as a result of the #~ action of another battler. #~ 2. Recover - Played when the battler regains hp or mp, loses a negative #~ state, or is revived from death. #~ 3. Evade - Played when the battler dodges an attack. #~ 4. Plus State - Played when the battler receives a positive, good state. #~ Does not play if both a plus and minus state are received. #~ 5. Minus State - Played when the battler receives a negative, bad state. #~ Does not play if both a plus and minus state are received. #~ 6. Attack - Played when the battler does a regular attack or uses a #~ skill or item that has physical attack checked. #~ 7. Target Foe - Played when the battler uses a skill or item that #~ targets one or more foes. #~ 8. Target Ally - Played when the battler uses a skill or item that #~ targets one or more allies. Does not play if the only #~ target is the battler itself. #~ 9. Self - Played when the battler uses a skill or item that targets #~ iteself. #~ 10. Critical Hit - Played when the battler delivers a critical hit. #~ 11. Miss - Played when the battler misses with an attack. #~ 12. Death - Played when the battler dies. #~ 13. Low Health - Played when the battler's hp falls below a specified #~ amount. #~ For name: #~ This should be the exact name of the file. So if the file name is "Scream" #~ you should put "Scream" and not "scream" (Notice the difference in first #~ letters). You can have quotation marks around the name of file if you #~ choose to. The file type of the sound effect is also optional. #~ Files for the sound effects should be located in the SE folder that #~ is inside the Audio folder of your project. You also have the choice of #~ creating a folder inside the SE folder to store the battler sound effects in. #~ The purpose of this is to avoid having a name conflict between a regular #~ sound effect and a sound effect for an battler. This could also help with #~ organization. This is all up to you. In the customization section below, #~ type in the exact name of the folder. If you are not using the custom #~ folder, then put nil instead. Note, if the custom folder exists, it #~ will be searched first before looking in the SE folder. #~ To completely mute the sound effects (even the default sound effects) for #~ particularly type for a battler, put playnothing into the name spot. This #~ will make it so no sound effect will play for that type for that battler. #~ Note that playnothing with quotation marks ("playnothing") will not mute #~ the se. Instead it would search for the sound effect named "playnothing". #~ For volume: #~ This is the volume for the sound effect. Be sure to include the "v" before #~ the volume. Use the sound test to help decide what you want this value to #~ be. The volume can be left out. If it is left out, then the default #~ volume will be used instead. You can set the default volume in the #~ customization section. Must be between 0 and 100. #~ For pitch: #~ This is the pitch for the sound effect. Be sure to include the "p" before #~ the pitch. Use the sound test to help decide what you want this value to #~ be. The pitch can also be left out. If it is left out, then the default #~ pitch will be used instead. You can set the default pitch in the #~ customization section. Must be between 50 and 150. #~ You can insert more than one sound effect for each type for a battler. Each #~ sound effect for each type must be in a separate tag. When there is more than #~ one sound effect for a particular type of a battler, a sound effect will #~ randomly be chosen to be played. Note, if playnothing is one of the choices, #~ it can be randomly chosen. Just because playnothing is one of the choices #~ does not mean it will automatically play nothing for that type. It has to be #~ chosen randomly. #~ #~ #~ #~ Examples: #~ #~ <battler se death Scream v85 p100> #~ - Will play the sound file "Scream" with the volume as 85 and pitch as 100 #~ for the death sound effect. #~ #~ <battler se target foe "Roar" p90> #~ - Will play the sound file "Roar" with the volume as the default and pitch as #~ 90 for the target foe sound effect. Remember, the quotation marks are not #~ required. #~ #~ <battler se minus state Groan> #~ - Will play the sound file "Groan" with the volume and pitch as the defaults #~ for the minus state damage sound effect. #~ #~ <battler se evade playnothing> #~ - Will play no sound effect, not even the default sound effect chosen in the #~ database, when the battler evades. #~ #~ #/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\|/
$imported = {} if $imported == nil $imported["Battler_SE"] = true
module Rockleedude module Battler_SE #=============================================================================== # CUSTOMIZATION #=============================================================================== # Setup for Actors # # With the addition of the actor part of the script, comes an addition to # the customization section. Since actors have no notes box like enemies # do, another method had to be used for setup for actors. Basically, I # created a notes box for actors in this script (note this "notes box" will # only work for this script). The syntax for the tag is exactly the same # as the syntax for enemies. Put ACTOR_SE_SETUP[x] = " y " where x is the # id of the actor and y is the tags. You can have any number of lines of # tag between the quotation marks. See the example below if confused. # # The following is an example: # ACTOR_SE_SETUP[1] = # "<battler se take Ouch> # <battler se take playnothing> # <battler se attack Yell> # <battler se death Scream p125>" # ACTOR_SE_SETUP = [] # Do not alter or remove! # # # --> Insert Tags for Actors Below Here <--
# --> Insert Tags for Actors Above Here <-- BATTLER_SE_FOLDER_NAME = nil # The name of the folder inside of the SE folder where the battler sound # effects are stored. Include quotation marks around the name. # For example: "Battler_SE" # If the custom folder is not being used, put nil with no quotations. DEFAULT_VOLUME = 100 # The volume used whenever the volume is left out of the tag. # Can be 0-100 DEFAULT_PITCH = 100 # The pitch used whenever the pitch is left out of the tag. # Can be 50-150 PLUS_STATES = [9, 10, 11, 12] # The states that are considered positive, good states. When a battler # receives one of these states, the specified plus state sound effect will # play. Insert the id of the state in the above array. MINUS_STATES = [1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 15, 16] # The states that are considered negative, bad states. When a battler # receives one of these states, the specified minus state sound effect will # play. Insert the id of the state in the above array. # # States can be left out if they don't fall into either category of plus # or negative. DEATH_STATE_ID = 1 # The id of the state that represents death, knock-out, incapacitated, etc. # The default is id 1. There is really no reason to change the id of the # death state but I had to include this just incase. LOW_HEALTH_PERCENTAGE = 25 # The percentage that determines when the low health sound effect is played. # This number should be between 0 and 100 since it's a percentage. The color # of the hp shown in the status changes to yellow when the hp is below 25% # incase you want to make it as much as the game considers low health. #=============================================================================== # END CUSTOMIZATION #===============================================================================
BATTLER_SE = /<BATTLER[\s_]?SE[\s_]?(TAKE|RECOVER|EVADE|PLUSSTATE|PLUS[\s]STATE|PLUS_STATE|MINUSSTATE|MINUS[\s]STATE|MINUS_STATE|ATTACK|TARGETFOE|TARGET[\s]FOE|TARGET_FOE|TARGETALLY|TARGET[\s]ALLY|TARGET_ALLY|CRITICALHIT|CRITICAL[\s]HIT|CRITICAL_HIT|MISS|DEATH|LOWHEALTH|LOW[\s]HEALTH|LOW_HEALTH|SELF)[\s_]?(.*?)[\s_]?(v\d*?)?[\s_]?(p\d*?)?>/i BATTLER_SE_PLAYNOTHING = /<BATTLER[\s_]?SE[\s_]?(TAKE|RECOVER|EVADE|PLUSSTATE|PLUS[\s]STATE|PLUS_STATE|MINUSSTATE|MINUS[\s]STATE|MINUS_STATE|ATTACK|TARGETFOE|TARGET[\s]FOE|TARGET_FOE|TARGETALLY|TARGET[\s]ALLY|TARGET_ALLY|CRITICALHIT|CRITICAL[\s]HIT|CRITICAL_HIT|MISS|DEATH|LOWHEALTH|LOW[\s]HEALTH|LOW_HEALTH|SELF)[\s_]?PLAYNOTHING>/i end end
# # SE CLASS # class RPG::SE def battler_se_play folder = Rockleedude::Battler_SE::BATTLER_SE_FOLDER_NAME unless @name.empty? unless folder == nil begin Audio.se_play("Audio/SE/" + folder + "/" + @name, @volume, @pitch) # print @name + ": name" if $TEST rescue begin play rescue print "The sound effect, " + @name + ", is not found in either folder." if $TEST return false end end else begin play rescue print "The sound effect, " + name + ", is not found in the SE folder. If you created a Battler_SE folder be sure you put the name correctly in the module as BATTLER_SE_FOLDER_NAME" if $TEST return false end end else return false end end
def play unless @name.empty? Audio.se_play("Audio/SE/" + @name, @volume, @pitch) end end end # class end
# # SOUND MODULE # module Sound
def self.play_enemy_attack end
def self.play_enemy_damage end
def self.play_enemy_collapse end
def self.play_actor_damage end
def self.play_actor_collapse end
def self.play_recovery end
def self.play_miss end
def self.play_evasion end
def self.play_battler_se(battler_id, type, a_or_e, default) # Type: 0: Take, 1: Recover, 2: Evade, 3: Plus State, 4: Minus State, # Type: 5: Attack, 6: Target Foe, 7: Target Ally, 8: Critical Hit, 9: Miss, # Type: 10: Death, 11: Low Health, 12: Self # a_or_e: 1: Actor 2: Enemy se = $data_actor_se[battler_id] if a_or_e == 1 se = $data_enemy_se[battler_id] if a_or_e == 2 unless se[type].empty? chosen_se = se[type][rand(se[type].size)] else Sound.play_default_se(type, a_or_e) return end #print chosen_se.inspect + ":chosen_se" if $TEST return if chosen_se == "PLAYNOTHING" t_or_f = chosen_se.battler_se_play return if default == false Sound.play_default_se(type, a_or_e) if t_or_f == false end def self.play_default_se(type, a_or_e) if a_or_e == 1 $data_system.sounds[13].play if type == 10 else $data_system.sounds[11].play if type == 10 end $data_system.sounds[16].play if type == 9 $data_system.sounds[16].play if type == 2 end end
# # SPRITE_DAMAGE CLASS # class Sprite_Damage < Sprite_Base # Take(0) and Recover(1) alias damage_pop_orig_rld_battler_se damage_pop def damage_pop(num = nil) damage_pop_orig_rld_battler_se(num = nil) if battler.hp_damage != nil if (battler.hp_damage > 0) if @battler.actor? Sound.play_battler_se(@battler.actor_id, 0, 1, false) else Sound.play_battler_se(@battler.enemy_id, 0, 2, false) end elsif (battler.hp_damage < 0) if @battler.actor? Sound.play_battler_se(@battler.actor_id, 1, 1, false) else Sound.play_battler_se(@battler.enemy_id, 1, 2, false) end end if battler.hp_damage == 0 if battler.mp_damage != nil if (battler.mp_damage > 0) if @battler.actor? Sound.play_battler_se(@battler.actor_id, 0, 1, false) else Sound.play_battler_se(@battler.enemy_id, 0, 2, false) end elsif (battler.mp_damage < 0) if @battler.actor? Sound.play_battler_se(@battler.actor_id, 1, 1, false) else Sound.play_battler_se(@battler.enemy_id, 1, 2, false) end end end end end end
end # class end
# # SPRITE_BATTLER CLASS # class Sprite_Battler < Sprite_Base # Evade(2) alias damage_action_orig_rld_battler_se damage_action def damage_action(action) damage_action_orig_rld_battler_se(action) if @battler.evaded if @battler.actor? Sound.play_battler_se(@battler.actor_id, 2, 1, true) else Sound.play_battler_se(@battler.enemy_id, 2, 2, true) end end end end # class end
# # SCENE_BATTLE CLASS # class Scene_Battle < Scene_Base # (3-9 and 12) alias damage_action_sb_orig_rld_battler_se damage_action def damage_action(action) damage_action_sb_orig_rld_battler_se(action) for target in @targets play_if_minus_state_removed(target, action) # Recover(1) play_if_plus_or_minus(target, action) # Plus State(3) and Minus State(4) if target.critical # Critical Hit(8) if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 8, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 8, 2, false) end end if target.missed # Miss(9) if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 9, 1, true) else Sound.play_battler_se(@active_battler.enemy_id, 9, 2, true) end end end play_for_action_scopes # Attack(5), Target Foe(6), Target Ally(7), Self(12) end # Recover(1) for Removed Minus States def play_if_minus_state_removed(target, action) return unless (target.hp_damage == 0) and (target.mp_damage == 0) plus_a = [] minus_a = [] plus_list = Rockleedude::Battler_SE::PLUS_STATES minus_list = Rockleedude::Battler_SE::MINUS_STATES for state in target.removed_states plus_a.insert(0, state) if plus_list.include?(state.id) minus_a.insert(0, state) if minus_list.include?(state.id) if state.id == Rockleedude::Battler_SE::DEATH_STATE_ID if target.actor? Sound.play_battler_se(target.actor_id, 1, 1, false) else Sound.play_battler_se(target.enemy_id, 1, 2, false) end return end end return if (plus_a.size != 0) and (minus_a.size != 0) return if plus_a.empty? and minus_a.empty? if plus_a.empty? if target.actor? Sound.play_battler_se(target.actor_id, 1, 1, false) else Sound.play_battler_se(target.enemy_id, 1, 2, false) end end end # Plus State(3) and Minus State(4) def play_if_plus_or_minus(target, action) if @active_battler.action.skill? obj = @active_battler.action.skill elsif @active_battler.action.item? obj = @active_battler.action.item else obj = nil end plus_a = [] minus_a = [] plus_list = Rockleedude::Battler_SE::PLUS_STATES minus_list = Rockleedude::Battler_SE::MINUS_STATES for state in target.added_states plus_a.insert(0, state) if plus_list.include?(state.id) minus_a.insert(0, state) if minus_list.include?(state.id) return if state.id == Rockleedude::Battler_SE::DEATH_STATE_ID end return if (plus_a.size != 0) and (minus_a.size != 0) return if plus_a.empty? and minus_a.empty? if obj == nil return unless (target.hp_damage == 0) and (target.mp_damage == 0) else return unless obj.base_damage == 0 end if minus_a.empty? if target.actor? Sound.play_battler_se(target.actor_id, 3, 1, false) else Sound.play_battler_se(target.enemy_id, 3, 2, false) end elsif plus_a.empty? if target.actor? Sound.play_battler_se(target.actor_id, 4, 1, false) else Sound.play_battler_se(target.enemy_id, 4, 2, false) end end end # Attack(5), Target Foe(6), Target Ally(7), Self(12) def play_for_action_scopes if @active_battler.action.attack? if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 5, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 5, 2, false) end return end if @active_battler.action.skill? if @active_battler.action.skill.physical_attack if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 5, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 5, 2, false) end return end end if @active_battler.action.item? if @active_battler.action.item.physical_attack if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 5, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 5, 2, false) end return end end if @targets.compact.size == 1 if @targets.compact[0] == @active_battler if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 12, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 12, 2, false) end return end end return if @targets.nitems == 0 unless @targets.compact[0].actor? if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 6, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 7, 2, false) end else if @active_battler.actor? Sound.play_battler_se(@active_battler.actor_id, 7, 1, false) else Sound.play_battler_se(@active_battler.enemy_id, 6, 2, false) end end end
end # class end
# # SPRITE_BATTLER CLASS # class Sprite_Battler < Sprite_Base # Enemy: Death(10)
alias collapse_action_orig_rld_battler_se collapse_action def collapse_action collapse_action_orig_rld_battler_se if @collapse_type == 1 unless @battler.actor? Sound.play_battler_se(@battler.enemy_id, 2, 2, true) else Sound.play_battler_se(@battler.actor_id, 2, 1, true) end end end def normal_collapse if @effect_duration == 47 self.blend_type = 1 self.color.set(255, 128, 128, 128) end if @effect_duration == 32 unless @battler.actor? Sound.play_battler_se(@battler.enemy_id, 2, 2, true) else Sound.play_battler_se(@battler.actor_id, 2, 1, true) end end self.opacity = 256 - (48 - @effect_duration) * 6 if @effect_duration <= 47 end alias boss_collapse1_orig_rld_battler_se boss_collapse1 def boss_collapse1 if @effect_duration == 380 unless @battler.actor? Sound.play_battler_se(@battler.enemy_id, 2, 2, true) else Sound.play_battler_se(@battler.actor_id, 2, 1, true) end end if @effect_duration == 255 unless @battler.actor? Sound.play_battler_se(@battler.enemy_id, 2, 2, true) else Sound.play_battler_se(@battler.actor_id, 2, 1, true) end end boss_collapse1_orig_rld_battler_se end end
# # GAME_BATTLER CLASS # class Game_Battler # Low Health(11) alias execute_damage_orig_rld_battler_se execute_damage def execute_damage(user) max_hp_b = maxhp hp_b = self.hp execute_damage_orig_rld_battler_se(user) max_hp_a = maxhp hp_a = self.hp ratio_b = hp_b.to_f / max_hp_b.to_f ratio_a = hp_a.to_f / max_hp_a.to_f #print ratio_b.inspect + ":ratio_b " + ratio_a.inspect + ":ratio_a" lowh_percent = Rockleedude::Battler_SE::LOW_HEALTH_PERCENTAGE unless hp_a <= 0 if lowh_percent.between?(0.0, 100.0) lowh_percent = lowh_percent.to_f / 100.0 if ratio_b > lowh_percent if ratio_a < lowh_percent if self.actor? Sound.play_battler_se(self.actor_id, 11, 1, false) else Sound.play_battler_se(self.enemy_id, 11, 2, false) end end end end end end end # class end
# # GAME_ACTOR CLASS #
class Game_Actor < Game_Battler attr_accessor :battler_se_note
alias perform_collapse_orig_rld_battler_se perform_collapse def perform_collapse Sound.play_battler_se(@actor_id, 10, 1, true) if $game_temp.in_battle and dead? perform_collapse_orig_rld_battler_se end
def actor_id return @actor_id end alias setup_orig_battler_se setup def setup(actor_id) setup_orig_battler_se(actor_id) @battler_se_note = Rockleedude::Battler_SE::ACTOR_SE_SETUP end end # class end
# # GAME_ENEMY CLASS # class Game_Enemy < Game_Battler alias perform_collapse_orig_rld_battler_se perform_collapse def perform_collapse Sound.play_battler_se(@enemy_id, 10, 2, true) if $game_temp.in_battle and dead? perform_collapse_orig_rld_battler_se end end # class end
# # ACTOR CLASS # class RPG::Actor attr_accessor :battler_se_note # Battler Receiving attr_accessor :take_damage_se attr_accessor :recover_damage_se attr_accessor :evade_se attr_accessor :plus_state_se attr_accessor :minus_state_se # Battler Delivering attr_accessor :attack_se attr_accessor :target_foe_se attr_accessor :target_ally_se attr_accessor :critical_hit_se attr_accessor :miss_se # Random Conditions attr_accessor :death_se attr_accessor :low_health_se attr_accessor :self_se def gsub_without_md(string) string.gsub!(/ /i, "") string.gsub!(/_/i, "") return string end def prepare_se_cache # Battler Receiving @take_damage_se = [] @recover_damage_se = [] @evade_se = [] @plus_state_se = [] @minus_state_se = [] # Battler Delivering @attack_se = [] @target_foe_se = [] @target_ally_se = [] @critical_hit_se = [] @miss_se = [] # Random Conditions @death_se = [] @low_health_se = [] @self_se = []
a = Rockleedude::Battler_SE::ACTOR_SE_SETUP[@id] @battler_se_note = "" @battler_se_note = a if a != nil end def create_se_cache prepare_se_cache dv = Rockleedude::Battler_SE::DEFAULT_VOLUME dp = Rockleedude::Battler_SE::DEFAULT_PITCH self.battler_se_note.split(/[\r\n]+/).each { |line| case line when Rockleedude::Battler_SE::BATTLER_SE type = $1 type.upcase! unless $1 == nil type = gsub_without_md(type) unless $1 == nil case type when "TAKE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @take_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "RECOVER" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @recover_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "EVADE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @evade_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "PLUSSTATE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @plus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "MINUSSTATE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @minus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "ATTACK" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @attack_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "TARGETFOE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @target_foe_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "TARGETALLY" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @target_ally_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "CRITICALHIT" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @critical_hit_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "MISS" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @miss_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "DEATH" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @death_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "LOWHEALTH" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @low_health_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "SELF" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @self_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" end end case line when Rockleedude::Battler_SE::BATTLER_SE_PLAYNOTHING type = $1 type.upcase! unless $1 == nil type.gsub!(/ /i, "") unless $1 == nil case type when "TAKE" @take_damage_se.insert(0, "PLAYNOTHING") when "RECOVER" @recover_damage_se.insert(0, "PLAYNOTHING") when "EVADE" @evade_se.insert(0, "PLAYNOTHING") when "PLUSSTATE" @plus_state_se.insert(0, "PLAYNOTHING") when "MINUSSTATE" @minus_state_se.insert(0, "PLAYNOTHING") when "ATTACK" @attack_se.insert(0, "PLAYNOTHING") when "TARGETFOE" @target_foe_se.insert(0, "PLAYNOTHING") when "TARGETALLY" @target_ally_se.insert(0, "PLAYNOTHING") when "CRITICALHIT" @critical_hit_se.insert(0, "PLAYNOTHING") when "MISS" @miss_se.insert(0, "PLAYNOTHING") when "DEATH" @death_se.insert(0, "PLAYNOTHING") when "LOWHEALTH" @low_health_se.insert(0, "PLAYNOTHING") when "SELF" @self_se.insert(0, "PLAYNOTHING")
end end } end end # class end
# # ENEMY CLASS # class RPG::Enemy # Battler Receiving attr_accessor :take_damage_se attr_accessor :recover_damage_se attr_accessor :evade_se attr_accessor :plus_state_se attr_accessor :minus_state_se # Battler Delivering attr_accessor :attack_se attr_accessor :target_foe_se attr_accessor :target_ally_se attr_accessor :critical_hit_se attr_accessor :miss_se # Random Conditions attr_accessor :death_se attr_accessor :low_health_se attr_accessor :self_se def gsub_without_md(string) string.gsub!(/ /i, "") string.gsub!(/_/i, "") return string end def prepare_se_cache # Battler Receiving @take_damage_se = [] @recover_damage_se = [] @evade_se = [] @plus_state_se = [] @minus_state_se = [] # Battler Delivering @attack_se = [] @target_foe_se = [] @target_ally_se = [] @critical_hit_se = [] @miss_se = [] # Random Conditions @death_se = [] @low_health_se = [] @self_se = [] end def create_se_cache prepare_se_cache dv = Rockleedude::Battler_SE::DEFAULT_VOLUME dp = Rockleedude::Battler_SE::DEFAULT_PITCH self.note.split(/[\r\n]+/).each { |line| case line when Rockleedude::Battler_SE::BATTLER_SE type = $1 type.upcase! unless $1 == nil type = gsub_without_md(type) unless $1 == nil case type when "TAKE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @take_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "RECOVER" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @recover_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "EVADE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @evade_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "PLUSSTATE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @plus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "MINUSSTATE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @minus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "ATTACK" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @attack_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "TARGETFOE" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @target_foe_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "TARGETALLY" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @target_ally_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "CRITICALHIT" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @critical_hit_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "MISS" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @miss_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "DEATH" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @death_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "LOWHEALTH" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @low_health_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" when "SELF" se = RPG::SE.new($2, dv, dp) se.volume = $3 if $3 != nil se.volume = se.volume[1,3].to_i if $3.class == String se.pitch = $4 if $4 != nil se.pitch = se.pitch[1,3].to_i if $4.class == String @self_se.insert(0, se) if se.name.upcase != "PLAYNOTHING" end end case line when Rockleedude::Battler_SE::BATTLER_SE_PLAYNOTHING type = $1 type.upcase! unless $1 == nil type.gsub!(/ /i, "") unless $1 == nil case type when "TAKE" @take_damage_se.insert(0, "PLAYNOTHING") when "RECOVER" @recover_damage_se.insert(0, "PLAYNOTHING") when "EVADE" @evade_se.insert(0, "PLAYNOTHING") when "PLUSSTATE" @plus_state_se.insert(0, "PLAYNOTHING") when "MINUSSTATE" @minus_state_se.insert(0, "PLAYNOTHING") when "ATTACK" @attack_se.insert(0, "PLAYNOTHING") when "TARGETFOE" @target_foe_se.insert(0, "PLAYNOTHING") when "TARGETALLY" @target_ally_se.insert(0, "PLAYNOTHING") when "CRITICALHIT" @critical_hit_se.insert(0, "PLAYNOTHING") when "MISS" @miss_se.insert(0, "PLAYNOTHING") when "DEATH" @death_se.insert(0, "PLAYNOTHING") when "LOWHEALTH" @low_health_se.insert(0, "PLAYNOTHING") when "SELF" @self_se.insert(0, "PLAYNOTHING")
end end } end end # class end
# # SCENE_TITLE CLASS # class Scene_Title < Scene_Base
alias load_database_orig_rld_battler_se load_database def load_database load_database_orig_rld_battler_se load_battler_se end alias load_bt_database_orig_rld_battler_se load_bt_database def load_bt_database load_bt_database_orig_rld_battler_se load_battler_se end def load_battler_se n = 0 $data_actor_se = [] $data_enemy_se = [] # Actor SE's for actor in $data_actors next if actor == nil actor.create_se_cache take = actor.take_damage_se recover = actor.recover_damage_se evade = actor.evade_se plusstate = actor.plus_state_se minusstate = actor.minus_state_se attack = actor.attack_se targetfoe = actor.target_foe_se targetally = actor.target_ally_se criticalhit = actor.critical_hit_se miss = actor.miss_se death = actor.death_se lowhealth = actor.low_health_se selfse = actor.self_se $data_actor_se[actor.id] = [take, recover, evade, plusstate, minusstate, attack, targetfoe, targetally, criticalhit, miss, death, lowhealth, selfse] #deal, end # Enemy SE's for enemy in $data_enemies next if enemy == nil enemy.create_se_cache take = enemy.take_damage_se recover = enemy.recover_damage_se evade = enemy.evade_se plusstate = enemy.plus_state_se minusstate = enemy.minus_state_se attack = enemy.attack_se targetfoe = enemy.target_foe_se targetally = enemy.target_ally_se criticalhit = enemy.critical_hit_se miss = enemy.miss_se death = enemy.death_se lowhealth = enemy.low_health_se selfse = enemy.self_se $data_enemy_se[enemy.id] = [take, recover, evade, plusstate, minusstate, attack, targetfoe, targetally, criticalhit, miss, death, lowhealth, selfse] #deal, end end end # class end
Je but est d'utiliser des musiques pendant le combat, mais je ne comprends vraiment pas les explications en english. J'utilise le SBS + ATB, mais je ne pense pas qu'il ne soit pas incompatible. Voilà.
Dernière édition par CloudStrife le Ven 18 Juin 2010 - 16:04, édité 1 fois |
|