Đề nghị các bạn khi copy bài này xin để Tác gả và nguồn
I. Chuẩn bị tài nguyên và script (Mình đăng lên luôn khỏi cần các bạn down demo làm chi cho mệt ^^) 1. Script Các bạn copy hết 8 script sau đây :
Script 1
Code:
#============================================================================== # Script Xas VX Easy ver 1 #============================================================================== # Viet Nam transtion by duongtiep - http://makegame.forumvi.com/ #------------------------------------------------------------------------------ module Vampyr_Kernel
@scripts = {} @warnings = {}
Print_Errors = false
def self.register(script, version, date) @scripts[script] = [version, date] end
def self.enabled?(script, version=nil) if @scripts.has_key?(script) if version.nil? return true elsif @scripts[script][0] >= version return true else if @warnings[script].nil? and Print_Errors print "'#{script}' is obsolete.\r\nSome functions won't work correctly" @warnings[script] = ["is obsolete"] self.write_log end return false end else if $TEST and @warnings[script].nil? and Print_Errors print "Unable to find script '#{script}' or it is placed in wrong place.\r\nSome functions won't work correctly" @warnings[script] = ["Unable to find"] self.write_log end return false end end
def self.show_scripts(alert=true) list = "Vampyr Scripts [#{@scripts.size}]:\r\n\r\n" @scripts.each { |key, value| list += "#{key.gsub("Vampyr ", "")} #{value[0]} #{value[1]}\r\n" } list += "\r\nWarnings:\r\n" if @warnings != {} @warnings.each { |key, value| list += "#{key} #{value}\r\n" } return print list if alert return list end
def self.write_log file = File.new("Vampyr_Log-#{Time.now.strftime("%m_%d_%Y")}.txt", "wb") file.write(self.show_scripts(false)) file.close end
def self.selfswitch(event_id, switch, status) key = [$game_map.map_id, event_id, switch] if status == nil $game_self_switches[key] = !$game_self_switches[key] else $game_self_switches[key] = status end $game_map.need_refresh = true end
end
#------------------------------------------------------------------------------ # Object #------------------------------------------------------------------------------ class Object
def to_b return true if self == "true" return true if self.to_i > 0 return false end
def number? return true unless self.scan(/\d/).empty? return false end
def transform return self.to_i if self.number? return self.to_s end
def get_width b = Bitmap.new(1, 1) w = a.text_size(self.to_s).width b.dispose return w end
def to_rgb x = self.delete("#").scan(/../).map { |i| i.to_i(16) } return Color.new(x[0].to_f, x[1].to_f, x[2].to_f) end
end
#------------------------------------------------------------------------------ # Sprite #------------------------------------------------------------------------------ class Sprite
def draw_icon(icon, x, y) return if self.bitmap == nil rect = Rect.new(icon%16*24, icon/16*24, 24, 24) self.bitmap.blt(x, y, Cache.system("Iconset"), rect) end
end
#------------------------------------------------------------------------------ # Bitmap #------------------------------------------------------------------------------ class Bitmap
def draw_outlined_text(*args) if args[0].is_a?(Rect) x = args[0].x; y = args[0].y w = args[0].width; h = args[0].height s = args[1] a = (args[2].nil? ? 0 : args[2]) c = (args[3].nil? ? Font.default_color : args[3]) else x = args[0]; y = args[1] w = args[2]; h = args[3] s = args[4] a = (args[5].nil? ? 0 : args[5]) c = (args[6].nil? ? Font.default_color : args[6]) end font.shadow = false font.color = Color.new(0,0,0) draw_text(x-1, y-1, w, h, s, a) draw_text(x+1, y-1, w, h, s, a) draw_text(x-1, y+1, w, h, s, a) draw_text(x+1, y+1, w, h, s, a) font.color = c draw_text(x, y, w, h, s, a) end
end
#------------------------------------------------------------------------------ # Game Interpreter #------------------------------------------------------------------------------ class Game_Interpreter
def selfswitch(event_id, switch, status) key = [$game_map.map_id, event_id, switch] if status == nil $game_self_switches[key] = !$game_self_switches[key] else $game_self_switches[key] = status end $game_map.need_refresh = true end
end
#------------------------------------------------------------------------------ # High Priority #------------------------------------------------------------------------------ Win32API.new("kernel32", "SetPriorityClass", "pi", "i").call(-1, 0x80)
A = 65 B = 66 C = 67 D = 68 E = 69 F = 70 G = 71 H = 72 I = 73 J = 74 K = 75 L = 76 M = 77 N = 78 O = 79 P = 80 Q = 81 R = 82 S = 83 T = 84 U = 85 V = 86 W = 87 X = 88 Y = 89 Z = 90
def self.name(id) return (Names.keys.include?(id) ? Names[id] : "???") end
def self.value(id) if Values["ALL"].keys.include?(id) return Values["ALL"][id] elsif Values[Keyboard].keys.include?(id) return Values[Keyboard][id] else return Values["EN-US"][id] end end
unless File.exists?("Input.dll") print("Unlable to load file - Input.dll") exit end
LEFT = 37 UP = 38 RIGHT = 39 DOWN = 40 A = [160, 161] B = [27, 88, 96] C = [13, 32, 90] X = 65 Y = 83 Z = 68 L = 81 R = 87 SHIFT = 16 CTRL = 17 ALT = 18 F5 = 116 F6 = 117 F7 = 118 F8 = 119 F9 = 120
def self.trigger?(id) @trigger.indexes(*id.to_a).include?(true) end
def self.press?(id) @press.indexes(*id.to_a).include?(true) end
def self.triggerd?(what) if triggered.include?(what) return true end end
def self.triggered array = Array.new @trigger.each_index {|i| array.push(i) if @trigger[i]} array end
def self.pressed?(what) if pressed.include?(what) return true end end
def self.pressed array = Array.new @press.each_index {|i| array.push(i) if @press[i]} array end
def self.repeat?(id) @repeat.indexes(*id.to_a).include?(true) end
def self.repeated array = Array.new @repeat.each_index {|i| array.push(i) if @repeat[i]} array end
def self.release?(id) @release.indexes(*id.to_a).include?(true) end
def self.released array = Array.new @release.each_index {|i| array.push(i) if @release[i]} array end
def self.dir4 return 2 if self.pressed?(DOWN) return 4 if self.pressed?(LEFT) return 6 if self.pressed?(RIGHT) return 8 if self.pressed?(UP) return 0 end
def self.dir8 if self.pressed?(UP) return 9 if self.pressed?(RIGHT) return 7 if self.pressed?(LEFT) return 8 end if self.pressed?(DOWN) return 3 if self.pressed?(RIGHT) return 1 if self.pressed?(LEFT) return 2 end return 6 if self.pressed?(RIGHT) return 4 if self.pressed?(LEFT) return 0 end
end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
def in_range?(parent, target, range) x = (parent.x - target.x) * (parent.x - target.x) y = (parent.y - target.y) * (parent.y - target.y) r = x + y return true if r <= (range * range) return false end
def in_direction?(parent, target) return true if parent.direction == 2 and target.y >= parent.y and target.x == parent.x return true if parent.direction == 4 and target.x <= parent.x and target.y == parent.y return true if parent.direction == 6 and target.x >= parent.x and target.y == parent.y return true if parent.direction == 8 and target.y <= parent.y and target.x == parent.x return false end
def in_front?(parent, target) return true if parent.direction == 2 and parent.x == target.x and (parent.y+1) == target.y return true if parent.direction == 4 and (parent.x-1) == target.x and parent.y == target.y return true if parent.direction == 6 and (parent.x+1) == target.x and parent.y == target.y return true if parent.direction == 8 and parent.x == target.x and (parent.y-1) == target.y return true if parent.x == target.x and parent.y == target.y return false end
def in_behind?(parent, target) return true if target.direction == 2 and parent.x == target.x and parent.y < target.y return true if target.direction == 4 and parent.x > target.x and parent.y == target.y return true if target.direction == 6 and parent.x < target.x and parent.y == target.y return true if target.direction == 8 and parent.x == target.x and parent.y > target.y return false end
def in_beside?(parent, target) return true if target.direction == 2 and parent.direction == 4 and target.x == (parent.x-1) and target.y == parent.y return true if target.direction == 2 and parent.direction == 6 and target.x == (parent.x+1) and target.y == parent.y return true if target.direction == 4 and parent.direction == 2 and target.x == parent.x and target.y == (parent.y+1) return true if target.direction == 4 and parent.direction == 8 and target.x == parent.x and target.y == (parent.y-1) return true if target.direction == 6 and parent.direction == 2 and target.x == parent.x and target.y == (parent.y+1) return true if target.direction == 6 and parent.direction == 8 and target.x == parent.x and target.y == (parent.y-1) return true if target.direction == 8 and parent.direction == 4 and target.x == (parent.x-1) and target.y == parent.y return true if target.direction == 8 and parent.direction == 6 and target.x == (parent.x+1) and target.y == parent.y return false end
def face_to_face?(parent, target) return true if parent.direction == 2 and target.direction == 8 return true if parent.direction == 4 and target.direction == 6 return true if parent.direction == 6 and target.direction == 4 return true if parent.direction == 8 and target.direction == 2 return false end
def is_passable?(object, dir) x = dir == 4 ? -1 : dir == 6 ? 1 : 0 y = dir == 2 ? 1 : dir == 8 ? -1 : 0 return true if $game_map.passable?(object.x+x, object.y+y) return false end
def xd x = (@direction == 4 ? -1 : @direction == 6 ? 1 : 0) return @x+x end
def yd y = (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) return @y+y end
def event_xy(object, dir) x = dir == 4 ? -1 : dir == 6 ? 1 : 0 y = dir == 2 ? 1 : dir == 8 ? -1 : 0 for i in $game_map.events.values return true if i.x == object.x+x and i.y == object.y+y and !i.through end return false end
def jump_to(x, y) xx = (x < @x ? -(@x-x) : x > @x ? x-@x : 0) yy = (y < @y ? -(@y-y) : y > @y ? y-@y : 0) jump(xx, yy) end
def move_toward(target) sx = distance_x_from(target) sy = distance_y_from(target) if sx != 0 or sy != 0 if sx.abs > sy.abs sx > 0 ? move_left : move_right if @move_failed and sy != 0 sy > 0 ? move_up : move_down end else sy > 0 ? move_up : move_down if @move_failed and sx != 0 sx > 0 ? move_left : move_right end end end end
def move_type_toward(target) case rand(6) when 0..3; move_toward(target) when 4; move_random when 5; move_forward end end
def move_away_from(target) sx = distance_x_from(target) sy = distance_y_from(target) if sx != 0 or sy != 0 if sx.abs > sy.abs sx > 0 ? move_right : move_left if @move_failed and sy != 0 sy > 0 ? move_down : move_up end else sy > 0 ? move_down : move_up if @move_failed and sx != 0 sx > 0 ? move_right : move_left end end end end
def turn_toward(target) sx = distance_x_from(target) sy = distance_y_from(target) if sx.abs > sy.abs sx > 0 ? turn_left : turn_right elsif sx.abs < sy.abs sy > 0 ? turn_up : turn_down end end
def follow(x, y) sx = distance_x(x) sy = distance_y(y) if sx != 0 or sy != 0 if sx.abs > sy.abs sx > 0 ? move_left : move_right if @move_failed and sy != 0 sy > 0 ? move_up : move_down end else sy > 0 ? move_up : move_down if @move_failed and sx != 0 sx > 0 ? move_left : move_right end end end end
def look_to(target) look_at(target.x, target.y) end
def look_at(x, y) sx = distance_x(x) sy = distance_y(y) if sx.abs > sy.abs sx > 0 ? turn_left : turn_right elsif sx.abs < sy.abs sy > 0 ? turn_up : turn_down end end
def distance_x_from(target) sx = @x - target.x if $game_map.loop_horizontal? if sx.abs > $game_map.width / 2 sx -= $game_map.width end end return sx end
def distance_y_from(target) sy = @y - target.y if $game_map.loop_vertical? if sy.abs > $game_map.height / 2 sy -= $game_map.height end end return sy end
def distance_x(x) sx = @x - x if $game_map.loop_horizontal? if sx.abs > $game_map.width / 2 sx -= $game_map.width end end return sx end
def distance_y(y) sy = @y - y if $game_map.loop_vertical? if sy.abs > $game_map.height / 2 sy -= $game_map.height end end return sy end
def animation_id=(i) @animation_id = (i < 0 ? 1 : i) end
def check_event_trigger_touch(x, y) end
end
#------------------------------------------------------------------------------ class Game_Event < Game_Character
attr_reader :id
def check_value(comment) return 0 if @list.nil? or @list.size <= 0 for item in @list if item.code == 108 or item.code == 408 if item.parameters[0] =~ /#{comment} (\d+)/ return $1.to_i end end end return 0 end
def check_comment(comment) return nil if @list.nil? or @list.size <= 0 for item in @list next unless item.code == 108 or item.code == 408 if item.parameters[0] =~ /#{comment} (.*)/ return $1.to_s end end return nil end
def check_command(comment) return false if @list.nil? or @list.size <= 0 for item in @list if item.code == 108 or item.code == 408 if item.parameters[0].include?(comment) return true end end end return false end
end
#------------------------------------------------------------------------------ class Game_Interpreter
# User Overkill always? (if not, you can choose weapons to use overkill) Use_Overkill_Always = true
# Use Steal system Use_Steal = true
# Default Attack Speed Default_Attack_Speed = 30
# Variable used to build battle areas # When each enemy dies, this variable will add +1 # When player be teletransported to another map, this variable will be = 0 again Battle_Area_Variable = 0
# Index of the gold icon when it drops Gold_Drop_Icon_Index = 147
# % of gold drop (0 ~ 100) Gold_Drop_Rate = 75
# Formula: HP + MP + ATK + DEF + SPI + AGI + HIT + EVA * X / 100 # Auto Exp given by enemies (in %) Auto_EXP_Rate = 5
# Auto Gold given by enemies (in %) Auto_Gold_Rate = 10
# Time that items stay in ground (In frames) Drop_Duration_Time = 600
# Animation showed on character when it up level LevelUp_Animation = 40
# Divide the size of animations by Animations_Divide = 3
# Text showed on skill and item window when memorize some skill or item for a hotkey Memorized_Text = "§· x¸c nhËn phÝm nµy!"
# Text showed when a ammo is seted to a hotkey Ammunition_Text = "Ammunition Seted!"
# SE played when gold drop Gold_Drop_SE = "Drop Money"
# SE played when item drop Item_Drop_SE = "Drop Item"
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 confusion? self.note.each_line { |line| return true if line.include?("Confusion") } 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 6 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 hits self.note.each_line { |line| return line.gsub('hits = ', '').chomp.to_s if line.include?('hits = ') } return 1 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 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
def path self.note.each_line { |line| return line.gsub!('Path = ', '').chomp if line.include?('Path = ') } return "Line" end
def atk_character self.note.each_line { |line| return line.gsub!('Attack Character = ', '').chomp if line.include?('Attack Character = ') } return "" end
def atk_index self.note.each_line { |line| return line.gsub('Attack Index = ', '').chomp.to_i if line.include?('Attack Index = ') } return 0 end
def show_icon self.note.each_line { |line| return false if line.include?("Don't Show Icon") } return true end
def attack_speed self.note.each_line { |line| return line.gsub('Attack Speed = ', '').chomp.to_i if line.include?('Attack Speed = ') } return 30 end
def overkilleable self.note.each_line { |line| return true if line.include?("Overkilleable") } return false end
def is_ammo? self.note.each_line { |line| return true if line.include?("Is Ammo") } return false end
def ammo_list list = [] self.note.each_line { |line| if line.include?('Ammos = ') data = line.gsub('Ammos = ', '').chomp.split(",") data.each { |i| list << i.to_i } end } return list end
end
end
#------------------------------------------------------------------------------ # Game Battler #------------------------------------------------------------------------------ class Game_Battler
def calculate_combo(attacker) if attacker.is_a?(Game_Actor) and $Vampyr_SBABS.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+1)) >= 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_Monster) and @defending and rand(100) <= self.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
def check_overkill(user) return false unless user.is_a?(Game_Actor) return false if self.piece.is_a?(Game_Event) and self.piece.boss > 0 if $Vampyr_SBABS.use_overkill_always is_on = true elsif (user.weapons[0] != nil and user.weapons[0].overkilleable) or (user.weapons[1] != nil and user.weapons[1].overkilleable) is_on = true else is_on = false end return false unless is_on return false unless self.is_a?(Game_Enemy) return false if @hp_damage <= (self.hp*3) return false if self.overkill return true end
end
#------------------------------------------------------------------------------ # Game Actor #------------------------------------------------------------------------------ class Game_Actor < Game_Battler
def learn_skill(skill_id) vampyr_sbabs_gactor_learn_skill(skill_id) return unless $Vampyr_SBABS.auto_mount_skills return if $data_skills[skill_id].note.include?("Not Mount") return if @skill_hotkeys.has_value?(skill_id) a = [] for k in @skill_hotkeys.keys.compact next if @skill_hotkeys[k] > 0 a << k end @skill_hotkeys[a.min] = skill_id if a.min != nil end
def forget_skill(skill_id) vampyr_sbabs_gactor_forget_skill(skill_id) return unless $Vampyr_SBABS.auto_mount_skills for k in @skill_hotkeys.keys.compact @skill_hotkeys[k] = 0 if @skill_hotkeys[k] == skill_id end a = [] for k in @skill_hotkeys.keys next if @skill_hotkeys[k] > 0 a << k end b = [] @skills.compact.each { |i| b << i } @skill_hotkeys[a.min] = b[rand(b.size-1)] if a.min != nil end
def attack_speed speed1 = $Vampyr_SBABS.default_attack_speed speed2 = $Vampyr_SBABS.default_attack_speed speed1 = weapons[0].attack_speed if weapons[0] != nil speed2 = weapons[1].attack_speed if weapons[1] != nil return [speed1, speed2].min 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
def move_speed enemy.note.each_line { |line| return line.gsub('Move Speed = ', '').chomp.to_i if line.include?('Move Speed = ') } return 3 end
def follow_range enemy.note.each_line { |line| return line.gsub('Follow Range = ', '').chomp.to_i if line.include?('Follow Range = ') } return 3 end
def respawn enemy.note.each_line { |line| return line.gsub('Respawn = ', '').chomp.to_i if line.include?('Respawn = ') } return 0 end
def attack_speed enemy.note.each_line { |line| return line.gsub('Attack Speed = ', '').chomp.to_i if line.include?('Attack Speed = ') } return $Vampyr_SBABS.default_attack_speed end
def aggressiveness enemy.note.each_line { |line| return line.gsub('Aggressiveness = ', '').chomp.to_i if line.include?('Aggressiveness = ') } return 3 end
def steal_rate enemy.note.each_line { |line| return line.gsub('Steal Rate = ', '').chomp.to_i if line.include?('Steal Rate = ') } return 0 end
def steal_list list = [] enemy.note.each_line { |line| if line.include?('Steal List = ') data = line.gsub('Steal List = ', '').chomp.split(",") for i in data if i[0,1] =~ /i/i list << $data_items[i[1,i.length].to_i] elsif i[0,1] =~ /w/i list << $data_weapons[i[1,i.length].to_i] elsif i[0,1] =~ /a/i list << $data_armors[i[1,i.length].to_i] end end end } return list end
end
#------------------------------------------------------------------------------ # Game Party #------------------------------------------------------------------------------ class Game_Party < Game_Unit
alias vampyr_sbabs_gparty_setup_starting_members setup_starting_members
def setup_starting_members vampyr_sbabs_gparty_setup_starting_members for i in 1...@actors.size next if @actors[i].nil? $game_allies[i] = Game_Ally.new(i) end end
def add_actor(actor_id) if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id) @actors.push(actor_id) $game_player.refresh id = @actors.size-1 if @actors.size > 1 and $Vampyr_SBABS.use_sbabs $game_allies[id] = Game_Ally.new(id) $game_allies[id].moveto($game_player.x, $game_player.y) $game_allies[id].move_random end end $scene.refresh_sprites if $scene.is_a?(Scene_Map) end
def remove_actor(actor_id) change_group_order if members[0].id == actor_id @actors.delete(actor_id) for ally in $game_allies.compact next if ally.actor.id != actor_id ally.destroy = true $game_allies.delete(ally) end $game_player.refresh $scene.refresh_sprites if $scene.is_a?(Scene_Map) end
def change_group_order for ally in $game_allies.compact next if ally.map_id == $game_map.map_id return end return if members.size <= 1 actor = @actors[0] @actors.delete(actor) @actors.compact if all_dead? @actors.insert(0, actor) return end @actors.push(actor) for a in members.compact if a.dead? ally = a @actors.delete(a.id) @actors.push(a.id) else for i in $game_allies.compact next if i.actor != a ally = i end break end end allies = [] for a in $game_allies.compact allies.push(a) end allies.delete(ally) allies.push($game_player) allies.compact for i in 1...members.size next if members[i].nil? next unless $Vampyr_SBABS.use_sbabs $game_allies[i] = Game_Ally.new(i) $game_allies[i].refresh $game_allies[i].moveto(allies[i-1].x, allies[i-1].y) if !allies[i-1].is_a?(Game_Player) $game_allies[i].map_id = allies[i-1].map_id else $game_allies[i].map_id = $game_map.map_id end $game_allies[i].direction = allies[i-1].direction end $game_player.moveto(ally.x, ally.y) unless ally.nil? $game_player.refresh $scene.refresh_sprites if $scene.is_a?(Scene_Map) end
end
#------------------------------------------------------------------------------ # Game Map #------------------------------------------------------------------------------ class Game_Map
alias vampyr_sbabs_gmap_passable passable? alias vampyr_sbabs_gmap_setup_events setup_events
def setup_events vampyr_sbabs_gmap_setup_events $game_monsters.clear for area in $data_areas.values next unless area.map_id == @map_id for i in area.encounter_list for m in $data_troops[i].members $game_monsters.push(Game_Monster.new($game_monsters.size, m.enemy_id, m.id, area)) end end end for i in encounter_list for m in $data_troops[i].members $game_monsters.push(Game_Monster.new($game_monsters.size, m.enemy_id, m.id, nil)) end end end
def range_passable?(x, y, continue=false, flag=0x01) return true if @passages[@map.data[x, y, 0]] == 9 for event in $game_map.events.values return true if continue and x == event.x and y == event.y end for monster in $game_monsters.compact return true if continue and x == monster.x and y == monster.y end passable?(x, y, flag) end
def player_passable?(x, y, flag = 0x01) all_passable?(x, y, flag) end
def monster_passable?(x, y, flag = 0x01) for area in $data_areas.values next unless area.map_id == @map_id next unless area.name =~ /unpassable/i ax = (area.rect.x)...(area.rect.x+area.rect.width) ay = (area.rect.y)...(area.rect.y+area.rect.height) return false if ax.include?(x) and ay.include?(y) end passable?(x, y, flag) end
def passable?(x, y, flag = 0x01) for ally in $game_allies.compact next if ally.character_name == "" return false if ally.x == x and ally.y == y end all_passable?(x, y, flag) end
def all_passable?(x, y, flag = 0x01) for monster in $game_monsters.compact next if monster.actor.dead? return false if monster.x == x and monster.y == y end for drop in $game_drop.compact next if $Vampyr_SBABS.through_drop return false if drop.x == x and drop.y == y end for event in events_xy(x, y) next if event.tile_id == 0 next if event.priority_type > 0 next if event.through pass = @passages[event.tile_id] next if pass & 0x10 == 0x10 return true if pass & flag == 0x00 return false if pass & flag == flag end for i in [2, 1, 0] tile_id = @map.data[x, y, i] return false if tile_id == nil pass = @passages[tile_id] next if pass & 0x10 == 0x10 return true if pass & flag == 0x00 return false if pass & flag == flag end return false end
def update_events for event in @events.values next unless in_range?(event) or event.trigger == 3 or event.trigger == 4 event.update end for common_event in @common_events.values common_event.update end end
def map return @map end
end
#------------------------------------------------------------------------------ # Game Character #------------------------------------------------------------------------------ class Game_Character
alias vampyr_sbabs_gchar_initialize initialize alias vampyr_sbabs_gchar_update update
def update vampyr_sbabs_gchar_update update_graphic_animation 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 @attack_graphic_delay -= 1 if @attack_graphic_delay > 0 @hit_time -= 1 if @hit_time > 0 end
def states_effects return unless is_battler? for state in @actor.states.compact 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 is_enemy? 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
def is_battler? return true if self.is_a?(Game_Player) return true if self.is_a?(Game_Ally) return true if self.is_a?(Game_Monster) return true if self.is_a?(Game_Event) and self.in_battle return false end
def is_enemy? return true if self.is_a?(Game_Monster) return true if self.is_a?(Game_Event) and self.in_battle return false end
def animate_attack(graphic=nil, index=nil) if graphic != nil and graphic != "" and index != nil and index > 0 @old_character_name = @character_name @character_name = graphic @old_character_index = @character_index @character_index = index @old_pattern = @pattern @graphic_changed = true end @attack_graphic_delay = 20 end
def update_graphic_animation if @attack_graphic_delay > (20/3*2) @pattern = 0 elsif @attack_graphic_delay > (20/3) and @attack_graphic_delay <= (20/3*2) @pattern = 1 elsif @attack_graphic_delay > 1 and @attack_graphic_delay <= (20/3*2) @pattern = 2 elsif @attack_graphic_delay <= 1 and @attack_graphic_delay > 0 and @graphic_changed @character_name = @old_character_name @character_index = @old_character_index @pattern = @old_pattern end end
def attack_sound(object) attack_se = [""] if object.is_a?(Game_Player) index = "#{object.actor.name}_Attack" elsif object.is_a?(Game_Monster) or object.is_a?(Game_Event) index = "Enemy#{object.enemy_id}_Attack" end for i in Dir.entries("Audio/SE") next if i == "." or i == ".." next unless i =~ /#{index}-\d/ attack_se << i end se = attack_se[rand(attack_se.size-1)] RPG::SE.new(se).play unless se == "" end
def damage_sound(object) damage_se = [""] if object.is_a?(Game_Player) index = "#{object.actor.name}_Damage" elsif object.is_a?(Game_Monster) or object.is_a?(Game_Event) index = "Enemy#{object.enemy_id}_Damage" end for i in Dir.entries("Audio/SE") next if i == "." or i == ".." next unless i =~ /#{index}-\d/ damage_se << i end se = damage_se[rand(damage_se.size-1)] RPG::SE.new(se).play unless se == "" end
end
#------------------------------------------------------------------------------ # Game Event #------------------------------------------------------------------------------ class Game_Event < Game_Character
alias vampyr_sbabs_gevent_initialize initialize alias vampyr_sbabs_gevent_setup setup alias vampyr_sbabs_gevent_update update alias vampyr_sbabs_gevent_refresh refresh
def setup(new_page) vampyr_sbabs_gevent_setup(new_page) self.original_move_speed = @move_speed end
def update vampyr_sbabs_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 update_steal 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
Script 4 part 2 (Chèn vô cùng script với part 1 nha)
Code:
def flying return true if self.actor != nil and self.actor.enemy.levitate return false end
def make_attack return if $game_map.interpreter.running? return if $game_player.in_vehicle? for action in self.actor.enemy.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 else for ally in $game_allies.compact next unless in_direction?(self, ally) and in_range?(self, ally, self.assigned_skill.range) skill_attack_range end end elsif self.assigned_skill.explosive? if in_direction?(self, $game_player) and in_range?(self, $game_player, self.assigned_skill.range) skill_explode_range elsif action.rating == 10 skill_explode_range else for ally in $game_allies.compact next unless in_direction?(self, ally) and in_range?(self, ally, self.assigned_skill.range) skill_explode_range end end else skill_attack_normal end when 7...12 skill_recover end end end end
def attack_normal return if @puzzle or @object return if self.actor.aggressiveness <= 0 and self.target == nil for ally in $game_allies.compact next unless in_front?(self, ally) self.anime_attack = 20 animate_attack ally.animation_id = self.actor.atk_animation_id ally.actor.attack_effect(self.actor) damage_sound(ally) ally.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed return end return if $game_player.actor.nil? return unless in_front?(self, $game_player) self.anime_attack = 20 animate_attack $game_player.animation_id = self.actor.atk_animation_id $game_player.actor.attack_effect(self.actor) damage_sound($game_player) $game_player.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end
def skill_attack_normal return if @puzzle or @object return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost for ally in $game_allies.compact next unless in_front?(self, ally) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 ally.animation_id = self.assigned_skill.animation_id ally.actor.skill_effect(self.actor, self.assigned_skill) damage_sound(ally) ally.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end return if $game_player.actor.dead? return unless in_front?(self, $game_player) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_player.animation_id = self.assigned_skill.animation_id $game_player.actor.skill_effect(self.actor, self.assigned_skill) damage_sound($game_player) $game_player.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end
def skill_attack_range return if @puzzle return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost unless @object self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 end 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3)) self.weapon1_attack_time = self.assigned_skill.delay RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil end
def skill_explode_range return if @puzzle return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost unless @object self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 end 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4)) self.weapon1_attack_time = self.assigned_skill.delay RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil end
def skill_recover return if @puzzle or @object if self.actor.mp >= self.assigned_skill.mp_cost and self.actor.hp <= (self.actor.maxhp*25/100) unless @puzzle or @object self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 end 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 = self.assigned_skill.delay end for event in $game_map.events.values next unless event.in_battle and in_range?(self, event, 3) next if self.actor.mp < self.assigned_skill.mp_cost and event.actor.hp <= (event.actor.maxhp*25/100) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 = self.assigned_skill.delay end end
def update_steal return unless $Vampyr_SBABS.use_steal return if self.overkill return if self.actor.hp > (self.actor.maxhp*15/100) return unless in_front?($game_player, self) return unless Input.trigger?(Input::C) return if self.stolen self.actor.steal_rate <= 0 return if self.actor.steal_list.empty? return if rand(100) > self.actor.steal_rate item = rand(self.actor.steal_list.size) $game_party.gain_item(self.actor.steal_list[item], 1) $game_player.steal_balloon = self.actor.steal_list[item] self.stolen = true 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 self.overkill = false $game_player.hits = 0 @in_battle = false self.target = nil for ally in $game_allies.compact next if ally.actor.dead? ally.target = $game_player ally.lock_target = false end end
def dying if $Vampyr_SBABS.auto_exp_e_gold and !@puzzle and !@object 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) * $Vampyr_SBABS.auto_exp_rate / 100 else exp = self.actor.exp end exp = (exp*1.5) if self.overkill unless @puzzle if $Vampyr_SBABS.divide_exp x = (exp/$game_party.members.size) for i in $game_party.members i.gain_exp(x, true) unless @puzzle or @object end else self.target.actor.gain_exp(exp, true) unless @puzzle or @object end $game_player.reward = "Exp: #{exp.to_f}" make_drop end @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 elsif !@puzzle Sound.play_enemy_collapse end if $Vampyr_SBABS.battle_area_variable > 0 $game_variables[$Vampyr_SBABS.battle_area_variable] += 1 $game_map.need_refresh = true 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 i in droped_items.compact $game_drop.push(Game_Drop.new(self, i.icon_index, i, 0)) end if $Vampyr_SBABS.auto_exp_e_gold and @boss <= 0 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) * $Vampyr_SBABS.auto_gold_rate / 100 else gold = self.actor.gold end if gold > 0 and rand(100) <= $Vampyr_SBABS.gold_drop_rate $game_drop.push(Game_Drop.new(self, $Vampyr_SBABS.gold_drop_icon_index, nil, gold)) end end
def update_self_movement return if self.actor != nil and self.actor.dead? return if self.freeze or (self.anime_attack/2) > 0 return unless @stop_count > 30 * (5 - @move_frequency) if self.puzzle or self.object self.target = nil elsif @in_battle and in_range?(self, $game_player, @follow_range) and !self.lock_target unless self.actor.aggressiveness <= 0 and self.target == nil self.target = $game_player self.lock_target = true end end for ally in $game_allies.compact next if self.puzzle or self.object if @in_battle and in_range?(self, ally, @follow_range) and !ally.actor.dead? and !self.lock_target and !(self.actor.aggressiveness <= 0 and self.target != nil) unless self.actor.aggressiveness <= 0 and self.target == nil self.target = ally self.lock_target = true end elsif self.target == ally and ally.actor.dead? and self.lock_target self.target = nil self.lock_target = false end end if can_follow? if self.actor.aggressiveness <= 0 and self.target != nil move_type_toward(self.target) elsif rand(5) < self.actor.aggressiveness move_toward(self.target) else move_away_from(self.target) end else case @move_type when 1 move_type_random when 2 move_type_toward_player when 3 move_type_custom end end end
def can_follow? return false unless @auto_follow return true if @in_battle and self.target != nil and in_range?(self, self.target, @follow_range) return false end
def map_passable?(x, y) if @in_battle return $game_map.monster_passable?(x, y) else return $game_map.passable?(x, y) end end
end
#------------------------------------------------------------------------------ # Game Player #------------------------------------------------------------------------------ class Game_Player < Game_Character
alias vampyr_sbabs_gplayer_initialize initialize alias vampyr_sbabs_gplayer_refresh refresh alias vampyr_sbabs_gplayer_update update alias vampyr_sbabs_gplayer_move_by_input move_by_input alias vampyr_sbabs_gplayer_perform_transfer perform_transfer
def update vampyr_sbabs_gplayer_update return if self.actor.nil? return if $game_map.interpreter.running? return if in_vehicle? attack_with_1st_weapon attack_with_2nd_weapon attack_with_skill attack_with_item auto_recovery update_battle_bgm @hits = 0 if self.hit_time <= 0 and @hits > 0 if $Vampyr_SBABS.next_actor_if_dead $game_temp.next_scene = "gameover" if $game_party.all_dead? $game_party.change_group_order if self.actor.dead? and !$game_party.all_dead? elsif self.actor.dead? $game_temp.next_scene = "gameover" end if Input.trigger?($Vampyr_SBABS.group_order_key) and !Input.press?(Input::CTRL) and $Vampyr_SBABS.change_group_order $game_party.change_group_order end end
def update_battle_bgm return unless $Vampyr_SBABS.auto_battle_bgm enemies = [] for event in $game_map.events.values next unless event.in_battle if event.actor.dead? or !in_range?(self, event, 10) enemies.delete(event) next end enemies << event if in_range?(self, event, 10) end for monster in $game_monsters if monster.actor.dead? or !in_range?(self, monster, 10) enemies.delete(monster) next end enemies << monster if in_range?(self, monster, 10) end @fighting = (!enemies.empty?) if !@battle_bgm_playing and @fighting $game_temp.map_bgm = RPG::BGM.last Sound.play_battle_start $game_system.battle_bgm.play @battle_bgm_playing = true elsif @battle_bgm_playing and !@fighting $game_temp.map_bgm.play @battle_bgm_playing = false end end
def attack_with_1st_weapon if Input.trigger?($Vampyr_SBABS.attack_key1) return if !$Vampyr_SBABS.allow_attack_with_shield and self.actor.defending return if self.weapon1_attack_time > 0 @attack_weapon = self.actor.equips[0] if @attack_weapon != nil and @attack_weapon.shot_se != nil and @attack_weapon.ammo1 != nil and $game_party.has_item?(@attack_weapon.ammo1) RPG::SE.new(@attack_weapon.shot_se).play end if @attack_weapon != nil if @attack_weapon.show_icon self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false end animate_attack(@attack_weapon.atk_character, @attack_weapon.atk_index) else animate_attack(nil, nil) end if @attack_weapon != nil and @attack_weapon.ranged? range_attack_right self.weapon1_attack_time = (self.actor.two_swords_style ? @attack_weapon.delay : self.actor.attack_speed) self.hit_time = self.weapon1_attack_time + 30 else normal_attack_right self.weapon1_attack_time = (self.actor.two_swords_style ? @attack_weapon.delay : self.actor.attack_speed) self.hit_time = self.weapon1_attack_time + 30 end end end
def attack_with_2nd_weapon if Input.press?($Vampyr_SBABS.attack_key2) self.actor.defending = (self.actor.equips[1].is_a?(RPG::Armor) and $Vampyr_SBABS.allow_shields_graphics) else self.actor.defending = false end if Input.trigger?($Vampyr_SBABS.attack_key2) return if self.weapon2_attack_time > 0 return if !$Vampyr_SBABS.allow_attack_with_shield and self.actor.defending @attack_weapon_and_Shield = self.actor.equips[1] if @attack_weapon_and_Shield != nil and @attack_weapon_and_Shield.shot_se != nil and @attack_weapon_and_Shield.ammo2 != nil and $game_party.has_item?(@attack_weapon_and_Shield.ammo2) RPG::SE.new(@attack_weapon_and_Shield.shot_se).play end if @attack_weapon_and_Shield != nil if @attack_weapon_and_Shield.show_icon self.anime_attack = 20 self.right_attack_on = false self.left_attack_on = true end animate_attack(@attack_weapon_and_Shield.atk_character, @attack_weapon_and_Shield.atk_index) elsif self.actor.two_swords_style animate_attack(nil, nil) end if @attack_weapon_and_Shield != nil and @attack_weapon_and_Shield.ranged? range_attack_left self.weapon2_attack_time = (self.actor.two_swords_style ? @attack_weapon_and_Shield.delay : self.actor.attack_speed) self.hit_time = self.weapon2_attack_time + 30 elsif self.actor.two_swords_style normal_attack_left self.weapon2_attack_time = (self.actor.two_swords_style ? @attack_weapon_and_Shield.delay : self.actor.attack_speed) self.hit_time = self.weapon1_attack_time + 30 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 !$Vampyr_SBABS.allow_attack_with_shield and self.actor.defending self.assigned_skill = $data_skills[self.actor.skill_hotkeys[button]] if self.assigned_skill != nil self.anime_attack = 20 animate_attack(self.assigned_skill.atk_character, self.assigned_skill.atk_index) end if self.assigned_skill.scope == 2 skill_attack_all elsif self.assigned_skill.ranged? skill_attack_range elsif self.assigned_skill.explosive? skill_explode_range elsif self.assigned_skill.scope >= 7 skill_recover elsif self.assigned_skill.scope >= 3 skill_around 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 !$Vampyr_SBABS.allow_attack_with_shield and self.actor.defending @assigned_item = $data_items[self.actor.item_hotkeys[button]] if @assigned_item != nil self.anime_attack = 20 animate_attack(@assigned_item.atk_character, @assigned_item.atk_index) end 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 attack_sound(self) if self.actor.equips[0] != nil for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? next if monster.flying and !jumping? monster.animation_id = self.actor.atk_animation_id hit_count monster.actor.attack_effect(self.actor) monster.jump(0,0) monster.target = self end 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 if event.flying and !jumping? event.animation_id = self.actor.atk_animation_id return if event.kill_with_skill > 0 return if event.kill_with_item > 0 return if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon.id hit_count unless event.puzzle event.actor.attack_effect(self.actor) event.jump(0,0) unless event.puzzle event.target = self end end
def range_attack_right return if self.actor.equips[0] == nil ammo = @actor.ammos[self.actor.equips[0].id] return if ammo == nil return unless $game_party.has_item?(ammo) attack_sound(self) $game_party.consume_item(ammo) $game_range.push(Game_Range.new(self, ammo.graphic, ammo.index, ammo.move_speed, ammo.range, 1)) end
def normal_attack_left attack_sound(self) if self.actor.equips[1] != nil for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? next if monster.flying and !jumping? monster.animation_id = self.actor.atk_animation_id2 hit_count monster.actor.attack_effect(self.actor) damage_sound(monster) monster.jump(0,0) monster.target = self end 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 if event.flying and !jumping? event.animation_id = self.actor.atk_animation_id2 return if event.kill_with_skill > 0 return if event.kill_with_item > 0 return if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon_and_Shield.id hit_count unless event.puzzle event.actor.attack_effect(self.actor) damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end end
def range_attack_left return unless self.actor.equips[1].is_a?(RPG::Weapon) ammo = @actor.ammos[self.actor.equips[1].id] return if ammo == nil return unless $game_party.has_item?(ammo) attack_sound(self) $game_party.consume_item(ammo) $game_range.push(Game_Range.new(self, ammo.graphic, ammo.index, ammo.move_speed, ammo.range, 2)) end
def skill_attack_normal return if self.actor.mp < self.assigned_skill.mp_cost self.actor.mp -= self.actor.calc_mp_cost(self.assigned_skill) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 $game_temp.common_event_id = self.assigned_skill.common_event_id if self.assigned_skill.common_event_id > 0 for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? next if monster.flying and !jumping? monster.animation_id = self.assigned_skill.animation_id monster.actor.skill_effect(self.actor, self.assigned_skill) hit_count damage_sound(monster) monster.jump(0,0) monster.target = self end 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 if event.flying and !jumping? event.animation_id = self.assigned_skill.animation_id next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) hit_count unless event.puzzle damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end self.skill_attack_time = self.assigned_skill.delay self.hit_time = self.skill_attack_time + 30 end
def skill_attack_all return if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 monster in $game_monsters.compact next if monster.actor.dead? monster.animation_id = self.assigned_skill.animation_id self.skill_attack_time = self.assigned_skill.delay monster.actor.skill_effect(self.actor, self.assigned_skill) hit_count damage_sound(monster) monster.jump(0,0) monster.target = self end 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 = self.assigned_skill.delay next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) hit_count unless event.puzzle damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end self.hit_time = self.skill_attack_time + 30 end
def skill_around return if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 monster in $game_monsters next if monster.actor.dead? next unless monster.in_range?(self, monster, self.assigned_skill.area) monster.animation_id = self.assigned_skill.animation_id monster.actor.skill_effect(self.actor, self.assigned_skill) hit_count damage_sound(monster) monster.jump(0,0) monster.target = self end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next unless event.in_range?(self, event, self.assigned_skill.area) event.animation_id = self.assigned_skill.animation_id next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) hit_count unless event.puzzle damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end self.skill_attack_time = self.assigned_skill.delay self.hit_time = self.skill_attack_time + 30 end
def item_normal_attack 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 for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? next if monster.flying and !jumping? monster.animation_id = @assigned_item.animation_id monster.actor.item_effect(self.actor, @assigned_item) hit_count damage_sound(monster) monster.jump(0,0) monster.target = self end 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 if event.flying and !jumping? event.animation_id = @assigned_item.animation_id next if event.kill_with_weapon > 0 next if event.kill_with_skill > 0 next if event.kill_with_item > 0 and event.kill_with_item != self.assigned_item.id event.actor.item_effect(self.actor, @assigned_item) hit_count unless event.puzzle damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end self.item_attack_time = @assigned_item.delay self.hit_time = self.item_attack_time + 30 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 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 for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? monster.animation_id = @assigned_item.animation_id monster.actor.item_effect(self.actor, @assigned_item) hit_count damage_sound(monster) monster.jump(0,0) monster.target = self end 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 next if event.kill_with_weapon > 0 next if event.kill_with_skill > 0 next if event.kill_with_item > 0 and event.kill_with_item != self.assigned_item.id event.actor.item_effect(self.actor, @assigned_item) hit_count unless event.puzzle damage_sound(event) event.jump(0,0) unless event.puzzle event.target = self end self.item_attack_time = @assigned_item.delay self.hit_time = self.item_attack_time + 30 end
def item_attack_bomb 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_bomb.push(Game_Bomb.new(self, @assigned_item)) self.item_attack_time = 60 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 vampyr_sbabs_gplayer_perform_transfer for range in $game_range.compact range.destroy = true end for drop in $game_drop.compact drop.destroy = true end for bomb in $game_bomb.compact bomb.destroy = true end for ally in $game_allies.compact ally.perform_transfer(@new_map_id, @new_x, @new_y, @new_direction) unless ally.actor.dead? ally.refresh end $game_variables[$Vampyr_SBABS.battle_area_variable] = 0 if $Vampyr_SBABS.battle_area_variable > 0 end
def map_passable?(x, y) case @vehicle_type when 0 return $game_map.boat_passable?(x, y) when 1 return $game_map.ship_passable?(x, y) when 2 return true else return $game_map.player_passable?(x, y) end end
def move_by_input return if self.freeze or (self.anime_attack/2) > 0 if self.actor != nil for state in self.actor.states.compact next unless state.confusion? return unless movable? return if $game_map.interpreter.running? case Input.dir4 when 2,4,6,8 move_random end return end end vampyr_sbabs_gplayer_move_by_input end
end
#------------------------------------------------------------------------------ # Game Ally #------------------------------------------------------------------------------ class Game_Ally < Game_Character
def update super return if @destroy if self.actor.dead? and !@dead refresh @dead = true elsif !self.actor.dead? and @dead refresh @dead = false end if $game_player.in_vehicle? and !@in_vehicle and !self.actor.defending refresh @in_vehicle = true elsif !$game_player.in_vehicle? and @in_vehicle refresh moveto($game_player.x, $game_player.y) unless self.actor.dead? @in_vehicle = false end return if self.actor.nil? or self.actor.dead? or $game_player.in_vehicle? self.actor.defending = (@command == 2 ? true : false) make_action auto_recovery update_movement end
def refresh self.actor = $game_party.members[@id] self.actor.piece = self if $game_player.in_vehicle? and !self.actor.dead? and !self.actor.defending @character_name = "" elsif self.actor.dead? if File.exists?("Graphics/Characters/$#{self.actor.name}_dead.png") and @map_id == $game_map.map_id @character_name = "$#{self.actor.name}_dead" @character_index = 0 else @character_name = "" end elsif @map_id != $game_map.map_id @character_name = "" else @character_name = self.actor.character_name @character_index = self.actor.character_index end end
def make_action return if $game_map.interpreter.running? return if self.actor.dead? case @command when 0 if self.actor.weapons[0] != nil and self.actor.weapons[0].ranged? and self.weapon1_attack_time <= 0 weapon_range_attack self.weapon1_attack_time = self.actor.weapons[0].delay else if self.actor.two_swords_style if self.weapon1_attack_time <= 0 and rand(100) <= 50 normal_attack_right self.weapon1_attack_time = self.actor.attack_speed elsif self.weapon1_attack_time <= 0 and rand(100) > 50 normal_attack_left self.weapon1_attack_time = self.actor.attack_speed end elsif self.weapon1_attack_time <= 0 normal_attack_right self.weapon1_attack_time = self.actor.attack_speed end end when 1 return if self.skill_attack_time > 0 or self.actor.skills == [] self.assigned_skill = self.actor.skills[rand(self.actor.skills.size)] case self.assigned_skill.scope when 1 if self.assigned_skill.ranged? skill_attack_range elsif self.assigned_skill.explosive? skill_explode_range else skill_attack_normal end when 2 skill_attack_all when 3...7 if self.assigned_skill.ranged? skill_attack_range elsif self.assigned_skill.explosive? skill_explode_range elsif self.assigned_skill.scope >= 7 skill_recover elsif self.assigned_skill.scope >= 3 skill_around else skill_attack_normal end end when 3 for skill in self.actor.skills self.assigned_skill = skill case self.assigned_skill.scope when 7...12 skill_recover end end end end
def normal_attack_right for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? jump(0, 0) if monster.flying self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false monster.animation_id = self.actor.atk_animation_id monster.actor.attack_effect(self.actor) monster.jump(0,0) monster.target = self end 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 jump(0, 0) if event.flying self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false event.animation_id = self.actor.atk_animation_id next if event.kill_with_skill > 0 next if event.kill_with_item > 0 next if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon.id event.actor.attack_effect(self.actor) event.jump(0,0) unless event.puzzle event.target = self end end
def weapon_range_attack for monster in $game_monsters next unless in_direction?(self, monster) and in_range?(self, monster, self.actor.weapons[0].range) next if monster.actor.dead? self.actor.ammos.clear ammos = [] self.actor.weapons[0].ammo_list.each { |i| ammos << $data_items[i] } ammo = ammos[rand(ammos.size)] next unless $game_party.has_item?(ammo) self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false jump(0, 0) if monster.flying $game_party.consume_item(ammo) self.actor.ammos[self.actor.weapons[0].id] = ammo $game_range.push(Game_Range.new(self, ammo.graphic, ammo.index, ammo.move_speed, ammo.range, 1)) self.weapon1_attack_time = self.actor.equips[0].delay end for event in $game_map.events.values next unless event.in_battle next unless in_direction?(self, event) and in_range?(self, event, self.actor.weapons[0].range) next if event.actor.dead? or event.object self.actor.ammos.clear ammos = [] self.actor.weapons[0].ammo_list.each { |i| ammos << $data_items[i] } ammo = ammos[rand(ammos.size)] next unless $game_party.has_item?(ammo) self.anime_attack = 20 self.right_attack_on = true self.left_attack_on = false jump(0, 0) if event.flying $game_party.consume_item(ammo) self.actor.ammos[self.actor.weapons[0].id] = ammo $game_range.push(Game_Range.new(self, ammo.graphic, ammo.index, ammo.move_speed, ammo.range, 1)) self.weapon1_attack_time = self.actor.equips[0].delay end end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
def range_attack_right return if @attack_weapon.ammo1 != nil and !$game_party.has_item?(@attack_weapon.ammo1) $game_party.consume_item(@attack_weapon.ammo1) if @attack_weapon.ammo1 != nil $game_range.push(Game_Range.new(self, @attack_weapon.graphic, @attack_weapon.index, @attack_weapon.move_speed, @attack_weapon.range, 1)) end
def normal_attack_left for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? jump(0, 0) if monster.flying self.anime_attack = 20 self.right_attack_on = false self.left_attack_on = true monster.animation_id = self.actor.atk_animation_id2 monster.actor.attack_effect(self.actor) monster.jump(0,0) monster.target = self end 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 jump(0, 0) if event.flying self.anime_attack = 20 self.right_attack_on = false self.left_attack_on = true event.animation_id = self.actor.atk_animation_id2 next if event.kill_with_skill > 0 next if event.kill_with_item > 0 next if event.kill_with_weapon > 0 and event.kill_with_weapon != @attack_weapon_and_Shield.id event.actor.attack_effect(self.actor) event.jump(0,0) unless event.puzzle event.target = self end end
def range_attack_left return if @attack_weapon_and_Shield.ammo2 != nil and !$game_party.has_item?(@attack_weapon_and_Shield.ammo2) $game_party.consume_item(@attack_weapon_and_Shield.ammo2) if @attack_weapon_and_Shield.ammo2 != nil $game_range.push(Game_Range.new(self, @attack_weapon_and_Shield.graphic, @attack_weapon_and_Shield.index, @attack_weapon_and_Shield.move_speed, @attack_weapon_and_Shield.range, 2)) end
def skill_attack_normal for monster in $game_monsters.compact next unless in_front?(self, monster) next if monster.actor.dead? next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 jump(0, 0) if monster.flying monster.animation_id = self.assigned_skill.animation_id monster.actor.skill_effect(self.actor, self.assigned_skill) monster.jump(0,0) monster.target = self self.skill_attack_time = self.assigned_skill.delay end 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 if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 jump(0, 0) if event.flying event.animation_id = self.assigned_skill.animation_id next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if 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 event.target = self self.skill_attack_time = self.assigned_skill.delay end end
def skill_attack_range for monster in $game_monsters.compact next if monster.actor.dead? next if monster.flying and !jumping? next unless in_direction?(self, monster) and in_range?(self, monster, self.assigned_skill.range) return if 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 self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3)) RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil self.skill_attack_time = self.assigned_skill.delay end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next self.actor.mp < self.assigned_skill.mp_cost next unless in_direction?(self, event) and in_range?(self, event, self.assigned_skill.range) return if 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 self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3)) RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil self.skill_attack_time = self.assigned_skill.delay end end
def skill_attack_all for monster in $game_mosnters.compact next if monster.actor.dead? next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 monster.animation_id = self.assigned_skill.animation_id monster.actor.skill_effect(self.actor, self.assigned_skill) monster.jump(0,0) monster.target = self self.skill_attack_time = self.assigned_skill.delay end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if 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 event.target = self self.skill_attack_time = self.assigned_skill.delay end end
def skill_explode_range for monster in $game_monsters.compact next if monster.actor.dead? next if monster.flying and !jumping? next unless in_direction?(self, monster) and in_range?(self, monster, self.assigned_skill.range) next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4)) RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil self.skill_attack_time = self.assigned_skill.delay end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next if event.flying and !jumping? next unless in_direction?(self, event) and in_range?(self, event, self.assigned_skill.range) next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4)) RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil self.skill_attack_time = self.assigned_skill.delay end end
def skill_around for monster in $game_monsters next if monster.actor.dead? next unless monster.in_range?(self, monster, self.assigned_skill.area) next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 monster.actor.skill_effect(self.actor, self.assigned_skill) monster.animation_id = self.assigned_skill.animation_id monster.target = self self.skill_attack_time = self.assigned_skill.delay end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? next unless event.in_range?(self, event, self.assigned_skill.area) next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 next if event.kill_with_weapon > 0 next if event.kill_with_item > 0 next if event.kill_with_skill > 0 and event.kill_with_skill != self.assigned_skill.id event.actor.skill_effect(self.actor, self.assigned_skill) event.animation_id = self.assigned_skill.animation_id event.target = self self.skill_attack_time = self.assigned_skill.delay end end
def skill_recover for person in $game_party.members next unless person.hp <= (person.maxhp/4) next if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 person.skill_effect(person, self.assigned_skill) person.piece.animation_id = self.assigned_skill.animation_id self.skill_attack_time = self.assigned_skill.delay end end
def update_movement return if $game_map.interpreter.running? return if moving? return if self.freeze or (self.anime_attack/2) > 0 if $game_player.dash? and self.target == $game_player @move_speed = 5 else @move_speed = self.original_move_speed end if @target.nil? or @command >= 2 self.target = $game_player else for monster in $game_monsters.compact next if monster.actor.dead? if in_range?(self, monster, 3) and !self.lock_target self.target = monster self.lock_target = true elsif !self.lock_target self.target = $game_player end end for event in $game_map.events.values if event.in_battle and in_range?(self, event, 3) and !self.lock_target next if event.object or event.puzzle self.target = event self.lock_target = true elsif !self.lock_target self.target = $game_player end end end move_toward(self.target) end
def perform_transfer(map_id, x, y, dir) @map_id = map_id set_direction(dir) moveto(x, y) move_random self.target = $game_player self.lock_target = false end
def screen_z return $game_player.screen_z-1 end
def in_vehicle? return $game_player.in_vehicle? end
end
#------------------------------------------------------------------------------ # Game Monster #------------------------------------------------------------------------------ class Game_Monster < Game_Character
def set_start_position if @area != nil x = []; y = [] for i in (@area.rect.x)...(@area.rect.x+@area.rect.width) x << i end for i in (@area.rect.y)...(@area.rect.y+@area.rect.height) y << i end @x_pos = x[rand(x.size)] @y_pos = y[rand(y.size)] else @x_pos = rand($game_map.width) @y_pos = rand($game_map.height) end end
def empty_area? for area in $data_areas.values next if area.map_id != $game_map.map_id next unless area.name =~ /empty/i or area.name =~ /unpassable/i x = (area.rect.x)...(area.rect.x+area.rect.width) y = (area.rect.y)...(area.rect.y+area.rect.height) return true if x.include?(@x_pos) and y.include?(@y_pos) end return false end
def refresh @character_name = self.actor.character_name @character_index = self.actor.character_index if flying @priority_type = 2 @step_anime = true end end
def update super if !self.actor.dead? update_attack update_steal else update_dying end end
def flying return true if self.actor != nil and self.actor.enemy.levitate return false end
def update_attack return if $game_map.interpreter.running? return if $game_player.in_vehicle? for action in self.actor.enemy.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 else for ally in $game_allies.compact next unless in_direction?(self, ally) and in_range?(self, ally, self.assigned_skill.range) skill_attack_range end end elsif self.assigned_skill.explosive? if in_direction?(self, $game_player) and in_range?(self, $game_player, self.assigned_skill.range) skill_explode_range elsif action.rating == 10 skill_explode_range else for ally in $game_allies.compact next unless in_direction?(self, ally) and in_range?(self, ally, self.assigned_skill.range) skill_explode_range end end else skill_attack_normal end when 7...12 skill_recover end end end end
def attack_normal return if self.actor.aggressiveness <= 0 and self.target == nil for ally in $game_allies.compact next unless in_front?(self, ally) attack_sound(self) self.anime_attack = 20 animate_attack ally.animation_id = self.actor.atk_animation_id ally.actor.attack_effect(self.actor) damage_sound(ally) ally.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed return end return unless in_front?(self, $game_player) attack_sound(self) self.anime_attack = 20 animate_attack $game_player.animation_id = self.actor.atk_animation_id $game_player.actor.attack_effect(self.actor) damage_sound($game_player) $game_player.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end
def skill_attack_normal return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost for ally in $game_allies.compact next unless in_front?(self, ally) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 ally.animation_id = self.assigned_skill.animation_id ally.actor.skill_effect(self.actor, self.assigned_skill) damage_sound(ally) ally.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end return if $game_player.actor.nil? return unless in_front?(self, $game_player) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_player.animation_id = self.assigned_skill.animation_id $game_player.actor.skill_effect(self.actor, self.assigned_skill) damage_sound($game_player) $game_player.jump(0,0) self.weapon1_attack_time = self.actor.attack_speed end
def skill_attack_range return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 3)) self.weapon1_attack_time = self.assigned_skill.delay RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil end
def skill_explode_range return if self.actor.aggressiveness <= 0 and self.target == nil return if self.actor.mp < self.assigned_skill.mp_cost self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 $game_range.push(Game_Range.new(self, self.assigned_skill.graphic, self.assigned_skill.index, self.assigned_skill.move_speed, self.assigned_skill.range, 4)) self.weapon1_attack_time = self.assigned_skill.delay RPG::SE.new(self.assigned_skill.shot_se).play if self.assigned_skill.shot_se != nil end
def skill_recover if self.actor.mp >= self.assigned_skill.mp_cost and self.actor.hp <= (self.actor.maxhp*25/100) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 = self.actor.attack_speed end for event in $game_map.events.values next unless event.in_battle and in_range?(self, event, 3) next unless self.actor.mp >= self.assigned_skill.mp_cost and event.actor.hp <= (event.actor.maxhp*25/100) self.message1 = self.assigned_skill.message1 self.message2 = self.assigned_skill.message2 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 = self.actor.attack_speed end end
def update_steal return unless $Vampyr_SBABS.use_steal return if self.overkill return if self.actor.hp > (self.actor.maxhp*15/100) return unless in_front?($game_player, self) return unless Input.trigger?(Input::C) return if self.stolen self.actor.steal_rate <= 0 return if self.actor.steal_list.empty? return if rand(100) > self.actor.steal_rate item = rand(self.actor.steal_list.size) $game_party.gain_item(self.actor.steal_list[item], 1) $game_player.steal_balloon = self.actor.steal_list[item] self.stolen = true end
def update_dying @blend_type = 2 @opacity -= 5 get_rewards unless @killed if @opacity <= 0 and !@destroy $game_player.hits = 0 self.overkill = false for ally in $game_allies.compact next if ally.actor.dead? ally.target = $game_player ally.lock_target = false end self.target = nil @destroy = true end if @destroy and @respawn > 0 @respawn -= 1 setup_monster if @respawn <= 0 end end
def get_rewards if $Vampyr_SBABS.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) * $Vampyr_SBABS.auto_exp_rate / 100 else exp = self.actor.exp end exp = (exp*1.5) if self.overkill if $Vampyr_SBABS.divide_exp x = (exp/$game_party.members.size) for i in $game_party.members i.gain_exp(x, true) end else self.target.actor.gain_exp(exp, true) end $game_player.reward = "Exp: #{exp.to_f}" 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 i in droped_items.compact $game_drop.push(Game_Drop.new(self, i.icon_index, i, 0)) end if $Vampyr_SBABS.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) * $Vampyr_SBABS.auto_gold_rate / 100 else gold = self.actor.gold end if gold > 0 and rand(100) <= $Vampyr_SBABS.gold_drop_rate $game_drop.push(Game_Drop.new(self, $Vampyr_SBABS.gold_drop_icon_index, nil, gold)) end @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 if $Vampyr_SBABS.battle_area_variable > 0 $game_variables[$Vampyr_SBABS.battle_area_variable] += 1 $game_map.need_refresh = true end @killed = true end
def update_self_movement return if moving? return if self.actor.dead? return if self.freeze or (self.anime_attack/2) > 0 return unless @stop_count > 30 * (5 - @move_frequency) if in_range?(self, $game_player, self.actor.follow_range) and !self.lock_target unless self.actor.aggressiveness <= 0 and self.target == nil self.target = $game_player self.lock_target = true end end for ally in $game_allies.compact if in_range?(self, ally, self.actor.follow_range) and !ally.actor.dead? and !self.lock_target and !(self.actor.aggressiveness <= 0 and self.target == nil) unless self.actor.aggressiveness <= 0 and self.target == nil self.target = ally self.lock_target = true end elsif self.target == ally and ally.actor.dead? and self.lock_target self.target = nil self.lock_target = false end end if self.target != nil and in_range?(self, self.target, self.actor.follow_range) if self.actor.aggressiveness <= 0 and self.target != nil move_type_toward(self.target) elsif rand(5) < self.actor.aggressiveness move_toward(self.target) else move_away_from(self.target) end else move_type_random end end
def map_passable?(x, y) return $game_map.monster_passable?(x, y) end
end
#------------------------------------------------------------------------------ # Game Range #------------------------------------------------------------------------------ class Game_Range < Game_Character
def initialize(parent, chara_name="", chara_index=0, speed=4, range=5, type=3) super() @parent = parent @character_name = chara_name @character_index = chara_index @move_speed = speed @range = range @type = type @step = 0 @hits_delay = 0 @destroy = false @draw = false @moving = false @continue_moving = false @direction = @parent.direction moveto(@parent.x, @parent.y) case @type when 1 @item = @parent.actor.weapons[0] when 2 @item = @parent.actor.weapons[1] when 3...5 @item = @parent.assigned_skill when 5...7 @item = @parent.assigned_item end define_movement end
def update super return if @destroy @hits_delay -= 1 if @hits_delay > 0 @destroy = (@step > @range) return unless stopping? move_type_custom check_event_trigger_touch(@x, @y) unless jumping? @step += 1 end
def define_movement case @item.path when "Line" @move_route = RPG::MoveRoute.new for i in 0...@range @move_route.list.insert(0, RPG::MoveCommand.new(12)) end when "Boom" @continue_moving = true @move_route = RPG::MoveRoute.new @move_route.list = [ RPG::MoveCommand.new(12), RPG::MoveCommand.new(12), RPG::MoveCommand.new(12), RPG::MoveCommand.new(12), RPG::MoveCommand.new(12), RPG::MoveCommand.new(13), RPG::MoveCommand.new(13), RPG::MoveCommand.new(13), RPG::MoveCommand.new(13), RPG::MoveCommand.new(13), RPG::MoveCommand.new()] @range = @move_route.list.size-1 when "Circle" @continue_moving = true $game_player.anime_attack = 60 @move_route = RPG::MoveRoute.new @move_route.list = [ RPG::MoveCommand.new(4), RPG::MoveCommand.new(2), RPG::MoveCommand.new(1), RPG::MoveCommand.new(1), RPG::MoveCommand.new(3), RPG::MoveCommand.new(3), RPG::MoveCommand.new(4), RPG::MoveCommand.new(4), RPG::MoveCommand.new(2), RPG::MoveCommand.new()] @range = @move_route.list.size-1 when "Jump" @move_route = RPG::MoveRoute.new case @parent.direction when 2; dir = 0, 3 when 4; dir = -3, 0 when 6; dir = 3, 0 when 8; dir = 0, -3 end @move_route.list = [ RPG::MoveCommand.new(14, [dir[0], dir[1]]), RPG::MoveCommand.new()] when "Random" @continue_moving = true @move_route = RPG::MoveRoute.new for i in 0...@range @move_route.list.insert(0, RPG::MoveCommand.new(9)) end when "Stopped" @continue_moving = true @move_route = RPG::MoveRoute.new move_forward @range = 60 end @move_route.skippable = true end
def check_event_trigger_touch(x, y) return if @destroy if @parent.is_a?(Game_Event) or @parent.is_a?(Game_Monster) case @type when 3 $game_allies.compact.each { |i| hurt_hero_skill(i) if i.pos?(x, y) } hurt_hero_skill($game_player) if $game_player.pos?(x, y) when 4 $game_allies.compact.each { |i| hurt_hero_skill_explode if i.pos?(x, y) } hurt_hero_skill_explode if $game_player.pos?(x, y) end return end for monster in $game_monsters.compact next unless monster.pos?(x, y) case @type when 1 hurt_monster_weapon_right(monster) when 2 hurt_monster_weapon_left(monster) when 3 hurt_monster_skill(monster) when 4 hurt_enemy_skill_explode when 5 hurt_monster_item(monster) when 6 hurt_enemy_item_explode end 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_hero_skill(hero) return if @hits_delay > 0 return if hero.actor.dead? hero.animation_id = @parent.assigned_skill.animation_id hero.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound(hero) @destroy = true unless @continue_moving end
def hurt_hero_skill_explode return if @hits_delay > 0 for ally in $game_allies.compact next unless in_range?(self, ally, @parent.assigned_skill.range) next if ally.actor.dead? ally.animation_id = @parent.assigned_skill.animation_id ally.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound(ally) end if in_range?(self, $game_player, @parent.assigned_skill.range) and !$game_player.actor.dead? $game_player.animation_id = @parent.assigned_skill.animation_id $game_player.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound($game_player) end @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_weapon_right(enemy) return if @hits_delay > 0 return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.actor.ammos[@parent.actor.weapons[0].id].animation_id return if enemy.kill_with_skill > 0 return if enemy.kill_with_item > 0 return if enemy.kill_with_weapon > 0 and enemy.kill_with_weapon != @parent.actor.weapon_id @parent.hit_count if @parent.is_a?(Game_Player) and !enemy.puzzle enemy.actor.attack_effect(@parent.actor) damage_sound(enemy) enemy.jump(0,0) unless enemy.puzzle enemy.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_weapon_left(enemy) return if @hits_delay > 0 return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.actor.ammos[@parent.actor.weapons[1].id].animation_id return if enemy.kill_with_skill > 0 return if enemy.kill_with_item > 0 return if enemy.kill_with_weapon > 0 and enemy.kill_with_weapon != @weapon.id @parent.hit_count if @parent.is_a?(Game_Player) and !enemy.puzzle enemy.actor.attack_effect(@parent.actor) damage_sound(enemy) enemy.jump(0,0) unless enemy.puzzle enemy.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_skill(enemy) return if @hits_delay > 0 return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.assigned_skill.animation_id return if enemy.kill_with_weapon > 0 return if enemy.kill_with_item > 0 return if enemy.kill_with_skill > 0 and enemy.kill_with_skill != @parent.assigned_skill.id @parent.hit_count if @parent.is_a?(Game_Player) and !enemy.puzzle enemy.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound(enemy) enemy.jump(0,0) unless enemy.puzzle enemy.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_item(enemy) return if @hits_delay > 0 return if enemy.actor.dead? or enemy.object enemy.animation_id = @parent.assigned_item.animation_id return if enemy.kill_with_weapon > 0 return if enemy.kill_with_skill > 0 return if enemy.kill_with_item > 0 and enemy.kill_with_item != @parent.assigned_item.id @parent.hit_count if @parent.is_a?(Game_Player) and !enemy.puzzle enemy.actor.item_effect(@parent.actor, @parent.assigned_item) damage_sound(enemy) enemy.jump(0,0) unless enemy.puzzle enemy.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_skill_explode return if @hits_delay > 0 for monster in $game_monsters.compact next if monster.actor.dead? next unless in_range?(self, monster, @parent.assigned_skill.area) @parent.hit_count if @parent.is_a?(Game_Player) monster.animation_id = @parent.assigned_skill.animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.skill_effect(@parent.actor, @parent.assigned_skill) monster.jump(0,0) monster.target = @parent end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next unless in_range?(self, event, @parent.assigned_skill.area) @parent.hit_count if @parent.is_a?(Game_Player) event.animation_id = @parent.assigned_skill.animation_id next if event.kill_with_weapon > 0 return if event.kill_with_item > 0 return if event.kill_with_skill > 0 and event.kill_with_skill != @parent.assigned_skill.id @parent.hit_count if @parent.is_a?(Game_Player) and !event.puzzle event.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound(event) event.jump(0,0) unless event.puzzle event.target = @parent end @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_enemy_item_explode return if @hits_delay > 0 for monster in $game_monsters.compact next if monster.actor.dead? next unless in_range?(self, monster, @parent.assigned_item.area) @parent.hit_count if @parent.is_a?(Game_Player) monster.animation_id = @parent.assigned_item.animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.item_effect(@parent.actor, @parent.assigned_item) monster.jump(0,0) monster.target = @parent end for event in $game_map.events.values next unless event.in_battle next if event.actor.dead? or event.object next unless in_range?(self, event, @parent.assigned_item.area) @parent.hit_count if @parent.is_a?(Game_Player) event.animation_id = @parent.assigned_item.animation_id next if event.kill_with_weapon > 0 return if event.kill_with_item > 0 return if event.kill_with_skill > 0 and event.kill_with_skill != @parent.assigned_item.id @parent.hit_count if @parent.is_a?(Game_Player) and !event.puzzle event.actor.item_effect(@parent.actor, @parent.assigned_item) damage_sound(event) event.jump(0,0) unless event.puzzle event.target = @parent end @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_monster_weapon_right(monster) return if @hits_delay > 0 return if monster.actor.dead? @parent.hit_count if @parent.is_a?(Game_Player) monster.animation_id = @parent.actor.ammos[@parent.actor.weapons[0].id].animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.attack_effect(@parent.actor) damage_sound(monster) monster.jump(0,0) monster.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_monster_weapon_left(monster) return if @hits_delay > 0 return if monster.actor.dead? @parent.hit_count if @parent.is_a?(Game_Player) monster.animation_id = @parent.actor.ammos[@parent.actor.weapons[1].id].animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.attack_effect(@parent.actor) damage_sound(monster) monster.jump(0,0) monster.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_monster_skill(monster) return if @hits_delay > 0 return if monster.actor.dead? monster.animation_id = @parent.assigned_skill.animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.skill_effect(@parent.actor, @parent.assigned_skill) damage_sound(monster) monster.jump(0,0) monster.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def hurt_monster_item(monster) return if @hits_delay > 0 return if monster.actor.dead? @parent.hit_count if @parent.is_a?(Game_Player) monster.animation_id = @parent.assigned_item.animation_id @parent.hit_count if @parent.is_a?(Game_Player) monster.actor.item_effect(@parent.actor, @parent.assigned_item) damage_sound(monster) monster.jump(0,0) monster.target = @parent @hits_delay = 60 @destroy = true unless @continue_moving end
def map_passable?(x, y) return $game_map.range_passable?(x, y, @continue_moving) end
end
#------------------------------------------------------------------------------ # Game Bomb #------------------------------------------------------------------------------ class Game_Bomb < Game_Character
def initialize(parent, item) super() @parent = parent @item = item @character_name = "IconSet" @character_index = @item.icon_index @area = @item.area @time = @item.delay @destroy = false @draw = false self.priority_type = 2 jump(0, 0) 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($Vampyr_SBABS.drop_se[1]).play if $Vampyr_SBABS.drop_se[1] != "" 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 monster in $game_monsters.compact next unless in_range?(self, monster, @area) monster.actor.item_effect(@parent.actor, @item) monster.jump(0, 0) end for event in $game_map.events.values next unless event.in_battle and in_range?(self, event, @area) event.actor.item_effect(@parent.actor, @item) event.jump(0, 0) unless event.puzzle end for ally in $game_allies.compact next if ally.actor.dead? next unless in_range?(self, ally, @area) ally.actor.item_effect(@parent.actor, @item) ally.jump(0, 0) end @destroy = true end
def screen_z return $game_player.screen_z-2 end
end
#------------------------------------------------------------------------------ # Game Drop #------------------------------------------------------------------------------ class Game_Drop < Game_Character
def drop RPG::SE.new($Vampyr_SBABS.drop_se[0]).play if $Vampyr_SBABS.drop_se[0] != "" and @gold > 0 RPG::SE.new($Vampyr_SBABS.drop_se[1]).play if $Vampyr_SBABS.drop_se[1] != "" and @item != nil coords = [] if $game_map.passable?(@x, @y+1) coords << [0, 1] elsif $game_map.passable?(@x-1, @y) coords << [-1, 0] elsif $game_map.passable?(@x+1, @y) coords << [1, 0] elsif $game_map.passable?(@x, @y-1) coords << [0, -1] else coords << [0, 0] end j = rand(coords.size-1) jump(coords[j][0], coords[j][1]) end
def update super return if @destroy @drop_time -= 1 if @drop_time > 0 @destroy = (@drop_time <= 0) get_reward if Input.trigger?(Input::C) and in_front?($game_player, self) 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_armors[@item.id].name end if @gold > 0 $game_party.gain_gold(@gold) $game_player.reward = "#{Vocab.gold} #{@gold}" end @destroy = true end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
#------------------------------------------------------------------------------ # Game Interpreter #------------------------------------------------------------------------------ class Game_Interpreter
alias vampyr_sbabs_ginterpreter_iterate_enemy_index iterate_enemy_index
def drop_item(type, id) case type when 0 $game_drop.push(Game_Drop.new(self_event, $data_items[id].icon_index, $data_items[id])) when 1 $game_drop.push(Game_Drop.new(self_event, $data_weapons[id].icon_index, $data_weapons[id])) when 2 $game_drop.push(Game_Drop.new(self_event, $data_armors[id].icon_index, $data_armors[id])) when 3 $game_drop.push(Game_Drop.new(self_event, 0, id)) end end
def set_hotkey(key, type, id) case type when 0 $game_party.members[0].item_hotkeys[key] = id when 1 $game_party.members[0].skill_hotkeys[key] = id end end
def iterate_enemy_index(param) if self_event.actor != nil yield self_event.actor end vampyr_sbabs_ginterpreter_iterate_enemy_index(param) end
end
#------------------------------------------------------------------------------ # Sprite Base #------------------------------------------------------------------------------ class Sprite_Base
attr_reader :animation_duration
alias vampyr_sbabs_spbase_initialize initialize alias vampyr_sbabs_spbase_update update alias vampyr_sbabs_spbase_dispose dispose
def update_show_dmg for i in @_damages.compact next if i[0] == nil or i[0].disposed? i[0].x = self.x i[0].y -= 0.25 end for i in @_damages.compact if i[1] > 0 i[1] -= 1 elsif i[1] <= 0 and i[0] != nil and !i[0].disposed? if i[0].opacity <= 0 i[0].dispose @_damages.delete(i) else i[0].opacity -= 5 end end end if @character != nil and @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.overkill and !@character.overkill)) @character.actor.damage = 0 @character.actor.critical = @character.actor.combo = @character.actor.reflect = false @character.overkill = true if @character.actor.overkill and !@character.overkill end end
def update_show_hit if @_hit_duration > 0 @_hit_duration -=1 unless @hit_showed hit(@old_hit, true) @hit_showed = true end 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) @old_hit = @character.hit @character.hit = nil @hit_showed = false end end
def update_show_reward for i in @_rewards.compact if i[1] > 0 i[1] -= 1 elsif i[1] <= 0 and i[0] != nil and !i[0].disposed? if i[0].opacity <= 0 i[0].dispose @_rewards.delete(i) else i[0].opacity -= 10 end end end if $game_player.reward != nil and $Vampyr_SBABS.show_reward reward($game_player.reward) $game_player.reward = nil end end
def update_show_state_ani return if @character == nil 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 update_show_message for i in @_messages.compact next if i[0] == nil or i[0].disposed? i[0].x = self.x i[0].y = self.y end for i in @_messages.compact if i[2] != nil and i[2].actor.dead? if i[0] != nil and !i[0].disposed? i[0].dispose @_messages.delete(i) end end if i[1] > 0 i[1] -= 1 elsif i[1] <= 0 and i[0] != nil and !i[0].disposed? if i[0].opacity <= 0 i[0].dispose @_messages.delete(i) else i[0].opacity -= 5 end end end if @character != nil and (@character.message1 != "" or @character.message2 != "") show_message(@character) @character.message1 = @character.message2 = "" end end
def update_steal_balloons if @steal_balloon_sprite != nil and !@steal_balloon_sprite.disposed? if @steal_balloon_duration > 0 @steal_balloon_duration -= 1 if @steal_balloon_duration <= 0 dispose_steal_balloon else @steal_balloon_sprite.x = x @steal_balloon_sprite.y = y - height @steal_balloon_sprite.z = z + 200 if @steal_balloon_duration < 16 sx = 7*32 else sx = (7-(@steal_balloon_duration-16)/8)*32 end @steal_balloon_sprite.bitmap.blt(0, 0, @steal_balloon_sprite_bg, Rect.new(sx, 0, 32, 32))
@steal_balloon_sprite.bitmap.blt(4, 2, @steal_balloon_sprite_ico, Rect.new(@steal_balloon_index%16*24, @steal_balloon_index/16*24, 24, 24)) end end end if @character != nil and @character.steal_balloon != nil show_steal_balloon(@character.steal_balloon) @character.steal_balloon = nil end end
def damage(value, critical, combo, reflect, overkill) damage_string = (value.is_a?(Numeric) ? value.abs.to_s : value.to_s) bitmap = Bitmap.new(160, ($Vampyr_SBABS.damage_properties["Damage"][1]*2)+10) bitmap.font.name = $Vampyr_SBABS.damage_properties["Damage"][0] bitmap.font.size = $Vampyr_SBABS.damage_properties["Damage"][1] bitmap.font.bold = $Vampyr_SBABS.damage_properties["Damage"][2] bitmap.font.italic = $Vampyr_SBABS.damage_properties["Damage"][3] bitmap.font.shadow = false if value.is_a?(Numeric) and value <= 0 color = $Vampyr_SBABS.damage_properties["Colors"][1].to_rgb else if @character.is_a?(Game_Player) or @character.is_a?(Game_Ally) and value.is_a?(Numeric) color = $Vampyr_SBABS.damage_properties["Colors"][7].to_rgb else color = $Vampyr_SBABS.damage_properties["Colors"][0].to_rgb end end bitmap.draw_outlined_text(bitmap.rect, damage_string, 1, color) if overkill color = $Vampyr_SBABS.damage_properties["Colors"][6].to_rgb bitmap.font.size += 4 bitmap.draw_outlined_text(bitmap.rect, $Vampyr_SBABS.damage_properties["Texts"][7], 1, color) elsif reflect color = $Vampyr_SBABS.damage_properties["Colors"][5].to_rgb bitmap.draw_outlined_text(bitmap.rect, $Vampyr_SBABS.damage_properties["Texts"][6], 1, color) elsif combo color = $Vampyr_SBABS.damage_properties["Colors"][3].to_rgb bitmap.draw_outlined_text(bitmap.rect, $Vampyr_SBABS.damage_properties["Texts"][2], 1, color) elsif critical color = $Vampyr_SBABS.damage_properties["Colors"][2].to_rgb bitmap.draw_outlined_text(bitmap.rect, $Vampyr_SBABS.damage_properties["Texts"][1], 1, color) end damage_sprite = Sprite.new(self.viewport) damage_sprite.bitmap = bitmap damage_sprite.ox = bitmap.width/2 damage_sprite.oy = bitmap.height*2 damage_sprite.x = self.x damage_sprite.y = self.y damage_sprite.z = 999999 damage_duration = 30 @_damages << [damage_sprite, damage_duration] end
def dispose vampyr_sbabs_spbase_dispose dispose_damage dispose_hit dispose_reward dispose_message dispose_steal_balloon end
def dispose_damage for i in @_damages.compact i[0].bitmap.dispose if i[0].bitmap != nil and !i[0].bitmap.disposed? i[0].dispose unless i[0].disposed? @_damages.delete(i) end end
def dispose_hit return if @_hit_sprite.nil? @_hit_sprite.bitmap.dispose @_hit_sprite.dispose @_hit_sprite = nil end
def dispose_reward for i in @_rewards.compact i[0].bitmap.dispose if i[0].bitmap != nil and !i[0].bitmap.disposed? i[0].dispose unless i[0].disposed? @_rewards.delete(i) end end
def dispose_message for i in @_messages.compact i[0].bitmap.dispose if i[0].bitmap != nil and !i[0].bitmap.disposed? i[0].dispose unless i[0].disposed? @_messages.delete(i) end end
def dispose_steal_balloon return if @steal_balloon_sprite == nil or @steal_balloon_sprite.disposed? @steal_balloon_sprite.dispose @steal_balloon_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
#------------------------------------------------------------------------------ # Sprite Weapon #------------------------------------------------------------------------------ class Sprite_Weapon < 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 $Vampyr_SBABS.allow_weapons_graphics return if @character.actor.nil? return if @character.is_a?(Game_Ally) and @character.map_id != $game_map.map_id self.visible = (@character.anime_attack > 0) update_src_rect update_movement 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.weapons[0] != nil return @character.actor.weapons[0].icon_index elsif @character.actor.is_a?(Game_Actor) and @character.left_attack_on if @character.actor.two_swords_style and @character.actor.weapons[1] != nil return @character.actor.weapons[1].icon_index elsif @character.actor.two_hands_legal? and @character.actor.weapons[0] != nil and @character.actor.weapons[0].ranged? return @character.actor.weapons[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
def weapon return nil if @character.actor.nil? if @character.actor.is_a?(Game_Actor) and @character.right_attack_on and @character.actor.weapons[0] != nil return @character.actor.weapons[0] elsif @character.actor.is_a?(Game_Actor) and @character.left_attack_on if @character.actor.two_swords_style and @character.actor.weapons[1] != nil return @character.actor.weapons[1] elsif @character.actor.two_hands_legal? and @character.actor.weapons[0] != nil and @character.actor.weapons[0].ranged? return @character.actor.weapons[0] end end return nil 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 $Vampyr_SBABS.allow_shields_graphics return if @character.actor.nil? return if @character.is_a?(Game_Ally) and @character.map_id != $game_map.map_id self.visible = @character.actor.defending update_src_rect update_movement moving_with_shield end
def update_movement 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 @character.actor.armors[0].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
#------------------------------------------------------------------------------ # Sprite Character #------------------------------------------------------------------------------ class Sprite_Character < Sprite_Base
alias vampyr_sbabs_spchar_update_bitmap update_bitmap
def update_bitmap vampyr_sbabs_spchar_update_bitmap if @character.is_a?(Game_Event) or @character.is_a?(Game_Monster) self.oy = @ch+16 if @character.flying end @character.height = @ch end
end
#------------------------------------------------------------------------------ # Sprite Shadow Floor #------------------------------------------------------------------------------ class Sprite_ShadowFloor < Sprite_Base
attr_accessor :character
def initialize(viewport, character=nil) super(viewport) @character = character self.bitmap = Cache.system("Shadow") self.ox = self.bitmap.width/2 self.oy = self.bitmap.height end
def update self.visible = (!@character.transparent and available) return unless available self.x = @character.screen_x self.y = @character.screen_y self.z = 50 self.opacity = 180 self.bush_depth = @character.bush_depth end
def available return true if !@character.actor.nil? and !@character.actor.dead? return false end
end
#------------------------------------------------------------------------------ # Spriteset Map #------------------------------------------------------------------------------ class Spriteset_Map
alias vampyr_sbabs_sp_map_create_characters create_characters alias vampyr_sbabs_sp_map_dispose_characters dispose_characters
def create_characters @allies_sprites = [] for ally in $game_allies.compact @allies_sprites.push(Sprite_Character.new(@viewport1, ally)) end @range_sprites = [] for range in $game_range.compact next unless $game_map.in_range?(range) @range_sprites.push(Sprite_Character.new(@viewport1, range)) end @drop_sprites = [] for drop in $game_drop.compact next unless $game_map.in_range?(drop) @drop_sprites.push(Sprite_Drop.new(@viewport1, drop)) end for bomb in $game_bomb.compact next unless $game_map.in_range?(bomb) @drop_sprites.push(Sprite_Drop.new(@viewport1, bomb)) end @weapon_sprites = [] @shield_sprites = [] @weapon_sprites.push(Sprite_Weapon.new(@viewport1, $game_player)) @shield_sprites.push(Sprite_Shield.new(@viewport1, $game_player)) for ally in $game_allies.compact @weapon_sprites.push(Sprite_Weapon.new(@viewport1, ally)) @shield_sprites.push(Sprite_Shield.new(@viewport1, ally)) end @shadow_floor = [] for event in $game_map.events.values.compact @weapon_sprites.push(Sprite_Weapon.new(@viewport1, event)) @shield_sprites.push(Sprite_Shield.new(@viewport1, event)) if event.actor != nil and event.flying @shadow_floor.push(Sprite_ShadowFloor.new(@viewport1, event)) end end @monsters_sprites = [] for monster in $game_monsters.compact @monsters_sprites.push(Sprite_Character.new(@viewport1, monster)) @weapon_sprites.push(Sprite_Weapon.new(@viewport1, monster)) @shield_sprites.push(Sprite_Shield.new(@viewport1, monster)) if monster.actor != nil and monster.flying @shadow_floor.push(Sprite_ShadowFloor.new(@viewport1, monster)) end end vampyr_sbabs_sp_map_create_characters end
def update_characters for sprite in @character_sprites if sprite.character.is_a?(Game_Event) sprite.update if $game_map.in_range?(sprite.character) else sprite.update end end for ally in @allies_sprites.compact if ally.character.destroy and !ally.disposed? ally.dispose $game_allies.delete(ally.character) @allies_sprites.delete(ally) elsif !ally.disposed? ally.update if $game_map.in_range?(ally.character) end end for monster in @monsters_sprites.compact if monster.character.destroy and !monster.character.respawn and !monster.disposed? monster.dispose $game_monsters.delete(monster.character) @monsters_sprites.delete(monster) elsif !monster.disposed? monster.update if $game_map.in_range?(monster.character) end end for range in @range_sprites.compact if range.character.destroy and !range.disposed? range.dispose $game_range.delete(range.character) @range_sprites.delete(range) elsif !range.disposed? range.update if $game_map.in_range?(range.character) end end for drop in @drop_sprites.compact if drop.character.destroy and !drop.disposed? drop.update drop.character.character_name = "" unless drop.animation? drop.dispose $game_drop.delete(drop.character) $game_bomb.delete(drop.character) @drop_sprites.delete(drop) end elsif !drop.disposed? drop.update if $game_map.in_range?(drop.character) end end for ally in $game_allies.compact next if ally.draw @allies_sprites.push(Sprite_Character.new(@viewport1, ally)) @weapon_sprites.push(Sprite_Weapon.new(@viewport1, ally)) @shield_sprites.push(Sprite_Shield.new(@viewport1 ,ally)) ally.draw = true end for range in $game_range.compact next unless $game_map.in_range?(range) next if range.draw @range_sprites.push(Sprite_Character.new(@viewport1, range)) range.draw = true end for drop in $game_drop.compact next unless $game_map.in_range?(drop) next if drop.draw @drop_sprites.push(Sprite_Drop.new(@viewport1, drop)) drop.draw = true end for bomb in $game_bomb.compact next unless $game_map.in_range?(bomb) next if bomb.draw @drop_sprites.push(Sprite_Drop.new(@viewport1, bomb)) bomb.draw = true end for weapon in @weapon_sprites.compact next unless $game_map.in_range?(weapon.character) weapon.update end for shield in @shield_sprites.compact next unless $game_map.in_range?(shield.character) shield.update end for shadow in @shadow_floor.compact next unless $game_map.in_range?(shadow.character) shadow.update end end
def refresh_characters dispose_characters create_characters end
end
#------------------------------------------------------------------------------ # Window Base #------------------------------------------------------------------------------ class Window_Base < Window
#------------------------------------------------------------------------------ # Scene Title #------------------------------------------------------------------------------ class Scene_Title < Scene_Base
alias vampyr_sbabs_scenetitle_create_game_objects create_game_objects alias vampyr_sbabs_scenetitle_command_new_game command_new_game
def command_new_game vampyr_sbabs_scenetitle_command_new_game for ally in $game_allies.compact ally.map_id = $data_system.start_map_id ally.moveto($data_system.start_x, $data_system.start_y) ally.move_random end end
end
#------------------------------------------------------------------------------ # Scene Map #------------------------------------------------------------------------------ class Scene_Map < Scene_Base
alias vampyr_sbabs_scenemap_update update
def update vampyr_sbabs_scenemap_update for ally in $game_allies.compact ally.update if $game_map.in_range?(ally) end for monster in $game_monsters.compact monster.update if $game_map.in_range?(monster) end for range in $game_range.compact range.update if $game_map.in_range?(range) end for drop in $game_drop.compact drop.update if $game_map.in_range?(drop) end for bomb in $game_bomb.compact bomb.update if $game_map.in_range?(bomb) end end
def update_encounter end
def refresh_sprites @spriteset.refresh_characters Cache.clear end
end
#------------------------------------------------------------------------------ # Scene Item #------------------------------------------------------------------------------ class Window_Item < Window_Selectable
def update_help if $scene.is_a?(Scene_Item) and $scene.message != "" @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 vampyr_sbabs_sitem_start start alias vampyr_sbabs_sitem_update update alias vampyr_sbabs_sitem_update_item_selection update_item_selection
def update vampyr_sbabs_sitem_update if @delay <= 0 @message = "" else @delay -= 1 end end
def update_item_selection vampyr_sbabs_sitem_update_item_selection for button in @actor.item_hotkeys.keys next unless Input.trigger?(button) next unless @item_window.item.is_a?(RPG::Item) Sound.play_decision @actor.item_hotkeys[button] = @item_window.item.id @message = $Vampyr_SBABS.memorized_text @delay = 60 end if @item_window.item != nil and @item_window.item.is_ammo? if Input.trigger?($Vampyr_SBABS.attack_key1) if @actor.weapons[0] != nil and @actor.weapons[0].ranged? and @actor.weapons[0].ammo_list.include?(@item_window.item.id) Sound.play_decision @message = $Vampyr_SBABS.ammo_text @actor.ammos[@actor.weapons[0].id] = @item_window.item @delay = 60 else Sound.play_buzzer end elsif Input.trigger?($Vampyr_SBABS.attack_key2) if @actor.weapons[1] != nil and @actor.weapons[1].ranged? and @actor.weapons[1].ammo_list.include?(@item_window.item.id) Sound.play_decision @message = $Vampyr_SBABS.ammo_text @actor.ammos[@actor.weapons[1].id] = @item_window.item @delay = 60 else Sound.play_buzzer end end end end
end
#------------------------------------------------------------------------------ # Scene Skill #------------------------------------------------------------------------------ class Window_Skill < Window_Selectable
def update_help if $scene.is_a?(Scene_Skill) and $scene.message != "" @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 vampyr_sbabs_sskill_start start alias vampyr_sbabs_sskill_update update alias vampyr_sbabs_sskill_update_skill_selection update_skill_selection
def start vampyr_sbabs_sskill_start @message = "" @delay = 0 end
def update vampyr_sbabs_sskill_update if @delay <= 0 @message = "" else @delay -= 1 end end
def update_skill_selection vampyr_sbabs_sskill_update_skill_selection for button in @actor.skill_hotkeys.keys next unless Input.trigger?(button) next if @skill_window.skill == nil Sound.play_decision @actor.skill_hotkeys[button] = @skill_window.skill.id @message = $Vampyr_SBABS.memorized_text @delay = 60 end end
end
#------------------------------------------------------------------------------ # Scene File #------------------------------------------------------------------------------ class Scene_File < Scene_Base
alias vampyr_sbabs_sfile_do_load do_load alias vampyr_sbabs_sfile_write_save_data write_save_data alias vampyr_sbabs_sfile_read_save_data read_save_data
def do_load vampyr_sbabs_sfile_do_load $game_player.refresh for ally in $game_allies.compact ally.refresh end end
#------------------------------------------------------------------------------ # End of SBABS #------------------------------------------------------------------------------ end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
#============================================================================== # http://makegame.forumvi.com/ #============================================================================== # ID cong tac de hien/an dong mau (hp) va cong luc (mp) OnOff_Switch = 0
# Hien thanh Hp, Mp va Kinh nghiem Show_Status = true
# Van ban hien thi khi dung chieu Show_Skills = true Skills_Text = "Skills"
# Van ban hien thi o vat pham Show_Items = true Items_Text = "Items"
# van ban hien o vu khi ban ra Show_Ammos = true Ammo_Text = "Ammo"
# ten cua font chu Font_Name = Font.default_name
# Co cua font chu Font_Size = 16
#------------------------------------------------------------------------------ if Vampyr_Kernel.enabled?("Vampyr SBABS") #------------------------------------------------------------------------------ Vampyr_Kernel.register("Vampyr HUD", 1.1, "12/06/2009") #------------------------------------------------------------------------------ class Vampyr_HUD1 < Sprite
def draw_hpbar(actor, x, y) self.bitmap.draw_outlined_text(x, y, 24, Font_Size, Vocab::hp_a) rect = Rect.new(0, 0, @hpbar.width*actor.hp/actor.maxhp, @hpbar.height) self.bitmap.blt(x+24, y, @base, @base.rect) self.bitmap.blt(x+24, y, @hpbar, rect) end
def draw_mpbar(actor, x, y) self.bitmap.draw_outlined_text(x, y, 24, Font_Size, Vocab::mp_a) rect = Rect.new(0, 0, @mpbar.width*actor.mp/actor.maxmp, @mpbar.height) self.bitmap.blt(x+24, y, @base, @base.rect) self.bitmap.blt(x+24, y, @mpbar, rect) end
def draw_expbar(actor, x, y) self.bitmap.draw_outlined_text(x, y, 24, Font_Size, "Exp") rect = Rect.new(0, 0, @expbar.width*actor.current_exp/actor.next_exp, @expbar.height) self.bitmap.blt(x+24, y, @base, @base.rect) self.bitmap.blt(x+24, y, @expbar, rect) end
def something_changed? return false if $game_party.members.size <= 0 return true if @old_hp != @actor.hp return true if @old_mp != @actor.mp return true if @old_exp != @actor.exp return true if @actor != $game_party.members[0] return false end
def update_opacity if $game_player.screen_x <= (self.bitmap.width+16) and $game_player.screen_y <= (self.bitmap.height+16) self.opacity -= 10 elsif self.opacity < 255 self.opacity += 10 end end
def dispose self.bitmap.dispose super end
end
#------------------------------------------------------------------------------ class Vampyr_HUD2 < Sprite
def update super self.visible = (OnOff_Switch <= 0 or $game_switches[OnOff_Switch]) update_opacity refresh if something_changed? end
def refresh @actor = $game_party.members[0] return if @actor == nil @hotkeys = {} @actor.item_hotkeys.each { |k, v| @hotkeys[k] = v } self.bitmap.clear self.bitmap.blt(0, 10, @bg, @bg.rect) draw_items end
def draw_items count = 0 @actor.item_hotkeys.sort.each { |key, value| next if value.nil? item = $data_items[value] next if item.nil? draw_icon(item.icon_index, 32*count+4, 14) self.bitmap.draw_outlined_text(32*count, self.bitmap.height-Font_Size, 32, Font_Size, Keys.name(key), 1) count += 1 } self.bitmap.draw_outlined_text(0, 0, self.bitmap.width, Font_Size, Items_Text, 1) end
def something_changed? return false if $game_party.members.size <= 0 return true if @actor != $game_party.members[0] return true if @hotkeys.to_s != @actor.item_hotkeys.to_s return false end
def update_opacity if $game_player.screen_x >= (Graphics.width-self.bitmap.width-16) and $game_player.screen_y <= (self.bitmap.height+16) self.opacity -= 10 elsif self.opacity < 255 self.opacity += 10 end end
def dispose self.bitmap.dispose super end
end
#------------------------------------------------------------------------------ class Spriteset_Map
alias vampyr_hud_initialize initialize alias vampyr_hud_update update alias vampyr_hud_dispose dispose
def initialize $vampyr_hud1 = Vampyr_HUD1.new(@viewport3) if Show_Status $vampyr_hud2 = Vampyr_HUD2.new(@viewport3) if Show_Ammos $vampyr_hud3 = Vampyr_HUD3.new(@viewport3) if Show_Skills $vampyr_hud4 = Vampyr_HUD4.new(@viewport3) if Show_Items vampyr_hud_initialize end
def update vampyr_hud_update $vampyr_hud1.update if Show_Status $vampyr_hud2.update if Show_Ammos $vampyr_hud3.update if Show_Skills $vampyr_hud4.update if Show_Items end
def dispose vampyr_hud_dispose $vampyr_hud1.dispose if Show_Status $vampyr_hud2.dispose if Show_Ammos $vampyr_hud3.dispose if Show_Skills $vampyr_hud4.dispose if Show_Items end
end
#------------------------------------------------------------------------------ end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
def update super refresh if something_changed? end
def refresh @old_x = self.x = @parent.screen_x-(self.bitmap.width/2) @old_y = self.y = @parent.screen_y @old_hp = @parent.actor.hp @old_stolen = @parent.stolen self.bitmap.clear if (@parent.is_a?(Game_Event) or @parent.is_a?(Game_Monster)) and @parent.actor.overkill bar = Cache.system("Overkill Bar") elsif (@parent.is_a?(Game_Event) or @parent.is_a?(Game_Monster)) and @parent.actor.hp <= (@parent.actor.maxhp*15/100) and !@parent.stolen bar = Cache.system("Enemy Steal Bar") else bar = (@parent.is_a?(Game_Ally) ? Cache.system("Ally HP Bar") : Cache.system("Enemy HP Bar")) end self.bitmap.blt(0, 0, @base, @base.rect) rect = Rect.new(0, 0, bar.width*@parent.actor.hp/@parent.actor.maxhp, bar.height) self.bitmap.blt(0, 0, bar, rect) end
def something_changed? return false if self.bitmap.disposed? return true if @old_x != @parent.screen_x-(self.bitmap.width/2) return true if @old_y != @parent.screen_y return true if @old_hp != @parent.actor.hp return true if @old_stolen != @parent.stolen return false end
def dispose self.bitmap.dispose super end
end
#------------------------------------------------------------------------------ class Vampyr_BossHPBar < Sprite
def initialize(viewport, parent) super(viewport) @parent = parent @base = Cache.system("Boss Base") @bars = [] @values = [] @rects = [] for i in 0...@parent.boss @bars[i] = Cache.system("Boss HP Bar ##{i+1}") @values << (@parent.actor.maxhp.divmod @parent.boss)[0]*i @rects[i] = @bars[i].rect end @values << @parent.actor.maxhp self.bitmap = Bitmap.new(@base.width, @base.height) self.x = (Graphics.width-self.bitmap.width)/2 self.y = Graphics.height-self.bitmap.height-48 refresh end
def update super refresh if @old_hp != @parent.actor.hp end
def refresh @old_hp = @parent.actor.hp self.bitmap.clear self.bitmap.blt(0, 0, @base, @base.rect) hp = @parent.actor.hp.divmod @parent.boss max = @parent.actor.maxhp.divmod @parent.boss for i in 0...@bars.size next if @parent.actor.hp.between?(@values[i], @values[i+1]) next if @parent.actor.hp < @values[i] self.bitmap.blt(0, 0, @bars[i], @bars[i].rect) end for i in 0...@bars.size next unless @parent.actor.hp.between?(@values[i], @values[i+1]) x = @parent.actor.maxhp - @parent.actor.hp y = @parent.actor.maxhp - @parent.actor.hp z = max[0] - y % (max[0]+max[1]) @rects[i] = Rect.new(0, 0, @bars[i].width*z/(max[0]+max[1]), @bars[i].height) self.bitmap.blt(0, 0, @bars[i], @rects[i]) end end
def dispose self.bitmap.dispose super end
end
#------------------------------------------------------------------------------ class Spriteset_Map
alias vampyr_sbabs_enemyhp_smap_initialize initialize alias vampyr_sbabs_enemyhp_smap_update update alias vampyr_sbabs_enemyhp_smap_dispose dispose alias vampyr_sbabs_enemyhp_smap_refresh_characters refresh_characters
def update vampyr_sbabs_enemyhp_smap_update update_monsters_hp_bars update_enemies_hp_bars update_boss_hp_bar update_allies_hp_bars end
def dispose vampyr_sbabs_enemyhp_smap_dispose dispose_bars end
def update_enemies_hp_bars for event in $game_map.events.values next unless event.in_battle next if event.boss > 0 if @enemies_hp_bars[event.id] == nil and $game_player.in_range?($game_player, event, 3) and !event.actor.dead? next if event.object or event.puzzle @enemies_hp_bars[event.id] = Vampyr_HPBars.new(@viewport1, event) elsif @enemies_hp_bars[event.id] != nil and $game_player.in_range?($game_player, event, 3) and !event.actor.dead? @enemies_hp_bars[event.id].update elsif @enemies_hp_bars[event.id] != nil @enemies_hp_bars[event.id].dispose @enemies_hp_bars.delete(event.id) end end end
def update_monsters_hp_bars for monster in $game_monsters.compact if @monsters_hp_bars[monster.id] == nil and $game_player.in_range?($game_player, monster, 3) and !monster.actor.dead? @monsters_hp_bars[monster.id] = Vampyr_HPBars.new(@viewport1, monster) elsif @monsters_hp_bars[monster.id] != nil and $game_player.in_range?($game_player, monster, 3) and !monster.actor.dead? @monsters_hp_bars[monster.id].update elsif @monsters_hp_bars[monster.id] != nil @monsters_hp_bars[monster.id].dispose @monsters_hp_bars.delete(monster.id) end end end
def update_boss_hp_bar for event in $game_map.events.values next unless event.in_battle next unless event.boss > 0 if @boss_hud == nil and !event.actor.dead? @boss_hud = Vampyr_BossHPBar.new(@viewport3, event) elsif @boss_hud != nil and !event.actor.dead? @boss_hud.update elsif @boss_hud != nil and event.actor.dead? @boss_hud.dispose @boss_hud = nil end end end
def update_allies_hp_bars for ally in $game_allies.compact next if ally.map_id != $game_map.map_id if @allies_hp_bars[ally.id] == nil and $game_player.in_range?($game_player, ally, 3) and !ally.actor.dead? and !$game_player.in_vehicle? @allies_hp_bars[ally.id] = Vampyr_HPBars.new(@viewport1, ally) elsif @allies_hp_bars[ally.id] != nil and $game_player.in_range?($game_player, ally, 3) and !ally.actor.dead? and !$game_player.in_vehicle? @allies_hp_bars[ally.id].update elsif @allies_hp_bars[ally.id] != nil @allies_hp_bars[ally.id].dispose @allies_hp_bars.delete(ally.id) end end end
def refresh_characters vampyr_sbabs_enemyhp_smap_refresh_characters for i in @allies_hp_bars.values i.dispose end @allies_hp_bars.clear end
def refresh self.contents.clear bitmap = Cache.system("Face Base") self.contents.blt(0, 0, bitmap, bitmap.rect) return if $game_party.members.size <= 1 or $game_allies.empty? draw_actor_head($game_party.members[$ally_index], 0, 6, enabled?) end
def enabled? return false if $game_party.members[$ally_index].dead? return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id return true end
end
#------------------------------------------------------------------------------ class Window_VampyrGroupActions < Window_Base
def refresh self.contents.clear bitmap = Cache.system("Face Base") self.contents.blt(0, 0, bitmap, bitmap.rect) return if $game_party.members.size <= 1 or $game_allies.empty? case $game_allies[$ally_index].command when 0 draw_icon(2, 4, 4, enabled?) when 1 draw_icon(119, 4, 4, enabled?) when 2 draw_icon(52, 4, 4, enabled?) when 3 draw_icon(128, 4, 4, enabled?) end end
def enabled? return false if $game_party.members[$ally_index].dead? return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id return true end
end
#------------------------------------------------------------------------------ class Scene_Map < Scene_Base
alias vampyr_group_command_start start alias vampyr_group_command_update update alias vampyr_group_command_terminate terminate
def update vampyr_group_command_update return if $game_allies.empty? call_control_allies_window end
def terminate vampyr_group_command_terminate @group_window.dispose @group_action.dispose end
def call_control_allies_window return if $game_party.members.size <= 1 or $game_allies.empty? if Input.press?(Input::CTRL) @group_window.refresh unless @group_window.active @group_action.refresh unless @group_action.active @group_window.visible = @group_window.active = true @group_action.visible = @group_action.active = true @group_window.contents_opacity += 10 @group_action.contents_opacity += 10 update_allies_window update_allies_actions else @group_window.contents_opacity -= 10 if @group_window.contents_opacity > 0 @group_action.contents_opacity -= 10 if @group_action.contents_opacity > 0 @group_window.visible = @group_window.active = false if @group_window.contents_opacity <= 0 @group_action.visible = @group_action.active = false if @group_action.contents_opacity <= 0 end end
def update_allies_window if Input.trigger?(Input::C) and @group_window.active if $ally_index < ($game_party.members.size-1) $ally_index += 1 else $ally_index = 1 end @group_window.refresh @group_action.refresh end end
def update_allies_actions if Input.trigger?(Keys::Tab) and @group_action.active return unless enabled? if $game_allies[$ally_index].command < 3 $game_allies[$ally_index].command += 1 else $game_allies[$ally_index].command = 0 end @group_window.refresh @group_action.refresh end end
def enabled? return false if $game_party.members[$ally_index].dead? return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id return true end
end #------------------------------------------------------------------------------ end
def refresh @data = [] self.contents.clear for i in $data_enemies next if Dont_Appear.include?(i.id) @data << i end @data.compact! @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end
def enemy return @data[@index] end
def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 4 self.contents.clear_rect(rect) i = @data[index] return if i.nil? self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 if $game_system.enemy_defeated[i.id] >= 1 or Show_All self.contents.draw_text(rect, "#{i.name}") else self.contents.draw_text(rect, "?????") end end
end
#------------------------------------------------------------------------------ class Window_VampyrBestiaryInfo < Window_Base
def initialize super(128, 0, 416, 416) @enemy = nil end
def update(enemy) return if @enemy == enemy @enemy = enemy refresh end
def draw_dropped_item(x, y) items = [] for i in [@enemy.drop_item1, @enemy.drop_item2] case i.kind when 1 items.push($data_items[i.item_id]) when 2 items.push($data_weapons[i.weapon_id]) when 3 items.push($data_armors[i.armor_id]) end end for i in 0...items.size next if i.nil? draw_item_name(items[i], x, y+(i*24)) end end
def draw_weakness(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 96, WLH, "Weakness:") enemy = Game_Enemy.new(0, @enemy.id) weakness = [] for i in 0...$data_system.elements.size-1 next unless enemy.element_rate(i+1) > 100 weakness << i end for i in 0...weakness.size x2 = 32*(i%7) y2 = WLH*(i/7) a = Attribute_Icons draw_icon(a[weakness[i]], x+x2, y+WLH+y2) end end
def draw_resistences(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 128, WLH, "Resistences:") enemy = Game_Enemy.new(0, @enemy.id) resistences = [] for i in 0...$data_system.elements.size-1 next unless enemy.element_rate(i+1) < 100 resistences << i end for i in 0...resistences.size x2 = 32*(i%7) y2 = WLH*(i/7) a = Attribute_Icons draw_icon(a[resistences[i]], x+x2, y+WLH+y2) end end
end
#------------------------------------------------------------------------------ class Game_System
attr_accessor:enemy_defeated
alias vampyr_sbabs_gsystem_initialize initialize
def initialize vampyr_sbabs_gsystem_initialize @enemy_defeated = {} for i in 0...$data_enemies.size @enemy_defeated[i] = 0 end end
end
#------------------------------------------------------------------------------ class Game_Troop < Game_Unit
def kill_count for enemy in dead_members $game_system.enemy_defeated[enemy.enemy_id] += 1 end end
end
#------------------------------------------------------------------------------ if Vampyr_Kernel.enabled?("Vampyr SBABS")
class Game_Event < Game_Character
alias vampyr_bestiary_gevent_dying dying
def dying $game_system.enemy_defeated[@enemy_id] += 1 vampyr_bestiary_gevent_dying end
end
end
#------------------------------------------------------------------------------ if Vampyr_Kernel.enabled?("Vampyr SBABS")
class Game_Monster < Game_Character
alias vampyr_bestiary_gmonster_get_rewards get_rewards
def get_rewards $game_system.enemy_defeated[@enemy_id] += 1 vampyr_bestiary_gmonster_get_rewards end
end
end
#------------------------------------------------------------------------------ class Scene_Battle < Scene_Base
alias vampyr_bestiary_display_exp_and_gold display_exp_and_gold
def display_exp_and_gold vampyr_bestiary_display_exp_and_gold $game_troop.kill_count end
end
#------------------------------------------------------------------------------ class Scene_VampyrBestiary < Scene_Base
def initialize(from_menu=false) @from_menu = from_menu end
def start super @spriteset = Spriteset_Battle.new @menu_window = Window_VampyrBestiaryMenu.new @info_window = Window_VampyrBestiaryInfo.new end
def update super @spriteset.update @menu_window.update @info_window.update(@menu_window.enemy) if Input.trigger?(Input::B) Sound.play_cancel $scene = (@from_menu ? Scene_Menu.new : Scene_Map.new) end end
def terminate super @spriteset.dispose @menu_window.dispose @info_window.dispose end
end
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
Cách tạo quái vật Vào Database -> Enemy -> Chọn 1 con quái nhé Phần Graphic không quan trọng Copy đoạn sau vô Note
Code:
Char Name = Monster Char Index = 1 Respawn = 300 Weapon Icon = 14 Die SE = Enemy1_Die Steal List = i1,i4 Steal Rate = 50 Aggressiveness = 0
Giải thích : Char name : hình ảnh làm char Die SE : Âm thanh khi chết Weapon Icon : Vũ khí sử dụng của con quái Nhưng cái kia không quan trọng
Cái này nữa nè : Char index
Ở trên ta khai báo char name là monster đúng không? Char này gồm 8 con quái cơ Nếu không có char index thì khi khai báo char name nó sẽ mặc định là con đầu tiên -> bạn để dùng các con quái sau thì nhập in dex vô
Nhập index như hình trên (Bạn hiểu nguyên tắc index rùi chứ) ^^
(Số 0 có nghĩa là không cần char index nữa)
OK vậy là xong con quái
Phần 2 Tạo nhóm quái vật
Sang bảng troop tạo 1 nhóm quái vật có con quái vừa làm vô.
OK
Phần 3 Cho quái xuất hiện tại map Vào map chọn Properties chọn nhóm quái vật vừa tạo
OK Test thử cái nào
sanggameboy Level 4
Danh hiệu : Họa sĩ của thời đại Tổng số bài gửi : 170 MGV Xu : 2733 Danh tiếng : 53 Ngày tham gia : 11/12/2010 Tuổi : 27 Đến từ : http://mgvn.isgreat.org
Ok nhưng bây giờ bạn để ý nhé Graphic = !$Boomerang là hình để boom me rang di chuyển lên trong char phải có < ở đây mình vd là hình này các bạn add vô char nha https://i.servimg.com/u/f39/15/99/81/45/boomer10.png
Đặt tên hình là : !$Boomerang
Speed : tốc độ chắc biết rùi càng lớn thì càng nhanh
Còn Phi tiêu mai up giờ đag bận
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh
Trước mình hướng dẫn các bạn là làm quái theo map thì quái sẽ ra hok bao giờ hết bây giờ mình sẽ hưuóng dẫn cách làm để quái chết được và hok sống lại nữa Tạo 1 event Tạo 2 trang
Trang 1 (Cho di chuyển là theo người chơi nha, hình di chuyển là hình quái) Đặt event chú thích : Enemy 1 (Trong đó 1 là id của quái vật các chỉ số của quái sẽ là của quái có id đc ghi) Đặt event chú thích : Die Switch 1 (Trong đó 1 là công tắc có nghĩa là khi quái chết công tắc 001 sẽ bật) Đặt event : Follow Xong
Trang 2 (Không đặt hình di chuyển) Đặt điều kiện là công tắc 001 bật
OK (Nhớ thanks)
phantanhiep Level 4
Danh hiệu : Người sáng tạo Tổng số bài gửi : 177 MGV Xu : 3096 Danh tiếng : 11 Ngày tham gia : 20/12/2010 Tuổi : 26 Đến từ : Nha trang
Các ban chơi game thấy quái boss nó có dòng phải không nào, có nghĩa là cứ hết 1 dóng máu thì lại có dòng tiép theo ấy
Các bạn xem hướng dẫn làm quái = event như hướng dẫn trên tuy nhiên tại trang 1 thì thêm 1 event nữa là Chú thích : Boss #2 Trong đó 2 là số dòng (1~5)
!!!!Nhớ thanks (Tuy bài viết hơi ngắn)
voanhhung64 Level 3
Tổng số bài gửi : 145 MGV Xu : 597 Danh tiếng : 4 Ngày tham gia : 12/12/2010
Trước mình hướng dẫn các bạn là làm quái theo map thì quái sẽ ra hok bao giờ hết bây giờ mình sẽ hưuóng dẫn cách làm để quái chết được và hok sống lại nữa Tạo 1 event Tạo 2 trang
Trang 1 (Cho di chuyển là theo người chơi nha, hình di chuyển là hình quái) Đặt event chú thích : Enemy 1 (Trong đó 1 là id của quái vật các chỉ số của quái sẽ là của quái có id đc ghi) Đặt event chú thích : Die Switch 1 (Trong đó 1 là công tắc có nghĩa là khi quái chết công tắc 001 sẽ bật) Đặt event : Follow Xong
Trang 2 (Không đặt hình di chuyển) Đặt điều kiện là công tắc 001 bật
OK (Nhớ thanks)
mạn phép duongtiep, sau khi xài xas do bạn HD mình phát hiện ra 1 số điều là: Die Switch 1 là để kích hoạt hoạt event nào đó khi nó thua trận, và chỉ áp dụng cho boss thôi vì lý do rất đơn giản, khi bạn đặc Die Switch 1 thì qua con quái thứ 2 bạn phải đặc là Die Switch 2 sẽ là tốn rất nhiều Switch vô ích và còn làm rối người lập trình dễ xảy ra sơ sót, còn nếu bạn dùng chung switch thì bạn chỉ cần diệt 1 con là tất cả sẽ đồng loạt biến mất.
Vì vậy để đở tốn Switch vô ích và không làm rối người lập trình khó xảy ra sơ sót, nên chúng ta áp dụng Die không đổi vì là thể hiện khi quái chết còn cái (mình lấy cái này để dể làm vd)Switch 1 là 1 dòng lệnh tùy biến bạn có thể thay đổi và theo mình đề xuất thì sử dụng Self Switch A là hiệu quả nhất vì nó tách biệt với mọi thứ trong game chỉ áp dụng cho mỗi event đó mà thôi, hay ko? Vì thế cú pháp để cho quái chết biến mất luôn là Die Self Switch A Tương tự như event thường ấy, nên nếu để quái chết xong biến mất vào qua map thì có lại theo bạn sẽ là gì nào? Die Erase Event! Hết, xin cám ơn!
voanhhung64 Level 3
Tổng số bài gửi : 145 MGV Xu : 597 Danh tiếng : 4 Ngày tham gia : 12/12/2010
Các ban chơi game thấy quái boss nó có dòng phải không nào, có nghĩa là cứ hết 1 dóng máu thì lại có dòng tiép theo ấy
Các bạn xem hướng dẫn làm quái = event như hướng dẫn trên tuy nhiên tại trang 1 thì thêm 1 event nữa là Chú thích : Boss #2 Trong đó 2 là số dòng (1~5)
!!!!Nhớ thanks (Tuy bài viết hơi ngắn)
duongtiep! bác đang hướng dẫn cái gì thế? Tui hoàn toàn ko hiểu?
duongtiep Level 15
Danh hiệu : The King Tổng số bài gửi : 1229 MGV Xu : 2677 Danh tiếng : 45 Ngày tham gia : 10/12/2010 Đến từ : Quảng Ninh