XP 스크립트

#==============================================================================
# ■ My_AcR_Base
#------------------------------------------------------------------------------
#  액알을 위한 static 클래스
#                                                coded by Bimilist
#==============================================================================
class My_AcR_Base
  #--------------------------------------------------------------------------
  # ● 타겟이 1칸 이내라면 공격!
  #--------------------------------------------------------------------------
  def self.AttackShort(event, target, damage, delay)
    if self.Distance(event, target) == 1
      self.Damage(target, damage)
      target.animation_id = 4
      event.wait_count = (delay * 40).to_i
    end
  end
  #--------------------------------------------------------------------------
  # ● 모든 적을 반환!
  #--------------------------------------------------------------------------
  def self.iterate_enemy(event)
    for target in $game_map.events.values
      if target.AcR and not target.erased and event.team != target.team and target.hp > 0
        yield target
      end
    end
    target = $game_player
    if event.team != target.team
      yield target
    end
  end
  #--------------------------------------------------------------------------
  # ● 거리를 구한다
  #--------------------------------------------------------------------------
  def self.Distance(event, target)
    return (event.x - target.x).abs + (event.y - target.y).abs
  end
  #--------------------------------------------------------------------------
  # ● 이벤트에게 데미지를 준다
  #--------------------------------------------------------------------------
  def self.Damage(target, damage)
    target.hp -= damage
    if target == $game_player
      $game_temp.gameover = $game_party.all_dead?
    end
    if target.team == 1
      self.Gauge(1, target)
    else
      if target.hp != 0 or target.gold == 0
        self.Gauge(2, target)
      else
        target.animation_id = 1
        self.Gauge(1, nil, "exp + " + target.exp.to_s)
        self.Gauge(2, nil, "gold + " + target.gold.to_s)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 게이지를 보인다
  #--------------------------------------------------------------------------
  def self.Gauge(team = 1, target = $game_player, txt = nil)
    if team == nil
      if $my_wnd_guage != nil and not $my_wnd_guage.disposed?
        $my_wnd_guage.dispose
      end
      if $my_wnd_guage2 != nil and not $my_wnd_guage2.disposed?
        $my_wnd_guage2.dispose
      end
    end
    if team == 1
      if $my_wnd_guage == nil or $my_wnd_guage.disposed?
        $my_wnd_guage = My_Wnd_Gauge.new
        $my_wnd_guage.x = 640 - $my_wnd_guage.width
        $my_wnd_guage.y = 0
        $my_wnd_guage.back_opacity = 160
      end
      if txt == nil
        $my_wnd_guage.hp(target)
      else
        $my_wnd_guage.txt(txt)
      end
    end
    if team == 2
      if $my_wnd_guage2 == nil or $my_wnd_guage2.disposed?
        $my_wnd_guage2 = My_Wnd_Gauge.new
        $my_wnd_guage2.x = 640 - $my_wnd_guage2.width
        $my_wnd_guage2.y = 64
        $my_wnd_guage2.back_opacity = 160
      end
      if txt == nil
        $my_wnd_guage2.hp(target)
      else
        $my_wnd_guage2.txt(txt)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 살아있는 사람을 리더로
  #--------------------------------------------------------------------------
  def self.FocusAlive
    for i in 0..($game_party.actors.size - 1)
      if $game_party.actors[0].hp == 0
        self.PartyRotate
      end
    end
  end
  def self.FocusAliveBackward
    for i in 0..($game_party.actors.size - 1)
      if $game_party.actors[0].hp == 0
        self.PartyRotateBackward
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 파티를 돌린다
  #--------------------------------------------------------------------------
  def self.PartyRotate
    if $game_party.actors.size >= 2
      actor = $game_party.actors[0]
      for i in 0..($game_party.actors.size - 2)
        $game_party.actors[i] = $game_party.actors[i + 1]
      end
      $game_party.actors[$game_party.actors.size - 1] = actor
      $game_player.refresh
    end
  end
  def self.PartyRotateBackward
    if $game_party.actors.size >= 2
      actor = $game_party.actors[$game_party.actors.size - 1]
      for i in 0..($game_party.actors.size - 2)
        j = $game_party.actors.size - 2 - i
        $game_party.actors[j + 1] = $game_party.actors[j]
      end
      $game_party.actors[0] = actor
      $game_player.refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 팀의 남은 사람수 가져오기
  #--------------------------------------------------------------------------
  def self.Team_Alive(team)
    alive = 0
    for target in $game_map.events.values
      if target.AcR and not target.erased and target.team == team
        alive += 1
      end
    end
    return alive
  end
  #--------------------------------------------------------------------------
  # ● 리더 ID 가져오기
  #--------------------------------------------------------------------------
  def self.get_leader_id
    return $game_party.actors[0].id
  end
  #--------------------------------------------------------------------------
  # ● 밀치기
  #--------------------------------------------------------------------------
  def self.move_route_push(target, direction)
    move_route = RPG::MoveRoute.new
    move_route.list = [
      RPG::MoveCommand.new(29, [3]),
      RPG::MoveCommand.new(35),
      RPG::MoveCommand.new(direction / 2),
      RPG::MoveCommand.new(36),
      RPG::MoveCommand.new(29, [target.move_speed]),
      RPG::MoveCommand.new,
      RPG::MoveCommand.new
    ]
    move_route.repeat = false
    move_route.skippable = true
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● 랜덤이동하며 주인공을 감지한다.
  #--------------------------------------------------------------------------
  def self.move_route_field(target, distance = 4, cmd = "My_AcR.WeaponPunch(self)")
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
    move_route.list.push(RPG::MoveCommand.new(9))
    move_route.list.push(RPG::MoveCommand.new(15, [20]))
    txt = "My_AcR.SensePlayer(self, " + distance.to_s + ", "" + cmd + "")"
    move_route.list.push(RPG::MoveCommand.new(45, [txt]))
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = true
    move_route.skippable = true
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● 주인공을 감지한다.
  #--------------------------------------------------------------------------
  def self.SensePlayer(target, distance, cmd)
    if My_AcR.Distance(target, $game_player) > distance
      return
    end
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
    move_route.list.push(RPG::MoveCommand.new(25))
    move_route.list.push(RPG::MoveCommand.new(45, [cmd]))
    move_route.list.push(RPG::MoveCommand.new(10))
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = true
    move_route.skippable = true
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● XP의 버그에 대항하기 위해 삭제되면 동작을 멈춘다
  #--------------------------------------------------------------------------
  def self.SenseDeath(target)
    if target.erased
      My_AcR.move_route_stop(target)
    end
  end
  def self.move_route_stop(target)
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = false
    move_route.skippable = true
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● 일반적인 펀치! - 1칸 앞의 적에게 데미지
  #--------------------------------------------------------------------------
  def self.WeaponPunch(event, delay = 1.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      if target.x == x and target.y == y
        My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
        target.animation_id = 4
        event.wait_count = (delay * 40).to_i
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 밀치기 칼질 - 근거리 적에게 데미지 + 밀치기
  #--------------------------------------------------------------------------
  def self.WeaponSword(event, delay = 1.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      if target.x == x and target.y == y
        My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
        target.animation_id = 4
        move_route_push(target, event.direction)
        event.wait_count = (delay * 40).to_i
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
  #--------------------------------------------------------------------------
  def self.TriggerArrow(owner, arrow, delay = 1.0)
    owner.wait_count = (delay * 40).to_i
    arrow.moveto(owner.x, owner.y)
    arrow.direction = owner.direction
    arrow.AcR = false
    arrow.AcR = true
    arrow.team = owner.team
    arrow.atk = owner.atk
    arrow.unerase
  end
  #--------------------------------------------------------------------------
  # ● 폰을 위한 총쏘기 기술
  #--------------------------------------------------------------------------
  def self.TriggerArrow4Pon(owner, arrow, direction)
    arrow.moveto(owner.x, owner.y)
    arrow.direction = direction
    arrow.AcR = false
    arrow.AcR = true
    arrow.team = owner.team
    arrow.atk = owner.atk
    arrow.unerase
  end
  #--------------------------------------------------------------------------
  # ● 일반적인 화살 - 화살과 겹쳐지는 적을 해치운 뒤 소멸 (일시 삭제)
  #--------------------------------------------------------------------------
  def self.MoveArrow(event)
    if event.AcR == false
      event.erase
    else
      My_AcR.iterate_enemy(event) do |target|
        if target.x == event.x and target.y == event.y
          self.Damage(target, [event.atk - target.pdef, 0].max)
          target.animation_id = 4
          event.erase
        end
      end
      event.move_forward
      if not event.moving?
        event.erase
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 레드의 단검치기
  #--------------------------------------------------------------------------
  def self.WeaponWeakPunch(event, delay = 1.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      if target.x == x and target.y == y
        My_AcR.Damage(target, [(event.atk / 10).to_i - target.pdef, 0].max)
        target.animation_id = 4
        event.wait_count = (delay * 40).to_i
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 레드의 단검치기 - 길찾아가기
  #--------------------------------------------------------------------------
  def self.move_route_red_attack(event)
    # find path and move
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.WeaponWeakPunch(self, 0.2)"]))
    move_route.list.push (RPG::MoveCommand.new(37))
    move_route.list.push (RPG::MoveCommand.new(29, [5]))
    success = self.find_nearest_enemy(event, move_route.list)
    if not success
      # self.move_route_jumpto(event, x, y)
      return
    end
    move_route.list.push (RPG::MoveCommand.new(29, [3]))
    if not event.through
      move_route.list.push (RPG::MoveCommand.new(38))
    end
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = false
    move_route.skippable = false
    event.force_move_route(move_route)
  end
  #가장 가까운 적을 찾아내어 그와의 이동루트를 계산
  def self.find_nearest_enemy(event, move_route_list)
    #먼저 맵을 클리어
    map = []
    for i in 1 .. $game_map.height + 1
      map.push []
    end
    #적들을 표시
    no_enemy = true
    My_AcR.iterate_enemy(event) do |enemy|
      map[enemy.y][enemy.x] = -1
      no_enemy = false
    end
    if no_enemy
      return false
    end
    #끝에서부터 시작까지 선을 잇는다.
    stack = []
    x = event.x
    y = event.y
    stack.push [x, y, 2]
    stack.push [x, y, 4]
    stack.push [x, y, 6]
    stack.push [x, y, 8]
    i = -1
    found = false
    while i < stack.size - 1 and not found
      i += 1
      x = stack[i][0]
      y = stack[i][1]
      d = stack[i][2]
      vx = (d == 6 ?  1 : d == 4 ?  -1 : 0)
      vy = (d == 2 ?  1 : d == 8 ?  -1 : 0)
      if map[y + vy][x + vx] == -1
        ex = x
        ey = y
        ed = d
        found = true
        next
      end
      if not event.passable?(x, y, d)
        next
      end
      x += vx
      y += vy
      if map[y][x] != nil
        next
      end
      map[y][x] = 10 - d
      stack.push([x, y, 2])
      stack.push([x, y, 4])
      stack.push([x, y, 6])
      stack.push([x, y, 8])
    end
    if not found
      return false
    end
    success = find_path(event, event.x, event.y, ex, ey, move_route_list)
    if success
      case ed
      when 2
        move_route_list.push (RPG::MoveCommand.new(16))
      when 4
        move_route_list.push (RPG::MoveCommand.new(17))
      when 6
        move_route_list.push (RPG::MoveCommand.new(18))
      when 8
        move_route_list.push (RPG::MoveCommand.new(19))
      end
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ● 길찾기 알고리즘 방향추가버젼
  #--------------------------------------------------------------------------
  def self.move_route_moveto2(target, x, y, direction)
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push (RPG::MoveCommand.new(37))
    success = self.find_path(target, target.x, target.y, x, y, move_route.list)
    if not success
      self.move_route_jumpto(target, x, y)
      return
    end
    if not target.through
      move_route.list.push (RPG::MoveCommand.new(38))
    end
    case direction
    when 2
      move_route.list.push (RPG::MoveCommand.new(16))
    when 4
      move_route.list.push (RPG::MoveCommand.new(17))
    when 6
      move_route.list.push (RPG::MoveCommand.new(18))
    when 8
      move_route.list.push (RPG::MoveCommand.new(19))
    end
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = false
    move_route.skippable = false
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● 길찾기 알고리즘 이벤트로 이동버젼
  #--------------------------------------------------------------------------
  def self.move_route_moveto_target(event, target)
    if target.passable?(target.x - target.vx, target.y - target.vy, 10 - target.direction)
      move_route_moveto2(event, target.x - target.vx, target.y - target.vy, 10 - target.direction)
    end
  end
  #--------------------------------------------------------------------------
  # ● 지정 위치로 점프한다
  #--------------------------------------------------------------------------
  def self.move_route_jumpto2(target, x, y, direction)
    move_route = RPG::MoveRoute.new
    move_route.list = []
    move_route.list.push (RPG::MoveCommand.new(37))
    move_route.list.push (RPG::MoveCommand.new(14, [x - target.x, y - target.y]))
    if not target.through
      move_route.list.push (RPG::MoveCommand.new(38))
    end
    case direction
    when 2
      move_route.list.push (RPG::MoveCommand.new(16))
    when 4
      move_route.list.push (RPG::MoveCommand.new(17))
    when 6
      move_route.list.push (RPG::MoveCommand.new(18))
    when 8
      move_route.list.push (RPG::MoveCommand.new(19))
    end
    move_route.list.push(RPG::MoveCommand.new)
    move_route.list.push(RPG::MoveCommand.new)
    move_route.repeat = false
    move_route.skippable = false
    target.force_move_route(move_route)
  end
  #--------------------------------------------------------------------------
  # ● 유진의 전체공격.
  #--------------------------------------------------------------------------
  def self.WeaponSound(event, delay = 10.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
      target.animation_id = 4
      event.wait_count = (delay * 40).to_i
    end
  end
  #--------------------------------------------------------------------------
  # ● 연타공격
  #--------------------------------------------------------------------------
  def self.WeaponPunchHalf(event, delay = 0.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      if target.x == x and target.y == y
        My_AcR.Damage(target, [event.atk / 2 - target.pdef, 0].max)
        target.animation_id = 4
        event.wait_count = (delay * 40).to_i
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 거검공격
  #--------------------------------------------------------------------------
  def self.WeaponSwordDouble(event, delay = 3.0)
    x = event.x + event.vx
    y = event.y + event.vy
    My_AcR.iterate_enemy(event) do |target|
      if target.x == x and target.y == y
        My_AcR.Damage(target, [event.atk * 2 - target.pdef, 0].max)
        target.animation_id = 4
        move_route_push(target, event.direction)
        event.wait_count = (delay * 40).to_i
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
  #--------------------------------------------------------------------------
  def self.TriggerArrowHalf(owner, arrow, delay = 1.0)
    owner.wait_count = (delay * 40).to_i
    arrow.moveto(owner.x, owner.y)
    arrow.direction = owner.direction
    arrow.AcR = false
    arrow.AcR = true
    arrow.team = owner.team
    arrow.atk = owner.atk / 2
    arrow.unerase
  end
end


===============================================

창도에서 퍼왔고요

사용법은 비밀님이 공개를 하지않았음

그럼 잘쓰세요

이거 검구4에서 쓰던 액알

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '24'
  • ?
    리안 2009.02.26 16:08
    고마워요
  • ?
    김옥인 2009.03.08 21:11
    감사합니다 ㅋ
  • ?
    용호작무 2009.08.08 12:24

    감사합니다! 되는지는 실행해봐야 겠지만...

     

    (+) 역시 전 오류뜨네요ㅜ 흑흑 액알을 또 찾아봐야 하는건가

  • ?
    rpg처음 2010.01.29 20:04

    저도좀여

     

  • ?
    Toast 2011.01.15 12:41

    나도 알려주세요

  • ?
    누군가 2010.01.08 10:34

    오!!! 용호작무님 제가 스크립트없이 이벤트로 엑알 만드는 방법알려드릴까요?

  • ?
    김병성 2009.08.09 11:11

    아 거참 비밀소년이란분 천재적인 실력을가진건 분명한데

    다같이좀 좋은거있으면 나누고좀 그러지 좋은거는 자기만 다하려고하네.

    수정도 못하게하고 왜그러지 좀다같이 나눠주면서 배포하면 후달리나?

  • ?
    ToRoTo 2009.08.10 12:29

    김병성님.. 말씀이 지나치시네요

    그럼 님이지닌 돈이나 물건들 다 아프리카에 뿌리고 올 수도있나요?

     

    아니면 님이 죽어라 열심히 써놓은 논문이나 보고서 뭐 그런거 그냥 회사원끼리 공유할 수 있나요?

     

  • ?
    동훈이 2010.01.07 22:23

    맞아

  • ?
    아방스마니아 2010.01.08 13:14

    그렇지만 비밀소년님이 스크립트를 공개유포한다는건 스크립트계의 발전을 촉진시키는것이니

    아프리카에돈뿌리는얘기하고는 다르죠.. 공개유포하면 어차피 비밀소년님도 이익을 당연히 보게될 체계인데

  • ?
    프라미 2010.10.07 02:22

    유포도 맞는말입니다 모르면 입방정 떨지마세요 천둥벌거숭이마냥 뭐하는 짓입니까 ...

  • ?
    유피 2010.01.12 16:43

    공개유포가 아니고 공개배포구요^^

    사실 자기가 열심히 만든 스크립트를 남한테 그냥 배포하는건, 좀 무리가 있죠

  • ?
    서울냥이 2010.01.09 16:31

    돈주고팔란예기 ㄷㄷ

  • ?
    매냐 2010.01.09 23:27

    어떻게 사용하죠 ?..

  • ?
    옹알이 2010.02.11 17:40

    와 대단하시네요 ㅋㅋㅋ

     

  • ?
    수호류 2010.02.24 12:11

    대단해요~

  • ?
    Fiting tree 2010.02.26 12:15

  • ?
    불량유저 2010.03.09 21:11

    굳 요기잇네요

  • ?
    홈버스트집사 2010.07.22 11:41

    오홋 어떻게하는지는 모르겠지만 ㄳ

  • profile
    I Like Sirooni 2010.07.24 11:00

    헐 액알스크립트를 이렇게 쉽게넘겨주다니.

  • ?
    캉쿤 2011.09.10 14:59

    에휴 안돼네요..

  • ?
    레어닉네임 2011.09.18 17:39

    사용법만알면좋을텐데 말이죠..

  • ?
    아트하우스 2011.11.10 17:27

    //김병성

    그건 비밀소년님 마음임 ㅌㅋㅋㅋㅋㅋ

  • ?
    액알알려주세요ㅠㅠ 2012.04.28 18:51

    고맙습니다.


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6313
681 전투 KGC_RandomTarget(랜덤 타겟) 1 file 백호 2009.02.22 1501
680 전투 KGC_RankConception(대열 개념) file 백호 2009.02.22 1719
679 전투 KGC_RateDamage(비율 데미지) 3 file 백호 2009.02.22 1658
678 전투 KGC_DamageAlter(데미지 표시 개조) 8.24 14 file 백호 2009.02.22 3157
677 이름입력 Keyboard-Controlled Name Input Script by BlueScope@rmxp.org 1 file 백호 2009.02.22 1775
» 전투 액알 스크립트 24 백호 2009.02.22 6019
675 이동 및 탈것 KGC_RemoveElements file 백호 2009.02.22 1127
674 이동 및 탈것 KGC_SetAttackElement (공격속성설정) file 백호 2009.02.22 1414
673 스킬 KGC_SkillReflection (마법반사) 2 file 백호 2009.02.22 1481
672 스킬 KGC_SkillMessage (스킬사용메세지) 1 file 백호 2009.02.22 2083
671 전투 KGC_SPdamage (SP데미지) 3 file 백호 2009.02.22 1632
670 전투 KGC_SPdeath (SP전투불능) file 백호 2009.02.22 1528
669 전투 KGC_BonusGauge (보너스게이지) 3 file 백호 2009.02.22 2765
668 전투 KGC_SeparationCommand file 백호 2009.02.22 1714
667 기타 KGC_UsableWeapon file 백호 2009.02.22 1384
666 이동 및 탈것 KGC_Teleport file 백호 2009.02.22 1153
665 기타 Trailing Characters ver.1 by SephirothSpawn 6 file 백호 2009.02.22 1551
664 메뉴 Materia System 2.01v by SephirothSpawn 6 file 백호 2009.02.22 2107
663 기타 Golden_sun_intro v1 1 백호 2009.02.22 1268
662 전투 [신기술 체험] SRPG-Test 13 file 백호 2009.02.22 3541
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 52 Next
/ 52