XP 스크립트

http://www.dubealex.com/asylum/index.php?showtopic=9786

특정 버튼을 눌렀을 때 NPC 머리 위에 NPC 정보창이 뜨게 하는 것입니다. 

 
 


#==============================================================================
# ** NPC Details Window
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-07-11
# Version 1
#------------------------------------------------------------------------------
# * Instructions
#
# ~ Give NPC Comment Line with : NPC Details
# The Following Lines in the Comment Box will apear exactly as is
#
# ~ NPC Button
# Check_NPCDetails_Button = Input::Constant
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script-x
#------------------------------------------------------------------------------
SDK.log('NPC Details Window', 'SephirothSpawn', 1, '2006-07-11')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('NPC Details Window')

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player
#--------------------------------------------------------------------------
# * Check NPC Details Button
#--------------------------------------------------------------------------
Check_NPCDetails_Button = Input::A
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_npcdetails_gmplyr_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original Update
seph_npcdetails_gmplyr_update
# If NPC Details Button is Pressed
if Input.trigger?(Check_NPCDetails_Button)
# Gets NPC Desired Location
new_x = x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# Checks All Events
for event in $game_map.events.values
# If Event is In Front Of Player
if event.x == new_x && event.y == new_y
# Checks All Event's Event Commands
for event_command in event.list
# If Comment Command
if event_command.code == 108
# If Comment Contains 'NPC Details'
if event_command.parameters[0].include?('NPC Details')
# Gathers NPC Details
details = []
index = event.list.index(event_command)
for i in index...event.list.size
if event.list[i].code == 408
details << event.list[i].parameters[0]
end
end
# Creates NPC Window
$scene.seph_start_npcdetails_window(event.id, details)
break
end
end
end
end
end
end
end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event
attr_reader :event
end

#==============================================================================
# ** Window_NPCDetails
#==============================================================================

class Window_NPCDetails < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(event_id, details)
x = [[0, $game_map.events[event_id].screen_x - 160].max, 320].min
y = [[0, $game_map.events[event_id].screen_y - 224].max, 320].min
super(x, y, 320, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh(event_id, details)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(event_id, details)
self.contents.clear
# Draws Event Name
name = $game_map.events[event_id].event.name
self.contents.font.color = system_color
self.contents.draw_text(0, 0, contents.width, 32, name, 1)
# Draws Details
self.contents.font.color = normal_color
for i in 0...details.size
self.contents.draw_text(4, i * 32 + 32, contents.width, 32, details[i])
end
end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_npcdetails_scnmap_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If NPC Details Window Exist
unless @npc_details_window.nil?
seph_update_npcdetails
return
end
# Original Update Processing
seph_npcdetails_scnmap_update
end
#--------------------------------------------------------------------------
# * Frame Update : Npc Details
#--------------------------------------------------------------------------
def seph_update_npcdetails
# Update Map Details
$game_map.update
$game_system.map_interpreter.update
$game_system.update
$game_screen.update
@spriteset.update
@message_window.update
# If B Button Or C Button is Pressed
if Input.trigger?(Input::A) || Input.trigger?(Input::C)
# Dispose NPC Details Window
@npc_details_window.dispose
@npc_details_window = nil
end
end
#--------------------------------------------------------------------------
# * Start NPC Details Window
#--------------------------------------------------------------------------
def seph_start_npcdetails_window(event_id, details)
@npc_details_window = Window_NPCDetails.new(event_id, details)
end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end


NPC 정보는 이벤트 명령->주석에서 NPC Details (정보) 식으로 달면 되는 모양.

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '2'
Comment '1'
  • ?
    용호작무 2009.08.23 05:05

    favorite move : leg sweep........유머용으로 괜찮겠네요;


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
1021 아이템 흠..몬스터도감말고 아이템도감~ 9 백호 2009.02.21 2028
1020 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3335
1019 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2973
1018 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3311
1017 기타 회복으로 데미지를 받는 좀비 스크립트 7 백호 2009.02.22 2004
1016 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
1015 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6561
1014 미니맵 화면에 축소된 미니맵을 표시하는 스크립트 - 한글 번역 - 6 file 백호 2009.02.21 2560
1013 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
1012 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2137
1011 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2592
1010 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2529
1009 기타 현재 맵BGM을 그대로 전투 BGM으로 연결 from phylomortis.com 백호 2009.02.22 1180
1008 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 497
1007 메시지 한글자씩 뜨는 스크립트 6 백호 2009.02.21 3001
1006 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11823
1005 키입력 한글입력기(자음, 모음 분리. 아마 중복일 듯...) 11 캉쿤 2011.09.13 3225
1004 키입력 한글입력기 6 백호 2009.02.22 4302
1003 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4205
1002 메시지 한글 채팅 스크립트 32 file こなた 2009.01.22 4947
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52