RPGXP 스크립트
2014.11.23 20:44

액알 스크립트

조회 수 1440 추천 수 1 댓글 4
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

#================================================#
#○쉬운 액션 알피지 1.00 Ver 

#================================================#
class Game_Character
  attr_accessor :monster
  alias status_initialize initialize
 
  def initialize
    status_initialize
    @monster = Game_Monster.new
  end
end

 

#================================================#
#○몬스터 객체를 생성
#   능력치들이 자동으로 저장될 공간을 생성
#================================================#
class Game_Monster
  attr_accessor :status
  attr_accessor :hp
  attr_accessor :maxhp
 
  def initialize
    @status = nil
    @hp = nil        #○몬스터hp는 DB에 존재하지 않는 값이라 새객체에 maxhp값을 담아 사용
    @maxhp = nil  #○maxhp는 자주사용되는 값이기에 새 객체에 담아 사용
  end
end

 

#================================================#
#○DB에 있는 몬스터 능력치를 이벤트로 담아온다.
#================================================#
class Game_Map < Game_Map
   
  def setup(map_id)  #○맵이 열리자마자 monster_setup이 호출된다.
    super
    monster_setup
  end
 
  def monster_setup
    for event_id in @map.events.keys #○현재 맵에 존재하는 맵이벤트 해시키를 배열화
      for monster_id in 1 .. $data_enemies.size #○DB에 존재하는 몬스터(에너미) 갯수
        if @map.events[event_id] != nil and $data_enemies[monster_id] != nil #○nil값(빈값)방지 or 에러방지
          #○맵이벤트의 이름과 DB상의 몬스터 이름이 같다면
          if @map.events[event_id].name == $data_enemies[monster_id].name
            #○몬스터객체에 DB상의 몬스터 능력치를 대입한다.
            $game_map.events[event_id].monster.status = $data_enemies[monster_id]
            $game_map.events[event_id].monster.maxhp = $game_map.events[event_id].monster.status.maxhp
            $game_map.events[event_id].monster.hp = $game_map.events[event_id].monster.maxhp
            break
          end
        end
      end
    end
  end
end


#===============================================#
#○각종 정의에 필요한 몬스터값을 변수에 담아 값을 리턴
#===============================================#
class Game_Event < Game_Event
 
  def monster_pdef
    return $monster_pdef = @monster.status.pdef
  end
 
  def monster_mdef
    return $monster_mdef = @monster.status.mdef
  end
 
  def monster_atk
    return $monster_atk = @monster.status.atk
  end
 
  def monster_str
    return $monster_str = @monster.status.str
  end
 
  def monster_dex
    return $monster_dex = @monster.status.dex
  end
 
  def monster_int
    return $monster_int = @monster.status.int
  end
 
  def monster_spd
    return $monster_spd = @monster.status.agi
  end
end


#===============================================#
#○각종 정의에 필요한 주인공 능력치를 메소드에 담는다.
#===============================================#
class Game_Player < Game_Character
 
  def player_pdef
    return $game_party.actors[0].pdef
  end
 
  def player_mdef
    return $game_party.actors[0].mdef
  end
 
  def player_atk
    return $game_party.actors[0].atk
  end
 
  def player_str
    return $game_party.actors[0].str
  end
 
  def player_dex
    return $game_party.actors[0].dex
  end
 
  def player_int
    return $game_party.actors[0].int
  end
 
  def player_spd
    return $game_party.actors[0].agi
  end
end

#===============================================#
#○몬스터 행동 정의
#===============================================#
class Game_Event < Game_Event
  attr_accessor :gauge
  attr_accessor :attack_delay
 
  def update
    super
    return if not action?
    die! if dead?
    attack!
  end
 
  def action?
    return (@monster.hp != nil)
  end
 
  def dead?
    return false if not action?
    return (@monster.hp <= 0)
  end
 
  def attack!
    if @delay == nil or @delay == 0
      @delay = 40
    else
      @delay -= 1
      return
    end
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    if $game_player.x == new_x and $game_player.y == new_y
      turn_toward_player
      $game_player.damage(monster_atk,monster_str,@monster.status.animation2_id)
    end
  end
 
  def turn_toward_player
    super
    $game_player.turn_right if @direction == 4
    $game_player.turn_left if @direction == 6
    $game_player.turn_up if @direction == 2
    $game_player.turn_down if @direction == 8
  end
 
  def damage(atk,status,ani)
    return if not action?
    min_dmg = (atk + status) * 0.1
    dmg = [atk + status - monster_pdef, 0].max
    dmg = min_dmg if min_dmg >= dmg
    @monster.hp = [@monster.hp - dmg, 0].max
    @gauge = @monster.hp.to_f / @monster.maxhp.to_f
    turn_toward_player
    move_backward if $game_player.player_str > monster_str
    self.animation_id = ani
  end
 
  def die!
    return if @dead
    if rand(100) <= @monster.status.treasure_prob
      $game_party.gain_weapon(@monster.status.weapon_id,1)
      $game_party.gain_armor(@monster.status.armor_id,1)
      $game_party.gain_item(@monster.status.item_id,1)
    end
    $game_party.actors[0].exp += @monster.status.exp
    $game_party.gain_gold(@monster.status.gold)
    self.animation_id = 54
    erase
    @dead = true
    @monster.hp = nil
  end
