질문과 답변

Extra Form

스크립트는 정말 배우기 어렵네요ㄷ;;

 

제가 액알스크립트를 수정하고싶은데

거기서 몬스터가 죽으면 그자리에 시체가 남고 시간되면 사라지고 리젠되는거져

 

액알은 http://avangs.info/zbxe/?_filter=search&mid=script_center_rgss&search_keyword=%EC%95%A1%EC%95%8C&search_target=title&document_srl=671327

있는데요

 

액알 스크립트 올립니다

그리고 소환 스킬도 없에주세요

 

#=================================================
# ■ Neo A-RPG Module 1.2
#-------------------------------------------------
#  제작자: 패닉(kcss)
#   일부제작: 비밀소년
#=================================================
class Game_Character
  attr_accessor :battler
  attr_accessor :team
  attr_accessor :agent
  attr_accessor :am_bullet
  attr_accessor :attack_delay
  attr_accessor :timer_last_attack
  attr_accessor :o_atk_r
  attr_accessor :sprite_damage
  attr_accessor :sprite_damage_critical
  attr_accessor :receiver
  attr_accessor :summon_setting_time
  attr_accessor :summon_duration_time
  attr_accessor :onwer 
  alias acr_d initialize
  alias acr_u update
  def initialize
    acr_d
    @battler = Game_Battler.new
    @team = 1
    @attack_delay = 1
    @timer_last_attack = 0       
    @range_count = 0
  end
  def update
    acr_u
    return if $game_system.map_interpreter.running? or $game_temp.message_window_showing
    acr_event_setting   
    regen! if b.dead? and regen_?
  end     
  def sprite
    c = self
    if $scene.is_a?(Scene_Map)
      $scene.instance_eval do
        @spriteset.instance_eval do
          @character_sprites.each do |v|
            if v.character == c
              return v
            end
          end
        end
      end
    end
    return nil
  end   
  def moveto_outside
    @x = -10
    @y = -10
    @real_x = @x * 128
    @real_y = @y * 128
    @prelock_direction = 0
  end
  def b
    return @battler
  end 
  def unerase
    @erased = false
    refresh
  end 
  def regen!
    return if not regen_?
    if @regen_count < @regen_time * 40
      @regen_count += 1
      return
    end   
    self.b.damage = nil
    self.b.hp = self.b.maxhp
    @die=false
    moveto(@event.x, @event.y)
    @regen_count = 0
    unerase
  end 
  def regen_?
    return (@regen_time != nil)
  end 
end
 
class Game_Character
  def find_nearest_enemy
    target = nil
    nearest_distance = 999999
    for enemy in all_enemies
      distance = (x - enemy.x).abs + (y - enemy.y).abs
      if distance < nearest_distance
        nearest_distance = distance
        target = enemy
      end
    end
    return target
  end
  #───────────────────────
  # ♧ 타겟에 가까이 이동한다.
  #─────────────────────── 
  def move_toward_target(target)
    return unless target
    sx = @x - target.x
    sy = @y - target.y
    if sx == 0 and sy == 0
      return
    end
    abs_sx = sx.abs
    abs_sy = sy.abs
    if abs_sx == abs_sy
      rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
    end
    if abs_sx > abs_sy
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    else
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end
  end 
  #───────────────────────
  # ♧ 타겟을 조준하여 이동한다.
  #───────────────────────
  def move_aim_target(target)
    return unless target
    sx = @x - target.x
    sy = @y - target.y
    if sx == 0 or sy == 0#and가아님
      return
    end
    abs_sx = sx.abs
    abs_sy = sy.abs
    if abs_sx == abs_sy
      rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
    end
    if abs_sx < abs_sy
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    else
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end
  end 
  #───────────────────────
  # ♧ 타겟을 바라본다
  #───────────────────────
  def turn_toward_target(target)
    return unless target
    sx = @x - target.x
    sy = @y - target.y
    if sx == 0 and sy == 0
      return
    end
    if sx.abs > sy.abs
      sx > 0 ? turn_left : turn_right
    else
      sy > 0 ? turn_up : turn_down
    end
  end 
  #───────────────────────
  # ♧ 타겟으로부터 멀리 이동한다
  #───────────────────────
  def move_away_target(target)
    return unless target
    sx = @x - target.x
    sy = @y - target.y
    if sx == 0 and sy == 0
      return
    end
    abs_sx = sx.abs
    abs_sy = sy.abs
    if abs_sx == abs_sy
      rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
    end
    if abs_sx > abs_sy
      sx > 0 ? move_right : move_left
      if not moving? and sy != 0
        sy > 0 ? move_down : move_up
      end
    else
      sy > 0 ? move_down : move_up
      if not moving? and sx != 0
        sx > 0 ? move_right : move_left
      end
    end
  end 
  def dist(target)
    return (@x - target.x).abs + (@y - target.y).abs
  end 
  def sight_target?(target)
    return unless target
    case @direction
    when 2
      if @x == target.x and @y < target.y
        return true
      end
    when 4
      if @x > target.x and @y == target.y
        return true
      end
    when 6
      if @x < target.x and @y == target.y
        return true
      end
    when 8
      if @x == target.x and @y > target.y
        return true
      end
    end
    return false
  end    
end
def timer
  Graphics.frame_count.to_f / Graphics.frame_rate.to_f
