#此脚本的关键之处已做了注释,
#请务必仔细阅读
class Window_Information<Window_Base
TEXTHEIGHT=24 #信息窗口中文字行高
def initialize(x,y,width,height)
super(x,y,width,height)
end
def draw_text_bylines(lines,name)
text_x=100
text_y=24
self.contents.clear
self.contents.draw_text(150,0,354,24,name)
for i in 0..lines.size-1
self.contents.draw_text(text_x,text_y,354,24,lines[i])
text_y+=24
end
end
end
class Window_InforCommand<Window_Command
def initialize(x,y,name_array,handbook,face,face_index)
@name_array=name_array
@handbook=handbook
@face_visible=face
@face_index=face_index
@character_rect=Rect.new(0,0,96,250)
@now_index=-1
p
super(x,y)
if @name_array==[]
self.visible=false
else
@information_window=Window_Information.new(160,50,354,366)
end
end
def make_command_list
for i in [email]0..@name_array.size[/email]-1
add_command(@name_array[i],:command)
end
end
def update
super
if @now_index!=self.index
@now_index=self.index
if @information_window!=nil
if @name_array[self.index]!="未解锁"
@information_window.draw_text_bylines(@handbook[@name_array[self.index]],@name_array[self.index])
if @face_index[self.index]!=9
@information_window.draw_face(@face_visible[self.index],@face_index[self.index],0,50)
else
@information_window.contents.blt(0,50,Cache.battler(@character[self.index],0),@character_rect)
end
else
@information_window.contents.clear
@information_window.draw_text(100,0,100,24,"未解锁")
end
end
end
end
def set_character(character)
@character=character
end
end
class Scene_Information<Scene_MenuBase
MAX_ROW_WORDS=12
def initialize
super()
@pages=[]
#--------------------------------------------------------------------------
# ●以下这是这个脚本关键,按说明填数组中的内容
#--------------------------------------------------------------------------
name_array=["初入世道长略试探","剧毒术士","宙斯","幻影长矛手","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"]
#说明上面一句是设置npc的名字,名字中不要换行
set_name_switches={0=>1,1=>2,2=>3,3=>4,4=>5,5=>6,6=>7,7=>8,8=>9,9=>10,10=>11,11=>12,12=>13,13=>14,14=>15,
15=>16,16=>17,17=>18,18=>19,19=>20,20=>21,21=>22}
#上面设置每个npc图鉴是否可见所对应的开关,比如把剧毒术士对应7号开关
#可以这样设置“ 1=>7”左边的1表示7号开关对应名字数组中的1号位置即数组中的
#第二项。因为数组的0号位置对应数组的第一项,说以以此类推这样设置。
@hand_book={"初入世道长略试探"=>"仙途初始风波起,世间苍茫少不了风波异事。
话说这宁海县境内的小桑村,突生离奇怪病。不得已请来三清派茂阳道长,前来看个究竟。",
"剧毒术士"=>"我是剧毒术士","1"=>"8","14"=>"20"}
#以上数组是设置npc的介绍,里面可以换行,如果有英文字母p,则p以后的
#内容会令起一段。
face=["自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01",
"自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01",]
#以上是设置npc的头像文件名,在actor文件夹下。可以自己更改
face_index=[0,1,2,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
#以上是设置每个对应头像的文件中具体头像的编号,应为每个头像文件包含
#8个头像,所以要设置一下。,如果你不想用默认头像,应自己的图像
character=["asura","bandit","captain","hero_m"]
#设置人物半身像,半身像文件要放在ballters中,文件名填入以上数组
#注意半身像文件高度不要超过200,宽度不要超过96.
#注意以上数组中的项数一定要相同,比如上面填写的数组每个都是4项。
#--------------------------------------------------------------------------
# ●以上这是这个脚本关键按说明填数组中的内容
#--------------------------------------------------------------------------
@face_visible=[]
@face_index=[]
@name_visible_array=[]
@character_visible=[]
for i in 0..set_name_switches.size-1
if $game_switches[set_name_switches[i]]==true
@name_visible_array.push(name_array[i])
@face_visible.push(face[i])
@face_index.push(face_index[i])
@character_visible.push(character[i])
else
@name_visible_array.push("未解锁")
@face_visible.push("")
@face_index.push(9)
@character_visible.push("")
end
end
@hand_book.each{|key,value|@hand_book[key]=hand_book_tolines(value)}
end
def start
super
create_title_window
create_inforcommand_window
end
def create_title_window
@title_window=Window_Base.new(0,0,544,50)
@title_window.draw_text(220,0,100,24,"风物志-故事篇")
end
def create_inforcommand_window
@inforcommand_window=Window_InforCommand.new(0,50,@name_visible_array, @hand_book,@face_visible,@face_index)
@inforcommand_window.set_handler(:cancel, method(:return_scene))
@inforcommand_window.set_character(@character_visible)
end
#下面这个函数是脚本关键部分之一,不理解不影响脚本的使用
#这里说明一下:这个脚本的想法是把每个图鉴的字符串分按字数分为
#几个数组,每个数组会画成图鉴窗口的一行字符,9个字为一行,
#所以这个有个问题,即每个图鉴中的文字最好不要超过60个字,否则多余的字会显示
#不出来。
def hand_book_tolines(string)
@inforlines=[]
inforline=""
wordCount=0
lineCount=0
string.delete!("\n ")
loop do
c=string.slice!(/./m)
if c==nil
break
end
if c!="p"
if wordCount<MAX_ROW_WORDS
wordCount+=1
else
@inforlines.push(inforline)
wordCount=1
inforline=""
end
inforline+=c
else
@inforlines.push(inforline)
wordCount=0
inforline=""
end
end
@inforlines.push(inforline)
return @inforlines
end
end
#此脚本的关键之处已做了注释,
#请务必仔细阅读
class Window_Information<Window_Base
TEXTHEIGHT=24 #信息窗口中文字行高
def initialize(x,y,width,height)
super(x,y,width,height)
end
def draw_text_bylines(lines,name)
text_x=100
text_y=24
self.contents.clear
self.contents.draw_text(150,0,354,24,name)
for i in 0..lines.size-1
self.contents.draw_text(text_x,text_y,354,24,lines[i])
text_y+=24
end
end
end
class Window_InforCommand<Window_Command
def initialize(x,y,name_array,handbook,face,face_index)
@name_array=name_array
@handbook=handbook
@face_visible=face
@face_index=face_index
@character_rect=Rect.new(0,0,96,250)
@now_index=-1
p
super(x,y)
if @name_array==[]
self.visible=false
else
@information_window=Window_Information.new(160,50,354,366)
end
end
def make_command_list
for i in [email]0..@name_array.size[/email]-1
add_command(@name_array[i],:command)
end
end
def update
super
if @now_index!=self.index
@now_index=self.index
if @information_window!=nil
if @name_array[self.index]!="未解锁"
@information_window.draw_text_bylines(@handbook[@name_array[self.index]],@name_array[self.index])
if @face_index[self.index]!=9
@information_window.draw_face(@face_visible[self.index],@face_index[self.index],0,50)
else
@information_window.contents.blt(0,50,Cache.battler(@character[self.index],0),@character_rect)
end
else
@information_window.contents.clear
@information_window.draw_text(100,0,100,24,"未解锁")
end
end
end
end
def set_character(character)
@character=character
end
end
class Scene_Information<Scene_MenuBase
MAX_ROW_WORDS=12
def initialize
super()
@pages=[]
#--------------------------------------------------------------------------
# ●以下这是这个脚本关键,按说明填数组中的内容
#--------------------------------------------------------------------------
name_array=["初入世道长略试探","剧毒术士","宙斯","幻影长矛手","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"]
#说明上面一句是设置npc的名字,名字中不要换行
set_name_switches={0=>1,1=>2,2=>3,3=>4,4=>5,5=>6,6=>7,7=>8,8=>9,9=>10,10=>11,11=>12,12=>13,13=>14,14=>15,
15=>16,16=>17,17=>18,18=>19,19=>20,20=>21,21=>22}
#上面设置每个npc图鉴是否可见所对应的开关,比如把剧毒术士对应7号开关
#可以这样设置“ 1=>7”左边的1表示7号开关对应名字数组中的1号位置即数组中的
#第二项。因为数组的0号位置对应数组的第一项,说以以此类推这样设置。
@hand_book={"初入世道长略试探"=>"仙途初始风波起,世间苍茫少不了风波异事。
话说这宁海县境内的小桑村,突生离奇怪病。不得已请来三清派茂阳道长,前来看个究竟。",
"剧毒术士"=>"我是剧毒术士","1"=>"8","14"=>"20"}
#以上数组是设置npc的介绍,里面可以换行,如果有英文字母p,则p以后的
#内容会令起一段。
face=["自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01",
"自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01","自定义01",]
#以上是设置npc的头像文件名,在actor文件夹下。可以自己更改
face_index=[0,1,2,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
#以上是设置每个对应头像的文件中具体头像的编号,应为每个头像文件包含
#8个头像,所以要设置一下。,如果你不想用默认头像,应自己的图像
character=["asura","bandit","captain","hero_m"]
#设置人物半身像,半身像文件要放在ballters中,文件名填入以上数组
#注意半身像文件高度不要超过200,宽度不要超过96.
#注意以上数组中的项数一定要相同,比如上面填写的数组每个都是4项。
#--------------------------------------------------------------------------
# ●以上这是这个脚本关键按说明填数组中的内容
#--------------------------------------------------------------------------
@face_visible=[]
@face_index=[]
@name_visible_array=[]
@character_visible=[]
for i in 0..set_name_switches.size-1
if $game_switches[set_name_switches[i]]==true
@name_visible_array.push(name_array[i])
@face_visible.push(face[i])
@face_index.push(face_index[i])
@character_visible.push(character[i])
else
@name_visible_array.push("未解锁")
@face_visible.push("")
@face_index.push(9)
@character_visible.push("")
end
end
@hand_book.each{|key,value|@hand_book[key]=hand_book_tolines(value)}
end
def start
super
create_title_window
create_inforcommand_window
end
def create_title_window
@title_window=Window_Base.new(0,0,544,50)
@title_window.draw_text(220,0,100,24,"风物志-故事篇")
end
def create_inforcommand_window
@inforcommand_window=Window_InforCommand.new(0,50,@name_visible_array, @hand_book,@face_visible,@face_index)
@inforcommand_window.set_handler(:cancel, method(:return_scene))
@inforcommand_window.set_character(@character_visible)
end
#下面这个函数是脚本关键部分之一,不理解不影响脚本的使用
#这里说明一下:这个脚本的想法是把每个图鉴的字符串分按字数分为
#几个数组,每个数组会画成图鉴窗口的一行字符,9个字为一行,
#所以这个有个问题,即每个图鉴中的文字最好不要超过60个字,否则多余的字会显示
#不出来。
def hand_book_tolines(string)
@inforlines=[]
inforline=""
wordCount=0
lineCount=0
string.delete!("\n ")
loop do
c=string.slice!(/./m)
if c==nil
break
end
if c!="p"
if wordCount<MAX_ROW_WORDS
wordCount+=1
else
@inforlines.push(inforline)
wordCount=1
inforline=""
end
inforline+=c
else
@inforlines.push(inforline)
wordCount=0
inforline=""
end
end
@inforlines.push(inforline)
return @inforlines
end
end