end

class Game_Player < Game_Player
  attr_accessor :gauge
  def update
    super
    if Input.trigger?(Input::C)
      for event in $game_map.events.values
        new_x = @x + (@direction == 6 ? 1 :@direction == 4 ? -1 : 0)
        new_y = @y + (@direction == 2 ? 1 :@direction == 8 ? -1 : 0)
        if event.x == new_x and event.y == new_y and event.monster.status != nil
          event.damage(player_atk, player_str,weapon_ani)
        end
      end
    end
  end
 
  def weapon_ani
    weapon_id = $game_party.actors[0].weapon_id
    return 4 if $data_weapons[weapon_id] == nil
    return $data_weapons[weapon_id].animation2_id
  end
 
  def damage(atk,status,ani)
    min_dmg = (atk + status) * 0.1
    dmg = [atk + status - player_pdef, 0].max
    dmg = min_dmg if min_dmg >= dmg
    $game_party.actors[0].hp = [$game_party.actors[0].hp - dmg, 0].max
    @gauge = $game_party.actors[0].hp.to_f / $game_party.actors[0].maxhp.to_f
    move_backward if $game_player.player_str < $monster_str
    self.animation_id = ani
  end
end


#===================================

#hp 게이지 테스트용 (카피라이트 모름.)

#===================================

class Sprite_Character < Sprite_Character
  def update
    super
   
    if @character.gauge != nil #and @character.gauge > 0
      gauge(@character.gauge)
      @character.gauge = nil
     
    end
    if @_gauge_setup then
      @_gauge_duration = [@_gauge_duration -5,0].max
      @_gauge_sprite_b.x = self.x
      @_gauge_sprite_b.y = self.y
      @_gauge_sprite_b.opacity = @_gauge_duration
      @_gauge_sprite.x =self.x
      @_gauge_sprite.y =self.y
      @_gauge_sprite.opacity = @_gauge_duration
    end
  end
 
  def gauge(p)
    setup_gauge if not @_gauge_setup
    @_gauge_sprite.src_rect = Rect.new(0, 0, p*30,2)
    @_gauge_duration = 255
  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 Game_Actor < Game_Battler
  def exp_rate
    if @exp_list[@level+1] - @exp_list[@level] > 0
      return (@exp- @exp_list[@level]).to_f / (@exp_list[@level+1] - @exp_list[@level]).to_f
    else
      return 0
    end
  end
end


class Window_Gauge < Window_Base
  def initialize
    super(0, 0, 145,105) #<사이즈
    self.contents = Bitmap.new(width - 32, height - 32)
   
    self.contents.font = Font.new("휴먼옛체", 16) #폰트사이즈
    self.opacity = 255
    self.back_opacity = 150
   
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(0, -4,120,30, @show_text4)
    self.contents.draw_text(0, 12, 120, 30, @show_text)
    self.contents.draw_text(0, 28, 120, 30, @show_text2)
    self.contents.draw_text(0, 47, 120, 30, @show_text3)
  end
 
  def actor
    $game_party.actors[0]
  end
  def update
    super
    text  = sprintf("HP :%d /%d", actor.hp, actor.maxhp)
    text2 = sprintf("MP :%d /%d", actor.sp, actor.maxsp)
    text3 = sprintf("EXP:%.3f%%",(actor.exp_rate*100).to_f)
    text4 = sprintf("LV:%d  %s ",actor.level,actor.name)
    if @show_text != text or @show_text2 != text2 or @show_text3 != text3 or @show_text4 != text4
      @show_text = text
      @show_text2 = text2
      @show_text3 = text3
      @show_text4 = text4
      refresh
    end
  end
end

class Scene_Map < Scene_Map
  def update
    super
    @window_gauge = Window_Gauge.new unless @window_gauge
    @window_gauge.update
    unless $scene.is_a?(Scene_Map)
      @window_gauge.dispose
      @window_gauge=nil
    end
  end
end

