조회 수 372 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

 

모 외국 사이트에서 전투시 적 체력을 화면에 띄워주는 스크립트를 찾았는데요,

 

커스텀 배틀러를 사용하다보니 이미지 크기때문에 체력바가 화면 밖으로 나가버리는 상황이 자주 발생합니다.

 

X/Y축 조정보단 배틀러의 '항상위에' 상태를 해제하거나,

체력바 스크리브가 배틀러의 위에 출력되게 수정하고싶은데

어떻게 하는지 알려주실 수 있는분 계신가요?

 

스크립트 첨부 ▼

 

#--# Basic Enemy HP Bars v 2.6
#
# Adds customizable hp bars to enemies in battle. See configuration
#  below for more detail. Also allows for the option of using a nice
#  graphical hp bar from a image file.
#
# Usage: Plug and play, customize as needed.
#
#------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    posted on the thread for the script
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#    posed on site: daimonioustails.wordpress.com
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
 
#Customization starts here:
module DTP_HP
  #Whether to place the hp bar above or below the enemy
  ABOVE_MONSTER = true
  #Whether to use a custome image or not:
  #Image would be placed in Graphics/System and named Custom_HP.png
  CUSTOM_BAR = false
 
  #The width of the hp bar
  BAR_WIDTH = 66
  #The height of the hp bar
  BAR_HEIGHT = 3
  #The width of the border around the hp bar
  BORDER_WIDTH = 1
  #The height of the border around the hp bar
  BORDER_HEIGHT = 1
  #Offset the hp bar along the x-axis(left,right)
  BAR_OFFSET_X = 0
  #Offset the hp bar along the y-axis(up,down)
  BAR_OFFSET_Y = 5
 
  #Color for the back of the hp bar
  COLOR_BAR_BACK = Color.new(0,0,0,200)
  #First color for the hp bar gradient
  COLOR_BAR_1 = Color.new(255,0,0)
  #Second color for the hp bar gradient
  COLOR_BAR_2 = Color.new(200,100,100)
  #Outside border color
  COLOR_BORDER_1 = Color.new(0,0,0,185)
  #Inside border color
  COLOR_BORDER_2 = Color.new(255,255,255,185)
 
  #Whether to display text or not
  USE_TEXT = true
  #Text to be displayed, chp = current hp, mhp = max hp, php = percentage hp
  #Examples: "php%" or "chp/mhp" or "chp - php%"
  TEXT_DISPLAY = "chp"
  #Offset for the text along the x-axis(left,right)
  TEXT_OFFSET_X = 5
  #Offset for the text along the y-axis(up,down)
  TEXT_OFFSET_Y = -24
  #Size of the displayed text
  TEXT_SIZE = Font.default_size
  #Font of the displayed text
  TEXT_FONT = Font.default_name
 
  #Show bars only when specific actor in party. Array format. Example: [8,7]
  #Set to [] to not use actor only
  SPECIFIC_ACTOR = []
  #Show enemy hp bar only if certain state is applied (like a scan state)
  #Set to 0 to not use state only
  SCAN_STATE = 0
  #Enemies will show hp bar as long as they have been affected but scan state
  #at least once before
  SCAN_ONCE = false
  #Hp bars will only show when you are targetting a monster
  ONLY_ON_TARGET = false
 
  #Text to display if it's a boss monster, accepts same arguments
  BOSS_TEXT = "???"
  #The width of the boss hp bar
  BOSS_BAR_WIDTH = 66
  #The height of the boss hp bar
  BOSS_BAR_HEIGHT = 5
  #The width of the border around the boss hp bar
  BOSS_BORDER_WIDTH = 1
  #The height of the border around the boss hp bar
  BOSS_BORDER_HEIGHT = 1
  #ID's of boss monsters in array format.
  BOSS_MONSTERS = []
end
#Customization ends here
 