end
class Game_Character
  #--------------------------------------------------------------------------
  # ● 이벤트
  #--------------------------------------------------------------------------
  def acr_event_setting   
    if b.dead? and @action
      return if @die
      treasure
      erase
      moveto_outside
      @die = true
      if @erase_if_dead
        event_remove(self)
      end
      return
    end
    if not b.dead?     
      if sprite != nil and @am_bullet == nil
        sprite.gauge(b.hp.to_f / b.maxhp)
      end     
      if @wait_count == 0
        if @agent
          if not moving?
            eval('agent_' + @agent)
          end         
        end       
      end
    end
    if not @summon_duration_time == nil
      if sprite != nil
        sprite.gauge_summon((timer - @summon_setting_time).to_f / @summon_duration_time.to_f)
      end     
      if timer - @summon_setting_time > @summon_duration_time.to_f
        erase
        moveto_outside
        event_remove(self)       
      end           
    end       
  end
  def battle?
    if b and not b.dead?
      return true
    else
      return false
    end
  end 
  def treasure   
    if @am_enemy == true
      if @summon_duration_time == nil
        if receiver.b.is_a?(Game_Actor)       
          receiver.b.exp += b.exp       
          display_con(sprintf("%s exp:%d 획득",receiver.b.name, b.exp))
        end
        if @drop_item
          if @drop_item_rate
            if rand(100) < @drop_item_rate           
              보관이벤트(@drop_item).moveto(x, y)
            end
          else
            보관이벤트(@drop_item).moveto(x, y)
          end         
        end     
      end     
    end
  end   
  #--------------------------------------------------------------------------
  # ● agent.플레이어
  #--------------------------------------------------------------------------
  def agent_player
    sprite.gauge(b.hp.to_f / b.maxhp)
    if b.weapon_id == 0
      desc = '[근접,40,0]'
    else
      desc = $data_weapons[b.weapon_id].description
    end
    if Input.press?(Input::C)
      if timer - self.timer_last_attack < @attack_delay.to_f
        return
      end     
      self.timer_last_attack = timer
      desc.sub(/[(.+?),([0-9]+),([0-9]+)]/) do      
        @attack_delay = ($2.to_f/40).to_f
        @attack_range = $3.to_i
        eval('weapon_p_'+ $1.to_s)
      end       
      desc.sub(/[([0-9]+)]/) do
        @bullet_id = $1.to_i
      end           
    end
  end 
############################################################################### 
# 여기부터 이벤트쪽 agent, weapon설정 
############################################################################### 
 
  #--------------------------------------------------------------------------
  # ● agent.밀리
  #--------------------------------------------------------------------------
  def agent_근접
    target = find_nearest_enemy
    unless moving?     
      move_toward_target(target)
    end
    unless moving?
      weapon_근접
    end
  end
  #--------------------------------------------------------------------------
  # ● agent.미사일
  #-------------------------------------------------------------------------- 
  def agent_거너
    target = find_nearest_enemy
    if target
      weapon_거너
    end
    if not moving?
      move_aim_target(target)
      turn_toward_target(target)
    end
  end 
  #--------------------------------------------------------------------------
  # ● agent.미사일
  #-------------------------------------------------------------------------- 
  def agent_소환사
    target = find_nearest_enemy
    if target
      weapon_소환
    end
    if not moving?
      move_aim_target(target)
      turn_toward_target(target)
    end
  end   
  #--------------------------------------------------------------------------
  # ● agent.컨트롤_미사일
  #--------------------------------------------------------------------------   
  def agent_컨트롤_거너
    target = find_nearest_enemy
    if dist(target) <= 3 + rand(2)
      move_away_target(target)
      if not moving?
        move_random
      end
    else
      move_aim_target(target)
    end   
    if sight_target?(target)
      weapon_거너
    else
      if not moving?
        move_toward_target(target)
        weapon_거너
      end
    end
  end 
  #--------------------------------------------------------------------------
  # ● agent.미사일
  #--------------------------------------------------------------------------   
  def agent_총알
    weapon_총알
    if not moving?
      move_forward
      if not moving?
        erase
        moveto_outside
        event_remove(self)               
      end
    end
  end    
  #--------------------------------------------------------------------------
  # ● 모든 적
  #--------------------------------------------------------------------------
  def all_enemies
    array = []
    for target in $game_map.events.values
      if not target.b.dead? and target.team != team
        if not target.am_bullet
          array.push(target)
        end       
      end
    end
    target = $game_player
    if not target.b.dead? and target.team != team
      array.push(target)
    end
    return array
  end
  #--------------------------------------------------------------------------
  # ● 근접 공격
  #--------------------------------------------------------------------------
  def weapon_근접
    if timer - self.timer_last_attack < @attack_delay.to_f
      return
    end       
    d = @direction
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    for target in all_enemies
      if target.x == new_x and target.y == new_y
        self.timer_last_attack = timer
        if self.b.is_a?(Game_Actor)
          target.animation_id = $data_weapons[b.weapon_id].animation2_id
        else         
          target.animation_id = $data_enemies[b.id].animation2_id
        end               
        if self.onwer
          target.receiver = self.onwer
        else
          target.receiver = self
        end       
        target.b.attack_effect(b)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 총알 공격
  #-------------------------------------------------------------------------- 
  def weapon_거너
    if timer - self.timer_last_attack < @attack_delay.to_f
      return
    end           
    self.timer_last_attack = timer
    d = direction
    new_x = x
    new_y = y
    c = 보관이벤트(@summon_event_id)
    c.battler = self.b.dup
    c.agent = "총알"
    c.team = self.team
    c.am_bullet = true
    c.moveto(new_x, new_y)
    c.instance_eval{@direction = d}
  end 
  #--------------------------------------------------------------------------
  # ● 소환 공격
  #-------------------------------------------------------------------------- 
  def weapon_소환
    if timer - self.timer_last_attack < @attack_delay.to_f
      return
    end           
    self.timer_last_attack = timer
    d = direction
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    c = 보관이벤트(@summon_event_id)
    c.moveto(new_x, new_y)
    c.instance_eval{@direction = d}
  end   
  #--------------------------------------------------------------------------
  # ● 총알 공격
  #--------------------------------------------------------------------------   
  def weapon_총알
    for target in all_enemies
      if target.x == x and target.y == y and not target.am_bullet
        if self.onwer
          target.receiver = self.onwer
        else
          target.receiver = self
        end
        target.b.attack_effect(b)
        if self.b.is_a?(Game_Actor)
          target.animation_id = $data_weapons[b.weapon_id].animation2_id
        else         
          target.animation_id = $data_enemies[b.id].animation2_id
        end               
        erase
        moveto_outside
        event_remove(self)       
      end
    end
  end 