스페이스바 누르면 공격이 됩니다

이벤트에 몬스터 이름을 적어놓고 이동형식을

근접하다라고 하면 됩니다

 

?
  • ?
    AltusZeon 2014.11.25 15:51
    좀 오래 된 스크립트이기는 합니다만 정확한 출처는 아래와 같습니다.

    #================================================#
    #○쉬운 액션 알피지 1.00 Ver by [Niotsoft.펜릴]
    #버그발견시 www.niotsoft.com 에 글남겨주세요.
    #================================================#
  • ?
    AltusZeon 2014.11.25 15:54
    아래는 자료실 게시판 유의사항 중 일부입니다. 되도록이면 지켜주셨으면 합니다.
    ('아방스'라는 세 글자 단어는 너무 모호하고 범위가 넓기 때문에 제대로 된 출처 표기로 보기 어렵습니다.)

    5. 저작권 명시
    네코는 타인이 만든 저작물을 업로드하고자 할 경우에는 반드시 해당 저작물의 제작자 이름 또는 닉네임, 링크 등을 게재하셔야 합니다. 만약, 본 항을 어기게 된 경우에는 경고를 받으실 수 있으며 거듭된 경고에도 계속해서 저작권 명시를 하지 않을 경우에는 게시물 삭제 처리합니다.
  • ?
    forcarland 2016.01.26 19:42
    죽으면 게임오버가 안뜨는데요?
  • ?
    forcarland 2016.01.26 19:43
    게임 오버 뜨게 하는 방법이 있나요?

  1. 한글조합입력기(영어가능)

    Date2019.11.10 CategoryRPGXP 스크립트 By조규진1 Views621 Votes0
    Read More
  2. RPG XP Xas액알

    Date2018.10.30 CategoryRPGXP 스크립트 By심심치 Views935 Votes0
    Read More
  3. Font Setup

    Date2016.07.22 CategoryRPGXP 스크립트 By운님 Views1447 Votes0
    Read More
  4. 대화에 얼굴이 나오는 스크립트 by: killarot(네이버 dust_mite)(수정버전)

    Date2016.02.22 CategoryRPGXP 스크립트 By부초 Views1895 Votes0
    Read More
  5. RPGXP ATB전투 시스템 예제(스크립트는 예제 안에 포함)

    Date2015.11.17 CategoryRPGXP 스크립트 ByMagNesium Views772 Votes0
    Read More
  6. 스테이터스,보수,골드,플레임 타임 삭제

    Date2015.06.02 CategoryRPGXP 스크립트 Byrpgmakingbot Views735 Votes0
    Read More
  7. 헤드 업 디스플레이 스크립트

    Date2015.01.30 CategoryRPGXP 스크립트 By 운 Views867 Votes0
    Read More
  8. 컬러 비트맵 타이틀 스크립트

    Date2015.01.20 CategoryRPGXP 스크립트 By 운 Views852 Votes1
    Read More
  9. 로고 스크립트

    Date2014.12.10 CategoryRPGXP 스크립트 By 운 Views1177 Votes1
    Read More
  10. 타이틀 로딩 스크립트

    Date2014.12.07 CategoryRPGXP 스크립트 By 운 Views1077 Votes0
    Read More
  11. 타이틀 스크립트

    Date2014.12.05 CategoryRPGXP 스크립트 By 운 Views1032 Votes0
    Read More
  12. 액알 스크립트

    Date2014.11.23 CategoryRPGXP 스크립트 By커비♥ Views1440 Votes1
    Read More
  13. 공포게임에 장비착용메뉴

    Date2014.08.24 CategoryRPGXP 스크립트 By 운 Views1420 Votes0
    Read More
  14. 얼굴표시/문장을 한글자씩 나타내주는 스크립트 (출처-히페리온)

    Date2014.06.22 CategoryRPGXP 스크립트 By시르카 Views1188 Votes0
    Read More
  15. 횡스크롤 점프 [버튼허용스위치추가]

    Date2014.06.01 CategoryRPGXP 스크립트 By 운 Views1626 Votes0
    Read More
  16. 말풍선 메세지 스크립트

    Date2014.02.24 CategoryRPGXP 스크립트 By천둥번들 Views1853 Votes0
    Read More
  17. 스텟찍기스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views1761 Votes3
    Read More
  18. 달리기스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views2307 Votes2
    Read More
  19. 8방향 이동스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views1723 Votes6
    Read More
  20. AraLab_MultiStartingPoint (다중 출발점 스크립트, 캐릭터 선택 스크립트) ver.0.2beta

    Date2014.01.21 CategoryRPGXP 스크립트 By 운 Views1973 Votes1
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)