class Sprite_Battler
  alias hpbar_update update
  alias hpbar_dispose dispose
  def update
    hpbar_update
    return unless @battler.is_a?(Game_Enemy)
    if @battler
      update_hp_bar
    end
  end
  def update_hp_bar
    boss = DTP_HP::BOSS_MONSTERS.include?(@battler.enemy_id)
    if @hp_bar.nil?
      @hp_bar = Sprite_Base.new(self.viewport)
      if !boss
        width = DTP_HP::BAR_WIDTH + DTP_HP::BORDER_WIDTH * 4
        height = DTP_HP::BAR_HEIGHT + DTP_HP::BORDER_HEIGHT * 4
      else
        width = DTP_HP::BOSS_BAR_WIDTH + DTP_HP::BOSS_BORDER_WIDTH * 4
        height = DTP_HP::BOSS_BAR_HEIGHT + DTP_HP::BOSS_BORDER_HEIGHT * 4
      end
      @hp_bar.bitmap = Bitmap.new(width,height)
      @hp_bar.x = self.x - @hp_bar.width / 2 + DTP_HP::BAR_OFFSET_X
      @hp_bar.y = self.y + DTP_HP::BAR_OFFSET_Y - self.bitmap.height - @hp_bar.height
      @hp_bar.y = self.y + DTP_HP::BAR_OFFSET_Y unless DTP_HP::ABOVE_MONSTER
      @hp_bar.x = 0 if @hp_bar.x < 0
      @hp_bar.y = 0 if @hp_bar.y < 0
      @hp_bar.z = 98
    end
    if @text_display.nil?
      @text_display = Sprite_Base.new(self.viewport)
      @text_display.bitmap = Bitmap.new(100,DTP_HP::TEXT_SIZE)
      @text_display.bitmap.font.size = DTP_HP::TEXT_SIZE
      @text_display.bitmap.font.name = DTP_HP::TEXT_FONT
      @text_display.x = @hp_bar.x + DTP_HP::TEXT_OFFSET_X
      @text_display.y = @hp_bar.y + DTP_HP::TEXT_OFFSET_Y
      @text_display.z = 99
    end
    determine_visible
    return unless @hp_bar.visible
    @hp_bar.opacity = self.opacity if @hp_bar.opacity != self.opacity
    @hp_bar.bitmap.clear
    if !boss
      width = DTP_HP::BAR_WIDTH
      height = DTP_HP::BAR_HEIGHT
      bwidth = DTP_HP::BORDER_WIDTH
      bheight = DTP_HP::BORDER_HEIGHT
    else
      width = DTP_HP::BOSS_BAR_WIDTH
      height = DTP_HP::BOSS_BAR_HEIGHT
      bwidth = DTP_HP::BOSS_BORDER_WIDTH
      bheight = DTP_HP::BOSS_BORDER_HEIGHT
    end
    btotal = (bwidth + bheight) * 2
    rwidth = @hp_bar.bitmap.width
    rheight = @hp_bar.bitmap.height
    if !DTP_HP::CUSTOM_BAR
      @hp_bar.bitmap.fill_rect(0,0,rwidth,rheight,DTP_HP::COLOR_BAR_BACK)
      @hp_bar.bitmap.fill_rect(bwidth,bheight,rwidth-bwidth*2,rheight-bheight*2,DTP_HP::COLOR_BORDER_2)
      @hp_bar.bitmap.fill_rect(bwidth*2,bheight*2,width,height,DTP_HP::COLOR_BORDER_1)
    end
    hp_width = @battler.hp_rate * width
    @hp_bar.bitmap.gradient_fill_rect(bwidth*2,bheight*2,hp_width,height,DTP_HP::COLOR_BAR_1,DTP_HP::COLOR_BAR_2)
    if DTP_HP::CUSTOM_BAR
      border_bitmap = Bitmap.new("Graphics/System/Custom_HP.png")
      rect = Rect.new(0,0,border_bitmap.width,border_bitmap.height)
      @hp_bar.bitmap.blt(0,0,border_bitmap,rect)
    end
    return unless DTP_HP::USE_TEXT
    @text_display.opacity = @hp_bar.opacity if @text_display.opacity != @hp_bar.opacity
    @text_display.bitmap.clear
    text = DTP_HP::TEXT_DISPLAY.clone
    text = DTP_HP::BOSS_TEXT.clone if DTP_HP::BOSS_MONSTERS.include?(@battler.enemy_id)
    text.gsub!(/chp/) {@battler.hp}
    text.gsub!(/mhp/) {@battler.mhp}
    text.gsub!(/php/) {(@battler.hp_rate * 100).to_i}
    @text_display.bitmap.draw_text(0,0,100,@text_display.height,text)
  end
  def determine_visible
    if !@battler.alive?
      @hp_bar.visible = false
      @text_display.visible = false
      return if !@battler.alive?
    end
    @hp_bar.visible = true
    if DTP_HP::SCAN_STATE != 0
      @hp_bar.visible = false
      @hp_bar.visible = true if @battler.state?(DTP_HP::SCAN_STATE)
      if DTP_HP::SCAN_ONCE
        @hp_bar.visible = true if $game_party.monster_scans[@battler.enemy_id] == true
        $game_party.monster_scans[@battler.enemy_id] = true if @hp_bar.visible
      end
    end
    if !DTP_HP::SPECIFIC_ACTOR.empty?
      @hp_bar.visible = false unless DTP_HP::SCAN_STATE != 0
      DTP_HP::SPECIFIC_ACTOR.each do |i|
        next unless $game_party.battle_members.include?($game_actors[i])
        @hp_bar.visible = true
      end
    end
    if DTP_HP::ONLY_ON_TARGET
      return unless SceneManager.scene.is_a?(Scene_Battle)
      return unless SceneManager.scene.enemy_window
      @hp_bar.visible = SceneManager.scene.target_window_index == @battler.index
      @hp_bar.visible = false if !SceneManager.scene.enemy_window.active
    end
    @text_display.visible = false if !@hp_bar.visible
    @text_display.visible = true if @hp_bar.visible
  end
  def dispose
    @hp_bar.dispose if @hpbar
    @text_display.dispose if @text_display
    hpbar_dispose
  end