############################################################################### 
# 여기부터 플레이어쪽 agent, weapon설정 
############################################################################### 
  #--------------------------------------------------------------------------
  # ● 플레이어용_근접 공격
  #--------------------------------------------------------------------------
  def weapon_p_근접
    d = @direction
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    for target in all_enemies
      if target.x == new_x and target.y == new_y
        if b.weapon_id == 0
          target.animation_id = 4
        else
          target.animation_id = $data_weapons[b.weapon_id].animation2_id
        end       
        target.receiver = self
        target.b.attack_effect(b)
      end
    end
  end   
  #--------------------------------------------------------------------------
  # ● 플레이어용_일직선 공격
  #--------------------------------------------------------------------------
  def weapon_p_일직선
    d = @direction      
    for target in all_enemies
      for r in 1..@attack_range
        new_x = x + (d == 6 ? r : d == 4 ? -r : 0)
        new_y = y + (d == 2 ? r : d == 8 ? -r : 0)
        if target.x == new_x and target.y == new_y
          if b.weapon_id == 0
            target.animation_id = 4
          else
            target.animation_id = $data_weapons[b.weapon_id].animation2_id
          end       
          target.receiver = self
          target.b.attack_effect(b)
        end
      end     
    end
  end     
  #--------------------------------------------------------------------------
  # ● agent.플레이어_미사일
  #--------------------------------------------------------------------------   
  def agent_p_총알
    weapon_p_총알
    if not moving?
      @range_count+=1
      if @range_count > o_atk_r
        erase
        moveto_outside
        event_remove(self)       
      end           
      move_forward
      if not moving?
        erase
        moveto_outside
        event_remove(self)
      end
    end
  end  
  #--------------------------------------------------------------------------
  # ● 플레이어용 총알 공격
  #-------------------------------------------------------------------------- 
  def weapon_p_거너
    d = direction
    new_x = x #+ (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y #+ (d == 2 ? 1 : d == 8 ? -1 : 0)
    if @bullet_id != nil
      c = 보관이벤트(@bullet_id)
      c.battler = self.b.dup
      c.agent = 'p_총알'
      c.team = self.team
      c.o_atk_r = @attack_range
      c.am_bullet = true
      c.moveto(new_x, new_y)
      c.instance_eval{@direction = d}
    end   
  end
  #--------------------------------------------------------------------------
  # ● 플레이어용 총알 공격
  #--------------------------------------------------------------------------   
  def weapon_p_총알
    for target in all_enemies
      if target.x == x and target.y == y and not target.am_bullet
        target.b.attack_effect(b)
        if b.weapon_id == 0
          target.animation_id = 4
        else
          target.animation_id = $data_weapons[b.weapon_id].animation2_id
        end              
        target.receiver = $game_player
        erase
        moveto_outside
        event_remove(self)       
      end
    end
  end   
end
class Sprite_Character
  alias update_before_sprite_addon update
  def update
    update_before_sprite_addon
    if @character.battle?
      b = @character.battler
      if b.damage
        @character.sprite_damage = b.damage
        @character.sprite_damage_critical = b.critical
        b.damage = nil
        b.critical = nil
      end
    end   
    update_damage
  end
  #damage_output
  def damage_output(value, critical)
    dispose_damage
    if value.is_a?(Numeric)
      damage_string = value.abs.to_s
    else
      damage_string = value.to_s
    end
    bitmap = Bitmap.new(80, 24)
    bitmap.font.name = 'Arial Black'
    bitmap.font.size = 16
    bitmap.font.color.set(0, 0, 0)
    bitmap.draw_text(-1, 6-1, 80, 18, damage_string, 1)
    bitmap.draw_text(+1, 6-1, 80, 18, damage_string, 1)
    bitmap.draw_text(-1, 6+1, 80, 18, damage_string, 1)
    bitmap.draw_text(+1, 6+1, 80, 18, damage_string, 1)
    if value.is_a?(Numeric) and value < 0
      bitmap.font.color.set(176, 255, 144)
    else
      bitmap.font.color.set(255, 255, 255)
    end
    bitmap.draw_text(0, 6, 80, 18, damage_string, 1)
    if critical
      bitmap.font.size = 10
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, -1, 80, 10, 'CRITICAL', 1)
      bitmap.draw_text(+1, -1, 80, 10, 'CRITICAL', 1)
      bitmap.draw_text(-1, +1, 80, 10, 'CRITICAL', 1)
      bitmap.draw_text(+1, +1, 80, 10, 'CRITICAL', 1)
      bitmap.font.color.set(255, 255, 255)
      bitmap.draw_text(0, 0, 80, 10, 'CRITICAL', 1)
    end
    @_damage_sprite = ::Sprite.new(self.viewport)
    @_damage_sprite.bitmap = bitmap
    @_damage_sprite.ox = 40
    @_damage_sprite.oy = 10
    @_damage_sprite.x = self.x
    @_damage_sprite.y = self.y - self.oy / 2
    @_damage_sprite.z = self.z+999
    @_damage_duration = 40
  end 
  def update_damage
    if @character.sprite_damage != nil
      damage_output(@character.sprite_damage, @character.sprite_damage_critical)
      @character.sprite_damage = nil
    end
  end 
