Sujet: [Résolu] Problème avec le script Abs 6 Sam 5 Déc 2009 - 10:41
Salut à tous et toute. J'ai un problème (non c'est pas vrai ?!) : quand je fabrique un ennemi Page 1 :
Page 2 :
Plus les script qui vont avec et l'hud plus les barre d'hp ennemi (dites le si vous les voulez) Le problème : Une fois l'ennemi mort il disparait 1s et réaparait !! (script sur le post suivant à cause de la longueur du message) Merci d'avoir lu et de m'aider, bye bye Voilà le début du script :
# To create an enemy, put the following comments in a event on map:
# Enemy X - Change X for a ID of a monster in Database; # Die Erase - Erase the enemy when it dies; # Die Self Switch A - Turn On the Self Switch A when enemy dies; # Die Self Switch B - Turn On the Self Switch B when enemy dies; # Die Self Switch C - Turn On the Self Switch C when enemy dies; # Die Self Switch D - Turn On the Self Switch D when enemy dies; # Die Switch X - Turn On the Switch X when enemy dies; # Die Variable X - Increase +1 to variable X; # Follow X - Change X for range of sight of the enemy, to it follow the player automatically # Kill With Weapon X - The enemy will die only if be attacked with weapon X # Kill With Skill X - The enemy will die only if be attacked with skill X # Kill With Item X - The enemy will die only if be attacked with item X # Object - Makes the enemy be an object, and impossible to kill # Puzzle - Makes the enemy be an puzzle, it can be killed but allies don't follow it, the damage and hp bar is not showed # Respawn X - Makes the enemy respawns automatically after X frames # Boss - Shows the Boss HP Bar
#============================================================================== if Requiem_Masterpiece.enabled?("Requiem Extended Movements") #------------------------------------------------------------------------------ Requiem_Masterpiece.register("Requiem ABS", 6.0, "04/29/2009") #------------------------------------------------------------------------------ class Requiem_ABS
def animation_id self.note.each_line { |line| return line.gsub('Animation = ', '').chomp.to_i if line.include?('Animation = ') } return 0 end
def walk_slower? self.note.each_line { |line| return true if line.include?("Walk Slower") } return false end
def walk_faster? self.note.each_line { |line| return true if line.include?("Walk Faster") } return false end
def dont_walk? self.note.each_line { |line| return true if line.include?("Don't Walk") } return false end
def duration self.note.each_line { |line| return line.gsub('Duration = ', '').chomp.to_i if line.include?('Duration = ') } return 300 end
end
class BaseItem
def ranged? self.note.each_line { |line| return true if line.include?("Ranged") } return false end
def explosive? self.note.each_line { |line| return true if line.include?("Explosive") } return false end
def bomb? self.note.each_line { |line| return true if line.include?("Bomb") } return false end
def graphic self.note.each_line { |line| return line.gsub!('Graphic = ', '').chomp if line.include?('Graphic = ') } return "" end
def index self.note.each_line { |line| return line.gsub('Index = ', '').chomp.to_i if line.include?('Index = ') } return 0 end
def move_speed self.note.each_line { |line| return line.gsub('Speed = ', '').chomp.to_i if line.include?('Speed = ') } return 4 end
def range self.note.each_line { |line| return line.gsub('Range = ', '').chomp.to_i if line.include?('Range = ') } return 5 end
def delay self.note.each_line { |line| return line.gsub('Delay = ', '').chomp.to_i if line.include?('Delay = ') } return 60 end
def area self.note.each_line { |line| return line.gsub('Area = ', '').chomp.to_i if line.include?('Area = ') } return 3 end
def shot_se self.note.each_line { |line| return line.gsub('Shot SE = ', '').chomp.to_s if line.include?('Shot SE = ') } return nil end
def combo_hits self.note.each_line { |line| return line.gsub('Combo Hits = ', '').chomp.to_i if line.include?('Combo Hits = ') } return 5 end
def combo_rate self.note.each_line { |line| return line.gsub('Combo Rate = ', '').chomp.to_i if line.include?('Combo Rate = ') } return 75 end
def ammo1 self.note.each_line { |line| return $data_items[line.gsub('Ammo1 = ', '').chomp.to_i] if line.include?('Ammo1 = ') } return nil end
def ammo2 self.note.each_line { |line| return $data_items[line.gsub('Ammo2 = ', '').chomp.to_i] if line.include?('Ammo2 = ') } return nil end
def defense_rate self.note.each_line { |line| return line.gsub('Defense Rate = ', '').chomp.to_i if line.include?('Defense Rate = ') } return 50 end
def reflect_rate self.note.each_line { |line| return line.gsub('Reflect Rate = ', '').chomp.to_i if line.include?('Reflect Rate = ') } return 0 end
end
end
#------------------------------------------------------------------------------ # Game Battler #------------------------------------------------------------------------------ class Game_Battler
def calculate_combo(attacker) if attacker.is_a?(Game_Actor) and $Requiem_ABS.allow_combo_damage if $game_player.right_attack_on and attacker.weapons[0] != nil hits = attacker.weapons[0].combo_hits rate = attacker.weapons[0].combo_rate elsif $game_player.left_attack_on and attacker.weapons[1] != nil hits = attacker.weapons[1].combo_hits rate = attacker.weapons[1].combo_rate elsif $game_player.right_attack_on and attacker.weapons[0].nil? hits = 5 rate = 75 elsif $game_player.left_attack_on and attacker.weapons[1].nil? hits = 5 rate = 75 else hits = rate = 0 end @combo = ($game_player.hits >= hits and rand(100) <= rate) @combo = false if @reflect else @combo = false end end
def defending?(user) if self.is_a?(Game_Actor) and @defending and equips[1].is_a?(RPG::Armor) and rand(100) <= equips[1].defense_rate and @piece != nil and user.piece.face_to_face?(user.piece, @piece) return true elsif self.is_a?(Game_Enemy) and @defending and rand(100) <= self.defense_rate and @piece != nil and user.piece.face_to_face?(user.piece, @piece) return true end return false end
def remove_state(state_id) return unless state?(state_id) @states.delete(state_id) @state_turns.delete(state_id) end
end
#------------------------------------------------------------------------------ # Game Actor #------------------------------------------------------------------------------ class Game_Actor < Game_Battler
def initialize(actor_id) requiem_abs_gactor_initialize(actor_id) @skill_hotkeys = {} for s in $Requiem_ABS.skill_keys if s.is_a?(Numeric) @skill_hotkeys[Input::Numberkeys[s]] = 0 else @skill_hotkeys[Input::Letters[s]] = 0 end end @item_hotkeys = {} for i in $Requiem_ABS.item_keys if i.is_a?(Numeric) @item_hotkeys[Input::Numberkeys[i]] = 0 else @item_hotkeys[Input::Letters[i]] = 0 end end end
def display_level_up(new_skills) $game_system.battle_end_me.play $game_player.animation_id = $Requiem_ABS.levelup_animation @damage = $Requiem_ABS.damage_properties[19] if $Requiem_ABS.recovery_when_levelup $game_player.actor.hp = $game_player.actor.maxhp $game_player.actor.mp = $game_player.actor.maxmp end end
def atk_animation_id2 if two_swords_style return weapons[1].nil? ? 1 : weapons[1].animation_id else return 1 end end
def reflect_rate r = 0 for i in armors next if i.nil? r += i.reflect_rate end return r end
end
#------------------------------------------------------------------------------ # Game Enemy #------------------------------------------------------------------------------ class Game_Enemy < Game_Battler
def character_name enemy.note.each_line { |line| return line.gsub('Char Name = ', '').chomp if line.include?('Char Name = ') } return "" end
def character_index enemy.note.each_line { |line| return line.gsub('Char Index = ', '').chomp.to_i if line.include?('Char Index = ') } return 0 end
def atk_animation_id enemy.note.each_line { |line| return line.gsub('Attack Animation = ', '').chomp.to_i if line.include?('Attack Animation = ') } return 1 end
def die_animation_id enemy.note.each_line { |line| return line.gsub('Die Animation = ', '').chomp.to_i if line.include?('Die Animation = ') } return 0 end
def die_se enemy.note.each_line { |line| return line.gsub('Die SE = ', '').chomp.to_s if line.include?('Die SE = ') } return nil end
def weapon_icon enemy.note.each_line { |line| return line.gsub('Weapon Icon = ', '').chomp.to_i if line.include?('Weapon Icon = ') } return 0 end
def shield_icon enemy.note.each_line { |line| return line.gsub('Shield Icon = ', '').chomp.to_i if line.include?('Shield Icon = ') } return 0 end
def defense_rate enemy.note.each_line { |line| return line.gsub('Defense Rate = ', '').chomp.to_i if line.include?('Defense Rate = ') } return 50 end
def reflect_rate enemy.note.each_line { |line| return line.gsub('Reflect Rate = ', '').chomp.to_i if line.include?('Reflect Rate = ') } return 0 end
end
#------------------------------------------------------------------------------ # Game Map #------------------------------------------------------------------------------ class Game_Map
alias requiem_abs_gmap_passable passable?
def range_passable?(x, y, flag = 0x01) return true if @passages[@map.data[x, y, 0]] == 9 passable?(x, y, flag) end
def passable?(x, y, flag = 0x01) for drop in $game_drop next if drop.nil? return false if drop.x == x and drop.y == y end requiem_abs_gmap_passable(x, y, flag = 0x01) end
def update_events for event in @events.values next unless in_range?(event) or event.trigger == 3 or event.trigger == 4 or event.check_comment("Force Update") event.update end for common_event in @common_events.values common_event.update end end
def in_range?(object) return false if object.real_x < (@display_x-256) return false if object.real_x > (@display_x+(Graphics.width*8)) return false if object.real_y < (@display_y-256) return false if object.real_y > (@display_y+(Graphics.height*8)) return true end
end
#------------------------------------------------------------------------------ # Game Character #------------------------------------------------------------------------------ class Game_Character
alias requiem_abs_gchar_initialize initialize alias requiem_abs_gchar_update update
def update requiem_abs_gchar_update return if $game_party.members.size <= 0 decrease_counters states_effects end
def decrease_counters @ani_time -= 1 if @ani_time > 0 @weapon1_attack_time -= 1 if @weapon1_attack_time > 0 @weapon2_attack_time -= 1 if @weapon2_attack_time > 0 @skill_attack_time -= 1 if @skill_attack_time > 0 @item_attack_time -= 1 if @item_attack_time > 0 @recovery_time -= 1 if @recovery_time > 0 @anime_attack -= 1 if @anime_attack > 0 @right_attack_on = @left_attack_on = false if @anime_attack <= 0 end
def states_effects if self.is_a?(Game_Event) and self.in_battle or self.is_a?(Game_Player) for state in @actor.states next if state.nil? if @state_time <= state.duration @state_time += 1 @freeze = true if state.dont_walk? @move_speed = 2 if state.walk_slower? @move_speed = 5 if state.walk_faster? if self.is_a?(Game_Event) and @actor.slip_damage? @actor.slip_damage_effect if Graphics.frame_count % 60 <= 0 end elsif @state_time > state.duration @freeze = false if state.dont_walk? @move_speed = @original_move_speed if state.walk_slower? @move_speed = @original_move_speed if state.walk_faster? @actor.remove_state(state.id) @state_time = 0 end end end end
end
#------------------------------------------------------------------------------ # Game Event #------------------------------------------------------------------------------ class Game_Event < Game_Character
alias requiem_abs_gevent_initialize initialize alias requiem_abs_gevent_setup setup alias requiem_abs_gevent_update update alias requiem_abs_gevent_refresh refresh
def setup(new_page) requiem_abs_gevent_setup(new_page) self.original_move_speed = @move_speed end
def update requiem_abs_gevent_update @respawn -= 1 if !@in_battle and self.actor.nil? and @respawn != nil and @respawn > 0 if @in_battle and self.actor != nil and !self.actor.dead? make_attack elsif @in_battle and self.actor != nil and self.actor.dead? kill_enemy erasing elsif !@in_battle and self.actor.nil? and @respawn != nil and @respawn <= 0 @erased = @starting = false refresh end end
def make_attack return if $game_map.interpreter.running? return if $game_player.in_vehicle? for action in $data_enemies[@enemy_id].actions next unless self.actor.conditions_met?(action) next unless rand(11) < action.rating next if self.weapon1_attack_time > 0 case action.kind when 0 case action.basic when 0 attack_normal when 1 self.actor.defending = true end when 1 self.assigned_skill = $data_skills[action.skill_id] case self.assigned_skill.scope when 1..7 if self.assigned_skill.ranged? if in_direction?(self, $game_player) and in_range?(self, $game_player, self.assigned_skill.range) skill_attack_range elsif action.rating == 10 skill_attack_range end else skill_attack_normal end when 7..12 skill_recover end end end end
def skill_recover if self.actor.mp >= self.assigned_skill.mp_cost and self.actor.hp <= (self.actor.maxhp*25/100) self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill) $game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0 @animation_id = self.assigned_skill.animation_id self.actor.skill_effect(self.actor, self.assigned_skill) self.weapon1_attack_time = $Requiem_ABS.enemy_attack_delay end for event in $game_map.events.values if event.in_battle and in_range?(self, event, 3) if self.actor.mp >= self.assigned_skill.mp_cost and event.actor.hp <= (event.actor.maxhp*25/100) self.actor.mp -= self.assigned_skill.mp_cost $game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0 event.animation_id = self.assigned_skill.animation_id event.actor.skill_effect(self.actor, self.assigned_skill) self.weapon1_attack_time = $Requiem_ABS.enemy_attack_delay end end end end
def erasing return if @puzzle @blend_type = 2 @opacity -= 5 end
def kill_enemy dying unless @killed return if @opacity > 0 and !@puzzle self.actor = nil desactive_enemy @killed = false $game_player.hits = 0 @in_battle = false end
def dying if $Requiem_ABS.auto_exp_e_gold exp = (self.actor.maxhp+self.actor.maxmp+self.actor.atk+self.actor.def+self.actor.spi+ self.actor.agi+self.actor.hit+self.actor.eva) * $Requiem_ABS.auto_exp_rate / 100 $game_player.actor.gain_exp(exp, 1) else $game_player.actor.gain_exp(self.actor.exp, 1) end make_drop unless @puzzle @animation_id = self.actor.die_animation_id if self.actor.die_animation_id > 0 if self.actor.die_se != nil RPG::SE.new(self.actor.die_se).play else Sound.play_enemy_collapse end end @killed = true end
def make_drop droped_items = [] for i in [self.actor.drop_item1, self.actor.drop_item2] next if i.kind <= 0 next if rand(i.denominator) != 0 if i.kind == 1 droped_items.push($data_items[i.item_id]) elsif i.kind == 2 droped_items.push($data_weapons[i.weapon_id]) elsif i.kind == 3 droped_items.push($data_armors[i.armor_id]) end end for t in droped_items next if t.nil? $game_drop.push(Game_Drop.new(self, t.icon_index, t , 0)) end if $Requiem_ABS.auto_exp_e_gold gold = (self.actor.maxhp+self.actor.maxmp+self.actor.atk+self.actor.def+self.actor.spi+ self.actor.agi+self.actor.hit+self.actor.eva) * $Requiem_ABS.auto_gold_rate / 100 else gold = self.actor.gold end if gold > 0 and rand(100) <= $Requiem_ABS.gold_drop_rate $game_drop.push(Game_Drop.new(self, $Requiem_ABS.gold_drop_icon_index, nil, gold)) end end
def update_self_movement return if self.freeze or (self.anime_attack/2) > 0 if @stop_count > 30 * (5 - @move_frequency) if @in_battle and in_range?(self, $game_player, @follow_distance) move_type_toward_player else case @move_type when 1 move_type_random when 2 move_type_toward_player when 3 move_type_custom end end end end
end
#------------------------------------------------------------------------------ # Game Player #------------------------------------------------------------------------------ class Game_Player < Game_Character
alias requiem_abs_gplayer_initialize initialize alias requiem_abs_gplayer_update update alias requiem_abs_gplayer_move_by_input move_by_input alias requiem_abs_gplayer_perform_transfer perform_transfer
def update_hits if self.right_attack_on and @attack_weapon != nil @hits = 0 if @hit_time <= 0 or @hits >= @attack_weapon.combo_hits elsif self.left_attack_on and @attack_weapon_and_Shield != nil @hits = 0 if @hit_time <= 0 or @hits >= @attack_weapon_and_Shield.combo_hits elsif self.right_attack_on and @attack_weapon.nil? @hits = 0 if @hit_time <= 0 or @hits >= 5 elsif self.left_attack_on and @attack_weapon_and_Shield.nil? @hits = 0 if @hit_time <= 0 or @hits >= 5 end @hit_time -= 1 if @hit_time > 0 end
def attack_with_weapon if Input.trigger?(Input::Letters[$Requiem_ABS.attack_key1]) return if !$Requiem_ABS.allow_attack_with_shield and self.actor.defending return if self.weapon1_attack_time > 0 @attack_weapon = self.actor.equips[0] RPG::SE.new(@attack_weapon.shot_se).play if @attack_weapon != nil and @attack_weapon.shot_se != nil self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false if @attack_weapon != nil and @attack_weapon.ranged? range_attack_right self.weapon1_attack_time = @attack_weapon.delay @hit_time = self.weapon1_attack_time + 15 else normal_attack_right self.weapon1_attack_time = $Requiem_ABS.player_attack_delay @hit_time = self.weapon1_attack_time + 15 end end if Input.press?(Input::Letters[$Requiem_ABS.attack_key2]) self.actor.defending = (self.actor.equips[1].is_a?(RPG::Armor) and $Requiem_ABS.allow_shields_graphics) else self.actor.defending = false end if Input.trigger?(Input::Letters[$Requiem_ABS.attack_key2]) return if self.weapon2_attack_time > 0 return if !$Requiem_ABS.allow_attack_with_shield and self.actor.defending @attack_weapon_and_Shield = (self.actor.two_swords_style ? self.actor.equips[1] : self.actor.equips[0]) RPG::SE.new(@attack_weapon_and_Shield.shot_se).play if @attack_weapon_and_Shield != nil and @attack_weapon_and_Shield.shot_se != nil self.anime_attack = 20 self.right_attack_on = false self.left_attack_on = true if @attack_weapon_and_Shield != nil and @attack_weapon_and_Shield.ranged? range_attack_left self.weapon2_attack_time = $Requiem_ABS.player_attack_delay @hit_time = self.weapon2_attack_time + 15 elsif self.actor.two_swords_style normal_attack_left self.weapon2_attack_time = @attack_weapon_and_Shield.delay @hit_time = self.weapon1_attack_time + 15 end end end
def attack_with_skill for button in self.actor.skill_hotkeys.keys if Input.trigger?(button) and self.actor.skill_hotkeys[button] != nil and self.actor.skill_hotkeys[button] != 0 return if self.skill_attack_time > 0 return if !$Requiem_ABS.allow_attack_with_shield and self.actor.defending self.assigned_skill = $data_skills[self.actor.skill_hotkeys[button]] if self.assigned_skill.scope == 2 skill_attack_all elsif self.assigned_skill.ranged? skill_attack_range elsif self.assigned_skill.explosive? skill_exlpode_range elsif self.assigned_skill.scope >= 7 skill_recover else skill_attack_normal end end end end
def attack_with_item for button in self.actor.item_hotkeys.keys if Input.trigger?(button) and self.actor.item_hotkeys[button] != nil and self.actor.item_hotkeys[button] != 0 return if self.item_attack_time > 0 return if !$Requiem_ABS.allow_attack_with_shield and self.actor.defending @assigned_item = $data_items[self.actor.item_hotkeys[button]] if @assigned_item.ranged? item_attack_range elsif @assigned_item.explosive? item_attack_explode elsif @assigned_item.bomb? item_attack_bomb else case @assigned_item.scope when 1 item_normal_attack when 2 item_attack_all when 3...7 item_normal_attack when 7...12 item_recover end end end end end
def normal_attack_right for event in $game_map.events.values next unless event.in_battle next unless in_front?(self, event) next if event.actor.dead? or event.object event.animation_id = self.actor.atk_animation_id hit_count return if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon.id or event.kill_with_skill > 0 or event.kill_with_item > 0 event.actor.attack_effect(self.actor) event.jump(0,0) unless event.puzzle end end
def normal_attack_left for event in $game_map.events.values next unless event.in_battle next unless in_front?(self,event) next if event.actor.dead? or event.object event.animation_id = self.actor.atk_animation_id2 hit_count return if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon_and_Shield.id or event.kill_with_skill > 0 or event.kill_with_item > 0 event.actor.attack_effect(self.actor) event.jump(0,0) unless event.puzzle end end
def skill_attack_normal for event in $game_map.events.values next unless event.in_battle next unless in_front?(self,event) next if event.actor.dead? or event.object next unless self.actor.mp >= self.assigned_skill.mp_cost self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill) $game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0 event.animation_id = self.assigned_skill.animation_id self.skill_attack_time = self.assigned_skill.delay return if event.kill_with_weapon > 0 or event.kill_with_item > 0 or event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) event.jump(0,0) unless event.puzzle end end
def skill_attack_all return unless self.actor.mp >= self.assigned_skill.mp_cost self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill) $game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0 for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object event.animation_id = self.assigned_skill.animation_id self.skill_attack_time = $Requiem_ABS.player_attack_delay return if event.kill_with_weapon > 0 or event.kill_with_item > 0 or event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) event.jump(0,0) unless event.puzzle end end
def item_normal_attack for event in $game_map.events.values next unless event.in_battle next unless in_front?(self,event) next if event.actor.dead? or event.object next unless $game_party.has_item?(@assigned_item) $game_party.consume_item(@assigned_item) $game_temp.common_event_id = @assigned_item.common_event_id if @assigned_item.common_event_id > 0 event.animation_id = @assigned_item.animation_id self.item_attack_time = $Requiem_ABS.player_attack_delay return if event.kill_with_weapon > 0 or event.kill_with_skill > 0 or event.kill_with_item > 0 and event.kill_with_item != self.assigned_item.id event.actor.item_effect(self.actor, @assigned_item) event.jump(0,0) unless event.puzzle end end
def item_attack_range return unless $game_party.has_item?(@assigned_item) $game_party.consume_item(@assigned_item) $game_temp.common_event_id = @assigned_item.common_event_id if @assigned_item.common_event_id > 0 $game_range.push(Game_Range.new(self, @assigned_item.graphic, @assigned_item.index, @assigned_item.move_speed, @assigned_item.range, 5)) RPG::SE.new(@assigned_item.shot_se).play if @assigned_item.shot_se != nil self.item_attack_time = @assigned_item.delay end
def item_attack_explode return unless $game_party.has_item?(@assigned_item) $game_party.consume_item(@assigned_item) $game_temp.common_event_id = @assigned_item.common_event_id if @assigned_item.common_event_id > 0 $game_range.push(Game_Range.new(self, @assigned_item.graphic, @assigned_item.index, @assigned_item.move_speed, @assigned_item.range, 6)) RPG::SE.new(@assigned_item.shot_se).play if @assigned_item.shot_se != nil self.item_attack_time = @assigned_item.delay end
def item_attack_all next unless $game_party.has_item?(@assigned_item) $game_party.consume_item(@assigned_item) $game_temp.common_event_id = @assigned_item.common_event_id if @assigned_item.common_event_id > 0 for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object event.animation_id = @assigned_item.animation_id self.item_attack_time = $Requiem_ABS.player_attack_delay return if event.kill_with_weapon > 0 or event.kill_with_skill > 0 or event.kill_with_item > 0 and event.kill_with_item != self.assigned_item.id event.actor.item_effect(self.actor, @assigned_item) event.jump(0,0) unless event.puzzle end end
def item_attack_bomb return if $game_party.has_item?(@assigned_item) and @bomb_already $game_party.consume_item(@assigned_item) $game_temp.common_event_id = @assigned_item.common_event_id if @assigned_item.common_event_id > 0 $game_bomb.push(Game_Bomb.new(self, @assigned_item)) end
def auto_recovery return unless self.actor.auto_hp_recover and self.recovery_time <= 0 self.actor.hp += (self.actor.maxhp*10/100) self.recovery_time = 1800 end
def perform_transfer requiem_abs_gplayer_perform_transfer for range in $game_range next if range.nil? range.destroy = true end for drop in $game_drop next if drop.nil? drop.destroy = true end for bomb in $game_bomb next if bomb.nil? bomb.destroy = true end @bomb_already = false end
def move_by_input return if self.freeze or (self.anime_attack/2) > 0 requiem_abs_gplayer_move_by_input end
end
Dernière édition par thérapie le Sam 5 Déc 2009 - 12:13, édité 2 fois
thérapie
Aventurier Lv.16
Age : 28 Inscrit le : 03/08/2009 Messages : 1399
Sujet: Re: [Résolu] Problème avec le script Abs 6 Sam 5 Déc 2009 - 10:46
Suite :
Spoiler:
Code:
#------------------------------------------------------------------------------ # Game Range #------------------------------------------------------------------------------ class Game_Range < Game_Character
def update super return if @destroy @destroy = @step > @range return if moving? move_forward @step += 1 end
def check_event_trigger_touch(x, y) return if @destroy if $game_player.pos?(x, y) and @type == 3 and @parent.is_a?(Game_Event) hurt_hero end for event in $game_map.events.values next unless event.in_battle and event.pos?(x, y) case @type when 1 hurt_enemy_weapon_right(event) when 2 hurt_enemy_weapon_left(event) when 3 hurt_enemy_skill(event) when 4 hurt_enemy_skill_explode when 5 hurt_enemy_item(event) when 6 hurt_enemy_item_explode end end end
def hurt_enemy_weapon_right(enemy) @destroy = true return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.actor.equips[0].ammo1.animation_id if @parent.actor.equips[0].ammo1 != nil return if enemy.kill_with_weapon > 0 and enemy.kill_with_weapon != @parent.actor.weapon_id or enemy.kill_with_skill > 0 or enemy.kill_with_item > 0 enemy.actor.attack_effect(@parent.actor) enemy.jump(0,0) unless enemy.puzzle end
def hurt_enemy_weapon_left(enemy) @destroy = true return if enemy.actor.dead? or enemy.object if @parent.actor.two_swords_style @weapon = @parent.actor.equips[1] else @weapon = @parent.actor.equips[0] end enemy.animation_id = @weapon.ammo2.animation_id if @weapon.ammo2 != nil return if enemy.kill_with_weapon > 0 and enemy.kill_with_weapon != @weapon.id or enemy.kill_with_skill > 0 or enemy.kill_with_item > 0 enemy.actor.attack_effect(@parent.actor) enemy.jump(0,0) unless enemy.puzzle end
def hurt_enemy_skill(enemy) @destroy = true return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.assigned_skill.animation_id return if enemy.kill_with_weapon > 0 or enemy.kill_with_item > 0 or enemy.kill_with_skill > 0 and enemy.kill_with_skill != @parent.assigned_skill.id enemy.actor.skill_effect(@parent.actor, @parent.assigned_skill) enemy.jump(0,0) unless enemy.puzzle end
def hurt_enemy_item(enemy) @destroy = true return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.assigned_item.animation_id return if enemy.kill_with_weapon > 0 or enemy.kill_with_skill > 0 or enemy.kill_with_item > 0 and enemy.kill_with_item != @parent.assigned_item.id enemy.actor.item_effect(@parent.actor, @parent.assigned_item) enemy.jump(0,0) unless enemy.puzzle end
def hurt_enemy_skill_explode @destroy = true for event in $game_map.events.values next unless event.in_battle next unless in_range?(self, event, @parent.assigned_skill.area) return if event.actor.dead? or event.object event.animation_id = @parent.assigned_skill.animation_id return if event.kill_with_weapon > 0 or event.kill_with_item > 0 or event.kill_with_skill > 0 and event.kill_with_skill != @parent.assigned_skill.id event.actor.skill_effect(@parent.actor, @parent.assigned_skill) event.jump(0,0) unless event.puzzle end end
def hurt_enemy_item_explode @destroy = true for event in $game_map.events.values next unless event.in_battle and in_range?(self, event, @parent.assigned_item.area) return if event.actor.dead? or event.object event.animation_id = @parent.assigned_item.animation_id return if event.kill_with_weapon > 0 or event.kill_with_item > 0 or event.kill_with_skill > 0 and event.kill_with_skill != @parent.assigned_item.id event.actor.item_effect(@parent.actor, @parent.assigned_item) event.jump(0,0) unless event.puzzle end end
def map_passable?(x, y) return $game_map.range_passable?(x, y) end
end
#------------------------------------------------------------------------------ # Game Bomb #------------------------------------------------------------------------------ class Game_Bomb < Game_Character
def initialize(parent, item) super() @parent = parent @item = item @graphic_name = "IconSet" @graphic_index = @item.icon_index @area = @item.area @time = @item.delay @destroy = false @draw = false self.priority_type = 2 case @parent.direction when 2 moveto(@parent.x, @parent.y+1) when 4 moveto(@parent.x-1, @parent.y) when 6 moveto(@parent.x+1, @parent.y) when 8 moveto(@parent.x, @parent.y-1) end RPG::SE.new($Requiem_ABS.drop_se[1]).play if $Requiem_ABS.drop_se[1] != "" $game_player.bomb_already = true jump(0,0) move_random if !$game_map.passable?(@x, @y) or $game_map.events_xy(@x, @y) != [] end
def update super return if @destroy if @item.shot_se != nil and Graphics.frame_count % 60 <= 0 RPG::SE.new(@item.shot_se).play end @time -= 1 if @time > 0 explode if @time <= 0 end
def explode @animation_id = @item.animation_id if in_range?(self, $game_player, @area) $game_player.actor.item_effect(@parent.actor, @item) $game_player.jump(0, 0) end for event in $game_map.events.values if event.in_battle and in_range?(self, event, @area) event.actor.item_effect(@parent.actor, @item) event.jump(0, 0) unless event.puzzle end end $game_player.bomb_already = false @destroy = true end
def check_event_trigger_touch(x, y) end
end
#------------------------------------------------------------------------------ # Game Drop #------------------------------------------------------------------------------ class Game_Drop < Game_Character
def initialize(parent, graphic_index=0, item=nil, gold=0) super() @graphic_name = "IconSet" @graphic_index = graphic_index @item = item @gold = gold @drop_time = $Requiem_ABS.drop_duration_time moveto(parent.x, parent.y) RPG::SE.new($Requiem_ABS.drop_se[0]).play if $Requiem_ABS.drop_se[0] != "" and @gold > 0 RPG::SE.new($Requiem_ABS.drop_se[1]).play if $Requiem_ABS.drop_se[1] != "" and @items != nil @destroy = false @draw = false jump(0,0) move_random if !moving? end
def update super return if @destroy @drop_time -= 1 if @drop_time > 0 @destroy = @drop_time <= 0 return unless Input.trigger?(Input::C) and in_front?($game_player, self) get_reward end
def get_reward Sound.play_decision case @item when RPG::Item $game_party.gain_item($data_items[@item.id],1) $game_player.reward = $data_items[@item.id].name when RPG::Weapon $game_party.gain_item($data_weapons[@item.id],1) $game_player.reward = $data_weapons[@item.id].name when RPG::Armor $game_party.gain_item($data_armors[@item.id],1) $game_player.reward = $data_weapons[@item.id].name end if @gold > 0 $game_party.gain_gold(@gold) $game_player.reward = "$ #{@gold}" end @destroy = true end
def check_event_trigger_touch(x, y) end
end
#------------------------------------------------------------------------------ # Sprite Base #------------------------------------------------------------------------------ class Sprite_Base
#------------------------------------------------------------------------------ # Sprite Character #------------------------------------------------------------------------------ class Sprite_Character < Sprite_Base
alias requiem_abs_spchar_initialize initialize alias requiem_abs_spchar_update update alias requiem_abs_spchar_dispose dispose
def initialize(viewport, character=nil) @character = character @_damage_duration = 0 @_hit_duration = 0 @_reward_duration = 0 requiem_abs_spchar_initialize(viewport,@character) end
def update requiem_abs_spchar_update update_show_dmg update_show_hit update_show_reward update_show_state_ani end
def dispose requiem_abs_spchar_dispose dispose_damage dispose_hit dispose_reward end
def update_show_dmg if @_damage_duration > 0 @_damage_duration -=1 @_damage_sprite.y -= 1 @_damage_sprite.x = self.x elsif @_damage_duration <= 0 and @_damage_sprite != nil and !@_damage_sprite.disposed? @_damage_sprite.y -= 1 @_damage_sprite.opacity -= 5 dispose_damage if @_damage_sprite.opacity <= 0 end if @character.actor != nil and @character.actor.damage != 0 return if @character.is_a?(Game_Event) and @character.puzzle damage(@character.actor.damage, @character.actor.critical, @character.actor.combo, @character.actor.reflect) @character.actor.damage = 0 @character.actor.critical = @character.actor.combo = @character.actor.reflect = false end end
def update_show_hit if @_hit_duration > 0 @_hit_duration -=1 elsif @_hit_duration <= 0 and @_hit_sprite != nil and !@_hit_sprite.disposed? @_hit_sprite.opacity -= 5 dispose_hit if @_hit_sprite.opacity <= 0 end if @character.is_a?(Game_Player) and @character.hit != nil hit(@character.hit) @character.hit = nil end end
def update_show_reward if @_reward_duration > 0 @_reward_duration -= 1 elsif @_reward_duration <= 0 and @_reward_sprite != nil and !@_reward_sprite.disposed? @_reward_sprite.opacity -= 5 dispose_reward if @_reward_sprite.opacity <= 0 end if $game_player.reward != nil and $Requiem_ABS.show_reward show_reward($game_player.reward) $game_player.reward = nil end end
def update_show_state_ani return if @character.actor.nil? for state in @character.actor.states next if state.nil? or state.animation_id <= 0 if @character.ani_time <= 0 @character.animation_id = state.animation_id @character.ani_time = $data_animations[@character.animation_id].frame_max * 4 + 1 end end end
def dispose_damage return if @_damage_sprite.nil? @_damage_sprite.bitmap.dispose @_damage_sprite.dispose @_damage_sprite = nil end
def dispose_hit return if @_hit_sprite.nil? @_hit_sprite.bitmap.dispose @_hit_sprite.dispose @_hit_sprite = nil end
def dispose_reward return if @_reward_sprite.nil? @_reward_sprite.bitmap.dispose @_reward_sprite.dispose @_reward_sprite = nil end
end
#------------------------------------------------------------------------------ # Sprite Drop #------------------------------------------------------------------------------ class Sprite_Drop < Sprite_Base
attr_accessor :character
def initialize(viewport, character=nil) super(viewport) @character = character update end
def update super update_bitmap self.x = @character.screen_x self.y = @character.screen_y self.z = @character.screen_z self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth if @character.animation_id != 0 start_animation($data_animations[@character.animation_id]) @character.animation_id = 0 end end
def change_angle(a, b, c) if @character.anime_attack >= 20 self.angle = a elsif @character.anime_attack >= 15 self.angle = b elsif @character.anime_attack >= 10 self.angle = c end end
def weapon_index return 0 if @character.actor.nil? if @character.actor.is_a?(Game_Actor) and @character.right_attack_on and @character.actor.equips[0] != nil return @character.actor.equips[0].icon_index elsif @character.actor.is_a?(Game_Actor) and @character.left_attack_on if @character.actor.two_swords_style and @character.actor.equips[1] != nil return @character.actor.equips[1].icon_index elsif @character.actor.two_hands_legal? and @character.actor.equips[0] != nil and @character.actor.equips[0].ranged? return @character.actor.equips[0].icon_index end elsif @character.actor.is_a?(Game_Enemy) and @character.actor.weapon_icon > 0 return @character.actor.weapon_icon end return 0 end
end
#------------------------------------------------------------------------------ # Sprite Shield #------------------------------------------------------------------------------ class Sprite_Shield < Sprite_Base
attr_accessor :character
def initialize(viewport, character = nil) super(viewport) @character = character self.visible = false create_bitmap update end
def update super return unless $Requiem_ABS.allow_shields_graphics return if @character.actor.nil? self.visible = @character.actor.defending update_src_rect change_direction moving_with_shield end
def change_direction case @character.direction when 2 self.mirror = true self.x = @character.screen_x+6 self.z = @character.screen_z+1 when 4 self.mirror = false self.x = @character.screen_x-6 self.z = @character.screen_z+1 when 6 self.mirror = true self.x = @character.screen_x+6 self.z = @character.screen_z-1 when 8 self.mirror = false self.x = @character.screen_x-6 self.z = @character.screen_z-1 end self.y = @character.screen_y self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth end
def moving_with_shield if @character.moving? self.wave_amp = 1 self.wave_length = 1 self.wave_speed = 6 else self.wave_amp = 0 end end
def shield_index return 0 if @character.actor.nil? if @character.actor.is_a?(Game_Actor) and !@character.actor.two_swords_style and @character.actor.armor1_id > 0 return $data_armors[@character.actor.armor1_id].icon_index elsif @character.actor.is_a?(Game_Enemy) and @character.actor.shield_icon > 0 return @character.actor.shield_icon end return 0 end
end
#------------------------------------------------------------------------------ # Spriteset Map #------------------------------------------------------------------------------ class Spriteset_Map
attr_accessor :viewport3
alias requiem_abs_sp_map_create_characters create_characters alias requiem_abs_sp_map_dispose_characters dispose_characters
def create_characters @range_sprites = [] for range in $game_range next if range.nil? or !$game_map.in_range?(range) @range_sprites.push(Sprite_Character.new(@viewport1, range)) end @drop_sprites = [] for drop in $game_drop next if drop.nil? or !$game_map.in_range?(drop) @drop_sprites.push(Sprite_Drop.new(@viewport1, drop)) end for bomb in $game_bomb next if bomb.nil? or !$game_map.in_range?(bomb) @drop_sprites.push(Sprite_Drop.new(@viewport1, bomb)) end @weapon_sprites = [] @weapon_sprites.push(Sprite_Weapon.new(@viewport1, $game_player)) @shield_sprites = [] @shield_sprites.push(Sprite_Shield.new(@viewport1, $game_player)) for i in $game_map.events.keys.sort @weapon_sprites.push(Sprite_Weapon.new(@viewport1, $game_map.events[i])) @shield_sprites.push(Sprite_Shield.new(@viewport1, $game_map.events[i])) end requiem_abs_sp_map_create_characters end
def update_characters for sprite in @character_sprites if sprite.character.is_a?(Game_Event) if $game_map.in_range?(sprite.character) or sprite.character.check_comment("Force Update") sprite.update else sprite.visible = false end else sprite.update end end for range in @range_sprites next if range.nil? or !$game_map.in_range?(range.character) range.update end for drop in @drop_sprites next if drop.nil? or !$game_map.in_range?(drop.character) drop.update end for weapon in @weapon_sprites next if weapon.nil? or !$game_map.in_range?(weapon.character) weapon.update end for shield in @shield_sprites next if shield.nil? or !$game_map.in_range?(shield.character) shield.update end for range in $game_range next if range.nil? or !$game_map.in_range?(range) unless range.draw @range_sprites.push(Sprite_Character.new(@viewport1, range)) range.draw = true end if range.destroy range.character_name = "" $game_range.delete(range) end end for drop in $game_drop next if drop.nil? or !$game_map.in_range?(drop) unless drop.draw @drop_sprites.push(Sprite_Drop.new(@viewport1, drop)) drop.draw = true end if drop.destroy drop.graphic_name = "" $game_drop.delete(drop) end end for bomb in $game_bomb next if bomb.nil? or !$game_map.in_range?(bomb) unless bomb.draw @drop_sprites.push(Sprite_Drop.new(@viewport1, bomb)) bomb.draw = true end if bomb.destroy bomb.graphic_name = "" $game_drop.delete(bomb) end end end
def dispose_characters requiem_abs_sp_map_dispose_characters for range in @range_sprites next if range.nil? range.dispose end for drop in @drop_sprites next if drop.nil? drop.dispose end for weapon in @weapon_sprites next if weapon.nil? weapon.dispose end for shield in @shield_sprites next if shield.nil? shield.dispose end end
end
#------------------------------------------------------------------------------ # Window Base #------------------------------------------------------------------------------ class Window_Base < Window
#------------------------------------------------------------------------------ # Scene Title #------------------------------------------------------------------------------ class Scene_Title < Scene_Base
alias requiem_abs_scenetitle_create_game_objects create_game_objects
#------------------------------------------------------------------------------ # Scene Map #------------------------------------------------------------------------------ class Scene_Map < Scene_Base
alias requiem_abs_smap_update update alias requiem_abs_smap_terminate terminate
def update requiem_abs_smap_update for range in $game_range next if range.nil? or !$game_map.in_range?(range) range.update end for drop in $game_drop next if drop.nil? or !$game_map.in_range?(drop) drop.update end for bomb in $game_bomb next if bomb.nil? or !$game_map.in_range?(bomb) bomb.update end end
def update_encounter end
end
#------------------------------------------------------------------------------ # Scene Item #------------------------------------------------------------------------------ class Window_Item < Window_Selectable
def update_help if $scene.is_a?(Scene_Item) and $scene.message != nil @help_window.set_text($scene.message) else @help_window.set_text(item == nil ? "" : item.description) end end
end
#------------------------------------------------------------------------------ class Scene_Item < Scene_Base
attr_accessor :message attr_accessor :delay
alias requiem_abs_sitem_start start alias requiem_abs_sitem_update update alias requiem_abs_sitem_update_item_selection update_item_selection
def update requiem_abs_sitem_update if @delay <= 0 @message = nil else @delay -= 1 end end
def update_item_selection requiem_abs_sitem_update_item_selection for button in @actor.item_hotkeys.keys if Input.trigger?(button) and @item_window.item.is_a?(RPG::Item) Sound.play_decision @actor.item_hotkeys[button] = @item_window.item.id @message = $Requiem_ABS.memorized_text @delay = 120 end end end
end
#------------------------------------------------------------------------------ # Scene Skill #------------------------------------------------------------------------------ class Window_Skill < Window_Selectable
def update_help if $scene.is_a?(Scene_Skill) and $scene.message != nil @help_window.set_text($scene.message) else @help_window.set_text(skill == nil ? "" : skill.description) end end
end
#------------------------------------------------------------------------------ class Scene_Skill < Scene_Base
attr_accessor :message attr_accessor :delay
alias requiem_abs_sskill_start start alias requiem_abs_sskill_update update alias requiem_abs_sskill_update_skill_selection update_skill_selection
def start requiem_abs_sskill_start @message = nil @delay = 0 end
def update requiem_abs_sskill_update if @delay <= 0 @message = nil else @delay -= 1 end end
def update_skill_selection requiem_abs_sskill_update_skill_selection for button in @actor.skill_hotkeys.keys if Input.trigger?(button) Sound.play_decision @actor.skill_hotkeys[button] = @skill_window.skill.id @message = $Requiem_ABS.memorized_text @delay = 120 end end end
end
#------------------------------------------------------------------------------ # Scene File #------------------------------------------------------------------------------ class Scene_File < Scene_Base
alias requiem_abs_sfile_write_save_data write_save_data alias requiem_abs_sfile_read_save_data read_save_data
def write_save_data(file) requiem_abs_sfile_write_save_data(file) Marshal.dump($game_range, file) Marshal.dump($game_drop, file) Marshal.dump($game_bomb, file) end
#------------------------------------------------------------------------------ # High Priority #------------------------------------------------------------------------------ Win32API.new("kernel32", "SetPriorityClass", "pi", "i").call(-1, 0x80)
#------------------------------------------------------------------------------ # End of ABS #------------------------------------------------------------------------------ $Requiem_ABS = Requiem_ABS.new end
Zangther
Maître des Duels
Age : 32 Inscrit le : 29/07/2009 Messages : 7841
Sujet: Re: [Résolu] Problème avec le script Abs 6 Sam 5 Déc 2009 - 11:18
# Die Erase - Erase the enemy when it dies; # Die Self Switch A - Turn On the Self Switch A when enemy dies; # Die Self Switch B - Turn On the Self Switch B when enemy dies; # Die Self Switch C - Turn On the Self Switch C when enemy dies; # Die Self Switch D - Turn On the Self Switch D when enemy dies; # Die Switch X - Turn On the Switch X when enemy dies; # Die Variable X - Increase +1 to variable X;
Je te conseille de mettre Die Erase. Comme ça le monstre meurt et réapparait quand tu change de map.
thérapie
Aventurier Lv.16
Age : 28 Inscrit le : 03/08/2009 Messages : 1399
Sujet: Re: [Résolu] Problème avec le script Abs 6 Sam 5 Déc 2009 - 12:12