end
 
class Scene_Battle
  attr_reader  :enemy_window
  def target_window_index
    begin
    @enemy_window.enemy.index
    rescue
      return -1
    end
  end
end
 
class Game_Party
  alias hp_bar_init initialize
  attr_accessor  :monster_scans
  def initialize
    hp_bar_init
    @monster_scans = []
  end
end

?

List of Articles
번호 제목 글쓴이 날짜 조회 수
8688 RPG XP에서 장비 화면의 호출은 어떻게 하나요? 1 file 심심치 2017.05.22 693
8687 제가 만든 게임을 리뷰 하려고 하는데요. 6 1324의남자 2017.05.18 1411
8686 [질문]RPG MV 식물 재배에 관한 이벤트인데 문제가 있어 질문합니다! [이미지첨부] 3 file MoonJ 2017.05.18 730
8685 [RPGMV] 초보자 질문합니다^_^ 5 MoonJ 2017.05.17 854
8684 건물위에서 데미지를 안받게 하려면 어떻게 해야 하나요? 5 1324의남자 2017.05.16 719
8683 조건이 있는 대화중 esc를 누르면 두번째 조건이 선택되네요. 왜 그럴까요? 3 file 정의오타쿠 2017.05.16 710
8682 웹으로 배포했는데 세이브파일을 따로 저장할 수 없을까요?? 5 카라스노오 2017.05.15 908
8681 알만툴 게임 만들어서, 수입을 많이 낼수있을까요? 6 문방구 2017.05.10 2325
8680 MV 에서 해상도변경 플러그인 쓰니 메뉴가 잘려요; 3 file 문방구 2017.05.09 1314
8679 이동 경로 설정하고 액터가 움직이네요 6 준E 2017.05.09 911
8678 쯔꾸르게임에관해서... 2 난이 2017.05.07 855
8677 rpg mv 쪽 쯔꾸르 모바일 세이브 위치가 어디인가요 뽕뽀로루 2017.05.07 1771
8676 스크립트를 활용해서 운이라는 능력치를 무효시키는 방법은 없나요? RPG란무엇인가? 2017.05.06 316
8675 이 사이트에 게시판 몇개가 가려져서 클릭을 못하겠는데 이런 경우엔 어떻게 해야 하나요? 2 file wwlekd 2017.05.05 733
8674 ?이게뭐죠? 앱 오륜가? 플레이스토어 앱 제출 오류. 이상하면 앱 보내드려요 5 file 새준 2017.05.04 785
8673 MV게임으로 구글 플레이스토어 인앱결제를 넣을수 있을까요? 7 huguduk 2017.05.01 1751
8672 알만툴 변수 알고리즘을 잘 모르겠어요. 왜 조건문 실행이 안될까요? 11 참몰랑 2017.04.28 1727
8671 [MV] 비 스팀 판은 DLC 사용 못하나요? 2 MV초보자 2017.04.28 888
8670 MV에서 사용자 말풍선 아이콘을 추가 하려면 어케 해야할까요? 6 참몰랑 2017.04.25 1394
8669 [ RPG XP ] 인디사이드에서 게임맵을 업로드할떄 무슨 파일을 업로드 해야하나요? 네티즌 2017.04.21 316
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 442 Next
/ 442






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

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