end

class Sprite_Character < Sprite_Character
  def update
    super
    if @_gauge_setup then
      @_gauge_sprite_b.x = self.x
      @_gauge_sprite_b.y = self.y - self.oy
      @_gauge_sprite.x = self.x
      @_gauge_sprite.y = self.y - self.oy
    end
  end
  def gauge(p)
    setup_gauge if not @_gauge_setup
    @_gauge_sprite.src_rect = Rect.new(0, 0, p * 30, 2)
  end
  def setup_gauge
    dispose_gauge
    @_gauge_setup = true
    @_gauge_sprite = Sprite.new(self.viewport)
    @_gauge_sprite.bitmap = Bitmap.new(30, 2)
    @_gauge_sprite.bitmap.fill_rect(0, 0, 30, 2, Color.new(255, 0, 0))
    @_gauge_sprite.ox = 15
    @_gauge_sprite.oy = -1
    @_gauge_sprite.z = 1000
    @_gauge_sprite_b = Sprite.new(self.viewport)
    @_gauge_sprite_b.bitmap = Bitmap.new(32, 4)
    @_gauge_sprite_b.bitmap.fill_rect(0, 0, 32, 4, Color.new(0, 0, 0))
    @_gauge_sprite_b.bitmap.fill_rect(1, 1, 30, 2, Color.new(0, 0, 0))
    @_gauge_sprite_b.ox = 16
    @_gauge_sprite_b.oy = 0
    @_gauge_sprite_b.z = 999
  end
  def dispose_gauge
    return if not @_gauge_setup
    @_gauge_setup = false
    @_gauge_sprite.dispose
    @_gauge_sprite_b.dispose
  end
  def dispose
    dispose_gauge
    super
  end
end

class Sprite_Character < Sprite_Character
  def update
    super
    if @_gauge_s_setup then
      @_gauge_s_sprite_b.x = self.x
      @_gauge_s_sprite_b.y = self.y - self.oy
      @_gauge_s_sprite.x = self.x
      @_gauge_s_sprite.y = self.y - self.oy
    end
  end
  def gauge_summon(p)
    setup_s_gauge if not @_gauge_s_setup
    @_gauge_s_sprite.src_rect = Rect.new(0, 0, (1-p)*30 , 2)
    #@_gauge_sp_duration = 255
  end
  def setup_s_gauge
    dispose_s_gauge
    @_gauge_s_setup = true
    @_gauge_s_sprite = Sprite.new(self.viewport)
    @_gauge_s_sprite.bitmap = Bitmap.new(30, 2)
    @_gauge_s_sprite.bitmap.fill_rect(0, 0, 30, 2, Color.new(0, 255, 0))
    @_gauge_s_sprite.ox = 15
    @_gauge_s_sprite.oy = -5
    @_gauge_s_sprite.z = 1000
    @_gauge_s_sprite_b = Sprite.new(self.viewport)
    @_gauge_s_sprite_b.bitmap = Bitmap.new(32, 4)
    @_gauge_s_sprite_b.bitmap.fill_rect(0, 0, 32, 4, Color.new(0, 0, 0))
    @_gauge_s_sprite_b.bitmap.fill_rect(1, 1, 30, 2, Color.new(0, 0, 0))
    @_gauge_s_sprite_b.ox = 16
    @_gauge_s_sprite_b.oy = -4
    @_gauge_s_sprite_b.z = 999
  end
  def dispose_s_gauge
    return if not @_gauge_s_setup
    @_gauge_s_setup = false
    @_gauge_s_sprite.dispose
    @_gauge_s_sprite_b.dispose
  end
  def dispose
    dispose_s_gauge
    super
  end
end
#=================================================
# ■ 보관이벤트
#-------------------------------------------------
#  제작자: 비밀소년
#   p.s 안쓰는부분은 없앴음
#=================================================
def event_remove(event)
  remove_sprite event
  $game_map.events.delete event.id
end

def 소환물다지워!
  for dst in 20001..20500
    event = $game_map.events[dst]
    remove_sprite event
    $game_map.events.delete dst
  end
end

def 보관이벤트(id)
  for dst in 20001..20500
    if $game_map.events[dst] == nil
      return 보관이벤트_a(dst, id)
    end
  end
  return nil
end

def 보관이벤트_a(dst, id)
  if not $bo_map
    $bo_map = load_data(sprintf("Data/Map%03d.rxdata", 1))
  end
  $game_map.instance_eval do
    @events[dst] = Game_Event.new(@map_id, $bo_map.events[id])
  end
  $game_map.events[dst].instance_eval do
    @id = dst
  end
  $game_map.events[dst].moveto(rand($game_map.width), rand($game_map.height))
  create_sprite $game_map.events[dst]
 
  return $game_map.events[dst]
end

def create_sprite(c)
  if $scene.is_a?(Scene_Map)
    $scene.instance_eval do
      @spriteset.instance_eval do
        @character_sprites.each do |v|
          if v.character == c
            return v
          end
        end
        sprite = Sprite_Character.new(@viewport1, c)
        @character_sprites.push(sprite)
      end
    end
  end
  return nil
end

def remove_sprite(c)
  if $scene.is_a?(Scene_Map)
    $scene.instance_eval do
      @spriteset.instance_eval do
        delv = nil
        @character_sprites.each do |v|
          if v.character == c
            delv = v
          end
        end
        if delv
          delv.dispose
          @character_sprites.delete delv
        end
      end
    end
  end
  return nil
end
class Game_Character
  #--------------------------------------------------------------------------
  # ● 플레이어용 소환 스킬
  #   사용법: $game_player.소환스킬(이벤트번호, 스킬번호, 딜레이) 
  #-------------------------------------------------------------------------- 
  def 소환스킬(n, v_n, del)
    delay = (del.to_f/40).to_f
    if (timer.to_f - $skill_v[v_n].to_f).to_f < delay.to_f
      return
    end     
    $skill_v[v_n] = timer.to_f
    d = direction
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    return if not self.passable?(new_x, new_y, 0)
    c = 보관이벤트(n)
    c.moveto(new_x, new_y)
    c.onwer = self
    c.instance_eval{@direction = d}
  end 
  #--------------------------------------------------------------------------
  # ● 플레이어용 근접공격 스킬
  #   사용법: $game_player.근접스킬(데미지배율, 스킬번호, 딜레이, 애니번호)
  #-------------------------------------------------------------------------- 
  def 근접스킬(n, v_n, del, ani)
    delay = (del.to_f/40).to_f
    if (timer.to_f - $skill_v[v_n].to_f).to_f < delay.to_f
      return
    end     
    $skill_v[v_n] = timer.to_f
    d = @direction
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    for target in all_enemies
      if target.x == new_x and target.y == new_y
        if ani == 0
          target.animation_id = 4
        else
          target.animation_id = ani
        end       
        target.receiver = self
        target.b.attack_effect2(b, n)
      end
    end
  end  
  #--------------------------------------------------------------------------
  # ● 플레이어용 일직선공격 스킬
  #   사용법: $game_player.근접스킬(데미지배율, 스킬번호, 딜레이, 사정거리, 애니번호)
  #-------------------------------------------------------------------------- 
  def 일직선스킬(n, v_n, del, ran, ani)
    delay = (del.to_f/40).to_f
    if (timer.to_f - $skill_v[v_n].to_f).to_f < delay.to_f
      return
    end     
    $skill_v[v_n] = timer.to_f
    d = @direction      
    for target in all_enemies
      for r in 1..ran
        new_x = x + (d == 6 ? r : d == 4 ? -r : 0)
        new_y = y + (d == 2 ? r : d == 8 ? -r : 0)
        if target.x == new_x and target.y == new_y
          if ani == 0
            target.animation_id = 4
          else
            target.animation_id = ani
          end       
          target.receiver = self
          target.b.attack_effect2(b, n)
        end
      end     
    end
  end    
  #--------------------------------------------------------------------------
  # ● 플레이어용 총알 스킬
  #   사용법: $game_player.총알스킬(데미지배율, 스킬번호, 딜레이, 사정거리, 애니번호, 이벤트 번호)
  #-------------------------------------------------------------------------- 
  def 총알스킬(n, v_n, del, ran, ani, ev_n)
    delay = (del.to_f/40).to_f
    if (timer.to_f - $skill_v[v_n].to_f).to_f < delay.to_f
      return
    end     
    $skill_v[v_n] = timer.to_f
    d = @direction      
    new_x = x #+ (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y #+ (d == 2 ? 1 : d == 8 ? -1 : 0)
    c = 보관이벤트(1)
    c.battler = self.b.dup
    $skill_arrow_range = ran
    $skill_damage_rate = n
    $skill_ani = ani
    c.agent = 'p_총알_스킬($skill_arrow_range, $skill_damage_rate, $skill_ani)'
    c.team = self.team
    c.o_atk_r = @attack_range
    c.am_bullet = true
    c.moveto(new_x, new_y)
    c.instance_eval{@direction = d}   
    if @delay == nil or @delay == 0
      @delay = 2
    else
      @delay -= 1
      return
    end    
  end      
  def agent_p_총알_스킬(ran, n, ani)
    weapon_p_총알_스킬(n, ani)
    if not moving?
      @range_count+=1
      if @range_count > ran
        erase
        moveto_outside
        event_remove(self)       
      end           
      move_forward
      if not moving?
        erase
        moveto_outside
        event_remove(self)
      end
    end
  end  
  def weapon_p_총알_스킬(n, ani)
    for target in all_enemies
      if target.x == x and target.y == y and not target.am_bullet
        if ani == 0
          target.animation_id = 4
        else
          target.animation_id = ani
        end       
        target.receiver = self
        target.b.attack_effect2(b, n)
        erase
        moveto_outside
        event_remove(self)       
      end
    end
  end     
end

class Game_Battler
  def attack_effect2(attacker, attack_rate)
    self.critical = false
    hit_result = (rand(100) < attacker.hit)
    if hit_result == true
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end
      end
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    if hit_result == true
      remove_states_shock
      self.damage *= attack_rate
      self.damage = self.damage.to_i
      self.hp -= self.damage
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    else
      self.damage = "Miss"
      self.critical = false
    end
    return true
  end
end
class Skill_Variables
  def initialize
    @data = []
  end
  def [](variable_id)
    if variable_id <= 200 and @data[variable_id] != nil
      return @data[variable_id]
    else
      return 0
    end
  end
  def []=(variable_id, value)
    if variable_id <= 200
      @data[variable_id] = value
    end
  end
end
#=================================================
# ■ comment_command
#-------------------------------------------------
#  제작자: 비밀소년
#  설명: 주석으로 이벤트를 초기화시킵니다.
#=================================================

class Game_Event
  def read_comment(command)
    case command
    when /battler = actor ([0-9]+)/
      @battler = $game_actors[$1.to_i]
      @am_enemy = false
      @action = true
    when /battler = enemy ([0-9]+)/
      @battler = Game_SingleEnemy.new($1.to_i)
      @am_enemy = true
      @action = true
    when /team = ([0-9]+)/
      @team = $1.to_i
    when /agent = (.*)/
      @agent = $1
    when /delay = ([0-9]+)/
      @attack_delay = ($1.to_f/40).to_f
    when /drop_item = ([0-9]+)/
      @drop_item = $1.to_i     
    when /regen_time = ([0-9]+)/
      @regen_time = $1.to_i
      @regen_count = 0
    when /drop_rate = ([0-9]+)/
      @drop_item_rate = $1.to_i
    when /summon_event_id = ([0-9]+)/
      @summon_event_id = $1.to_i     
    when /duration_time = ([0-9]+)/
      @summon_duration_time = $1.to_i           
      @summon_setting_time = timer
    when /script = (.*)/
      eval($1)
    when /erase if dead/
      @erase_if_dead = true
    end
  end
  alias refresh_before_cmtcmd refresh
  def refresh
    refresh_before_cmtcmd
    unless @erased or @page == nil
      unless @my_comment_read_page == @page
        @my_comment_read_page = @page
        for v in @page.list
          if (v.code == 108 or v.code == 408)
            read_comment(v.parameters[0].dup)
          end
        end
      end
    end
  end
end
class Game_Character
  attr_accessor :item_sprite_id
  attr_accessor :color
end

class Sprite_Character
  alias id_item update
  def item_id(text, color)
    @color = color
    bitmap = Bitmap.new(160, 16)
    bitmap.font.name = "굴림"
    bitmap.font.size = 12
    bitmap.font.color.set(0, 0, 0)
    bitmap.draw_text(+1, +1, 160, 16, text, 1)
    if @color == "빨강"
      bitmap.font.color.set(255, 0, 0)
    elsif @color == "초록"
      bitmap.font.color.set(0, 255, 0)
    elsif @color == "파랑"
      bitmap.font.color.set(0, 0, 255)      
    elsif @color == "노랑"
      bitmap.font.color.set(255, 255, 0)      
    elsif @color == "주황"
      bitmap.font.color.set(200, 80, 80)            
    elsif @color == "흰색"
      bitmap.font.color.set(255, 255, 255)                  
    elsif @color == "갈색"
      bitmap.font.color.set(210, 145, 70)                        
    end   
    bitmap.draw_text(0, 0, 160, 16, text, 1)
    @_id_item = Sprite.new(self.viewport)
    @_id_item.bitmap = bitmap
    @_id_item.ox = 80
    @_id_item.oy = 14
    @_id_item.x = self.x
    @_id_item.y = self.y - self.oy / 2
    @_id_item.z = 3000
    @_id_item_visible = true
  end

  def dispose_id_item
    @_id_item.dispose
    @_id_item_visible = false
  end
 
  def update_id_item
    if @character.item_sprite_id != nil
      if not @_id_item_visible
        item_id(@character.item_sprite_id, @character.color)
      end
      @_id_item.x = self.x
      @_id_item.y = self.y - self.oy
    else
      if @_id_item_visible
        dispose_id_item
      end
    end
  end
     
  def update
    id_item
    update_id_item
  end
end

class Game_Event
  alias item_id_update update
  def update
    item_id_update
    if Input.press?(Input::ALT)
      text = @event.name.dup
      text.gsub!(/[[Ii][Tt][Ee][Mm](.+?),(.+?)]/) do
        @item_sprite_id = $1
        if not @item_sprite_id == nil
          @color = $2.to_s
        end     
      end
      @item_sprite_id = nil if @erased
      @item_sprite_id = nil if @character_name == ""
    else
      @item_sprite_id = nil
      @color = nil
    end
  end 
end
#=================================================
# ■ Game_SingleEnemy
#-------------------------------------------------
#  제작자: 비밀소년
#  설명: Game_Troop과 상관없이 Enemy를 초기화시킵니다.
#=================================================

class Game_SingleEnemy < Game_Battler
  #───────────────────────
  # ♧ 오브젝트 초기화
  #───────────────────────
  def initialize(enemy_id)
    super()
    @enemy_id = enemy_id
    enemy = $data_enemies[@enemy_id]
    @battler_name = enemy.battler_name
    @battler_hue = enemy.battler_hue
    @hp = maxhp
    @sp = maxsp
  end
  #--------------------------------------------------------------------------
  # ● 에너미 ID 취득
  #--------------------------------------------------------------------------
  def id
    return @enemy_id
  end
  #--------------------------------------------------------------------------
  # ● 이름의 취득
  #--------------------------------------------------------------------------
  def name
    return $data_enemies[@enemy_id].name
  end
  #--------------------------------------------------------------------------
  # ● 기본 MaxHP 의 취득
  #--------------------------------------------------------------------------
  def base_maxhp
    return $data_enemies[@enemy_id].maxhp
  end
  #--------------------------------------------------------------------------
  # ● 기본 MaxSP 의 취득
  #--------------------------------------------------------------------------
  def base_maxsp
    return $data_enemies[@enemy_id].maxsp
  end
  #--------------------------------------------------------------------------
  # ● 기본 완력의 취득
  #--------------------------------------------------------------------------
  def base_str
    return $data_enemies[@enemy_id].str
  end
  #--------------------------------------------------------------------------
  # ● 기본 손재주가 있음의 취득
  #--------------------------------------------------------------------------
  def base_dex
    return $data_enemies[@enemy_id].dex
  end
  #--------------------------------------------------------------------------
  # ● 기본 민첩함의 취득
  #--------------------------------------------------------------------------
  def base_agi
    return $data_enemies[@enemy_id].agi
  end
  #--------------------------------------------------------------------------
  # ● 기본 마력의 취득
  #--------------------------------------------------------------------------
  def base_int
    return $data_enemies[@enemy_id].int
  end
  #--------------------------------------------------------------------------
  # ● 기본 공격력의 취득
  #--------------------------------------------------------------------------
  def base_atk
    return $data_enemies[@enemy_id].atk
  end
  #--------------------------------------------------------------------------
  # ● 기본 물리 방어의 취득
  #--------------------------------------------------------------------------
  def base_pdef
    return $data_enemies[@enemy_id].pdef
  end
  #--------------------------------------------------------------------------
  # ● 기본 마법 방어의 취득
  #--------------------------------------------------------------------------
  def base_mdef
    return $data_enemies[@enemy_id].mdef
  end
  #--------------------------------------------------------------------------
  # ● 기본 회피 수정의 취득
  #--------------------------------------------------------------------------
  def base_eva
    return $data_enemies[@enemy_id].eva
  end
  #--------------------------------------------------------------------------
  # ● 통상 공격 공격측 애니메이션 ID 의 취득
  #--------------------------------------------------------------------------
  def animation1_id
    return $data_enemies[@enemy_id].animation1_id
  end
  #--------------------------------------------------------------------------
  # ● 통상 공격 대상측 애니메이션 ID 의 취득
  #--------------------------------------------------------------------------
  def animation2_id
    return $data_enemies[@enemy_id].animation2_id
  end
  #--------------------------------------------------------------------------
  # ● 속성 보정치의 취득
  #     element_id : 속성 ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # 속성 유효도에 대응하는 수치를 취득
    table = [0,200,150,100,50,0,-100]
    result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
    # 스테이트에서 이 속성이 방어되고 있는 경우는 반감
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # 메소드 종료
    return result
  end
  #--------------------------------------------------------------------------
  # ● 스테이트 유효도의 취득
  #--------------------------------------------------------------------------
  def state_ranks
    return $data_enemies[@enemy_id].state_ranks
  end
  #--------------------------------------------------------------------------
  # ● 스테이트 방어 판정
  #     state_id : 스테이트 ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    return false
  end
  #--------------------------------------------------------------------------
  # ● 통상 공격의 속성 취득
  #--------------------------------------------------------------------------
  def element_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 통상 공격의 스테이트 변화 (+) 취득
  #--------------------------------------------------------------------------
  def plus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 통상 공격의 스테이트 변화 (-) 취득
  #--------------------------------------------------------------------------
  def minus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 액션의 취득
  #--------------------------------------------------------------------------
  def actions
    return $data_enemies[@enemy_id].actions
  end
  #--------------------------------------------------------------------------
  # ● EXP 의 취득
  #--------------------------------------------------------------------------
  def exp
    return $data_enemies[@enemy_id].exp
  end
  #--------------------------------------------------------------------------
  # ● 골드의 취득
  #--------------------------------------------------------------------------
  def gold
    return $data_enemies[@enemy_id].gold
  end
  #--------------------------------------------------------------------------
  # ● 아이템 ID 의 취득
  #--------------------------------------------------------------------------
  def item_id
    return $data_enemies[@enemy_id].item_id
  end
  #--------------------------------------------------------------------------
  # ● 무기 ID 의 취득
  #--------------------------------------------------------------------------
  def weapon_id
    return $data_enemies[@enemy_id].weapon_id
  end
  #--------------------------------------------------------------------------
  # ● 방어구 ID 의 취득
  #--------------------------------------------------------------------------
  def armor_id
    return $data_enemies[@enemy_id].armor_id
  end
  #--------------------------------------------------------------------------
  # ● 트레이닝 전기밥통 출현율의 취득
  #--------------------------------------------------------------------------
  def treasure_prob
    return $data_enemies[@enemy_id].treasure_prob
  end
  #--------------------------------------------------------------------------
  # ● 배틀 화면 Z 좌표의 취득
  #--------------------------------------------------------------------------
  def screen_z
    return screen_y
  end
  #--------------------------------------------------------------------------
  # ● 도망친다
  #--------------------------------------------------------------------------
  def escape
    # 히두후라그를 세트
    @hidden = true
    # 경향 액션을 클리어
    self.current_action.clear
  end
  #--------------------------------------------------------------------------
  # ● 변신
  #     enemy_id : 변신처의 에너미 ID
  #--------------------------------------------------------------------------
  def transform(enemy_id)
    # 에너미 ID 를 변경
    @enemy_id = enemy_id
    # 버틀러 그래픽을 변경
    @battler_name = $data_enemies[@enemy_id].battler_name
    @battler_hue = $data_enemies[@enemy_id].battler_hue
    # 액션재작성
    make_action
  end
  #--------------------------------------------------------------------------
  # ● 액션 작성
  #--------------------------------------------------------------------------
  def make_action
    # 경향 액션을 클리어
    self.current_action.clear
    # 움직일 수 없는 경우
    unless self.movable?
      # 메소드 종료
      return
    end
    # 현재 유효한 액션을 추출
    available_actions = []
    rating_max = 0
    for action in self.actions
      # 턴 조건 확인
      n = $game_temp.battle_turn
      a = action.condition_turn_a
      b = action.condition_turn_b
      if (b == 0 and n != a) or
         (b > 0 and (n < 1 or n < a or n % b != a % b))
        next
      end
      # HP 조건 확인
      if self.hp * 100.0 / self.maxhp > action.condition_hp
        next
      end
      # 레벨 조건 확인
      if $game_party.max_level < action.condition_level
        next
      end
      # 스윗치 조건 확인
      switch_id = action.condition_switch_id
      if switch_id > 0 and $game_switches[switch_id] == false
        next
      end
      # 조건에 해당 : 이 액션을 추가
      available_actions.push(action)
      if action.rating > rating_max
        rating_max = action.rating
      end
    end
    # 최대의 레이팅치를 3 으로서 합계를 계산 (0 이하는 제외)
    ratings_total = 0
    for action in available_actions
      if action.rating > rating_max - 3
        ratings_total += action.rating - (rating_max - 3)
      end
    end
    # 레이팅의 합계가 0 이 아닌 경우
    if ratings_total > 0
      # 난수를 작성
      value = rand(ratings_total)
      # 작성한 난수에 대응하는 것을 경향 액션으로 설정
      for action in available_actions
        if action.rating > rating_max - 3
          if value < action.rating - (rating_max - 3)
            self.current_action.kind = action.kind
            self.current_action.basic = action.basic
            self.current_action.skill_id = action.skill_id
            self.current_action.decide_random_target_for_enemy
            return
          else
            value -= action.rating - (rating_max - 3)
          end
        end
      end
    end
  end
  #───────────────────────
  # ♧ 트룹의 흔적을 없애버린다.
  #───────────────────────
  def index
    return 0
  end
  def screen_x
    return 0
  end
  def screen_y
    return 0
  end
end
class Game_Console
  def initialize
    @display_sprite = Sprite.new
    @display_sprite.x += 5
    @display_sprite.y += 150
    @display_sprite.z = 999999
    @display_sprite.bitmap = Bitmap.new(200,200)
    @display_sprite.bitmap.font.color = Color.new(0,0,0,255)
    @display_sprite.bitmap.font.size = 18
    @display_sprite.src_rect.set(0, 0, 200, 200)
    @display_y = 0
    @number_of_display = 0 
  end   
  def update
    if @display_sprite.nil? or @display_sprite.disposed?
      @display_sprite = Sprite.new
      @display_sprite.x += 5
      @display_sprite.y += 150
      @display_sprite.z = 999999
      @display_sprite.bitmap = Bitmap.new(200,200)
      @display_sprite.bitmap.font.color = Color.new(0,0,0,255)
      @display_sprite.bitmap.font.size = 18
      @display_sprite.src_rect.set(0, 0, 200, 200)
      @display_y = 0
      @number_of_display = 0
    end   
    if @display_y > 0
      @number_of_display += 1
      if @number_of_display > 100
        @display_sprite.bitmap.clear
        @number_of_display = 0
        @display_y = 0
        @display_sprite.oy = 0
        @display_sprite.src_rect.set(0, 0, 200, 200)
      end
    end   
  end 
  def add_to_display(text)
    @number_of_display = 0
    text = text.split("n")
    if @display_y > 0 and @display_y/4 > 32
      @display_sprite.bitmap.clear
      @display_y = 0
    end
    # Draw text
    if text.is_a?(String)
      @display_sprite.bitmap.draw_text(0,@display_y,100,32, "#{text}")
      @display_y += 32
    else
      for t in text
        next if t.nil?
        @display_sprite.bitmap.draw_text(0,@display_y,100,32, "#{t}")
        @display_y += 32
      end
    end
  end
end
class Scene_Map
  alias console_update update
  alias console_ini initialize
  def initialize
    console_ini
    $console = Game_Console.new
    $skill_v = Skill_Variables.new
  end 
  def update      
    console_update
    $console.update   
  end
end
def display_con(text)
  $console.add_to_display(text)
end


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 13205
RMXP 아이거모르면망하는데. 2 King_ 2010.09.30 791
RMXP 캐릭터를 만들었는데요.. 1 깡패토끼0401 2010.09.30 776
RMXP RPG XP질문 1 니키 2010.09.30 640
RMVX Bitmap, Sprite Class에 대한 질문입니다. 4 녹색주머니 2010.09.30 723
RMVX 전투할때 몬스터의 hp가 나오게 하는 법 1 류한서 2010.09.30 890
RMXP 액알 스크립트 수정해주실분?; 1 다코야끼 2010.09.29 1012
RMVX 사이드뷰 관련 질문입니다. 1 니노미야 2010.09.29 679
RMVX 그래픽 3 스노우 2010.09.28 683
RMVX 에러가 나네요.... 4 잉여잉어빵 2010.09.28 806
RMXP 넷플레이 버젼 추전좀요 다코야끼 2010.09.28 730
RM2k 자전거 타기 대회 만들다가 ㅋㅋ 3 유리가발 2010.09.28 1071
RMXP 생초보인데 오프닝 만드는 것좀 도와주세여 1 황제님 2010.09.28 957
RMVX 게임 올리기 2 안드로이드 2010.09.27 872
RMVX vx 런타임패키지 3 뭔지도모름 2010.09.27 2314
RMVX rpgvx 캐릭터 할때 주인공 한명밖에 없어요 2 뭔지도모름 2010.09.27 872
RMVX 광원효과는 VX에 없는건가요 ? 9 유아린 2010.09.27 1278
게임찾기 예전에 게임공작소에 있던 게임인데.. 찾아주세요 ! 사탕 2010.09.26 1065
RMXP RPG XP질문 1 니키 2010.09.26 735
RMXP RPG XP 문 열기, 스위치 조작등 2 니키 2010.09.26 1511
RMXP 이벤트의 그래픽을 변경하려면 어떻게 해야하나요...? 1 꿀호꿈하 2010.09.26 706
Board Pagination Prev 1 ... 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 Next
/ 517