Project1
标题:
同一个脚本的又一个问题
[打印本页]
作者:
谢拉卡姗娜
时间:
2008-3-22 00:56
标题:
同一个脚本的又一个问题
{/fd}前两天关于这个脚本问过一次,这次又有问题了……
#####################################################################
#简陋的线索仓库= =
#
#偷懒用了物品栏= =
#调用$scene = Scene_Clue.new
#物品名+“,”+类别代号+“,”+颜色代号= =
#比如"照片,3,1"显示出来是照片类,粉色字= =
#类别代号: 0 :侦探小说 1 :书信 2 :日记 3 :照片 4 :备用1
#5 :备用2 6 :备用3
#(名称是胡乱设的说= =可以自己改~删掉大概也米关系吧= =)
#颜色代号: 和帮助里一样的说
#如果物品设置的不能使用,按回车显示出的就是物品说明```
#可以使用的话就挂公共事件= =
#物品说明栏 \V[n]显示第n号变量的值
# \E 换行
# \C[n]换用第n号颜色
# \N[n]显示第n号角色名称
# \P[n]显示在cluepics里的cluepic_n图片(照片什么的用吧= =)
#暂时米想到还有什么其他的了= =
########################################################################
class Window_Clue < Window_Selectable
def initialize
super(160, 0, 480, 416)
@column_max = 2
refresh(0)
self.index = 0
end
def item
return @data[self.index]
end
def clear
if self.contents != nil
self.contents.clear
end
end
def refresh(type)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case type
when 0
for i in 1...$data_items.size
if $data_items[i].name.split(/,/)[1] == "0" and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
when 1
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "1"
@data.push($data_items[i])
end
end
when 2
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "2"
@data.push($data_items[i])
end
end
when 3
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "3"
@data.push($data_items[i])
end
end
when 4
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "4"
@data.push($data_items[i])
end
end
when 5
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "5"
@data.push($data_items[i])
end
end
when 6
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "6"
@data.push($data_items[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
end
self.contents.font.color = normal_color
x = 4 + index % 2 * (205 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
if !item.name.split(/,/)[2].nil?
self.contents.font.color = text_color(item.name.split(/,/)[2].to_i)
else
self.contents.font.color = text_color(7)
end
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name.split(/,/)[0], 0)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
module RPG
module Cache
def self.cluepic(filename)
self.load_bitmap("Graphics/cluepics/", filename)
end
end
end
class Window_ClueHelp < Window_Base
def initialize
super(50, 50, 380, 380)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 99999
end
def clear
self.contents.clear
end
def set_text(mes)
self.contents.clear
self.contents.font.color = normal_color
x = y = 0
@cursor_width = 0
if $game_temp.choice_start == 0
x = 8
end
if mes!= nil
text = mes.clone
begin
last_text = text.clone
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until text == last_text
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
text.gsub!(/\\\\/) { "\000" }
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
text.gsub!(/\\[Gg]/) { "\002" }
text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\003[#{$1}]" }
text.gsub!(/\\[Ee]/) { "\004" }
while ((c = text.slice!(/./m)) != nil)
if c == "\000"
c = "\\"
end
if c == "\001"
text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
next
end
if c == "\002"
y += 1
x = 0
next
end
if c == "\003"
text.sub!(/\[([0-9]+)\]/, "")
t = RPG::Cache.cluepic("cluepic_#{$1}")
self.contents.blt(x, 32 * y, t, t.rect)
t.dispose
next
end
if c == "\004"
y += 1
x = 0
if y >= $game_temp.choice_start
x = 8
end
next
end
self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
x += self.contents.text_size(c).width
end
end
end
end
class Window_Item
alias new_refresh refresh
def refresh
@data = []
# 添加报务
for i in 1...$data_items.size
unless $data_items[i].name.split(/,/)
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
end
end
class Scene_Clue
def main
@spriteset = Spriteset_Map.new
@help_window = Window_ClueHelp.new
@help_window.visible = false
@clue_window = Window_Clue.new
@clue_window.opacity = 160
@clue_window.index = -1
@clue_window.clear
@clue_window.active = false
@class_window = Window_Command.new(160, ["侦探小说", "书信", "日记", "照片", "备用1", "备用2", "备用3"])
@class_window.opacity = 160
@clue_window.help_window = @help_window
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@help_window.dispose
@clue_window.dispose
@class_window.dispose
end
def update
@help_window.update
@clue_window.update
@class_window.update
if @class_window.active
update_class
return
end
if @clue_window.active
update_clue
return
end
if @help_window.active
update_help
return
end
end
def update_class
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@class_window.active = false
@clue_window.active = true
@clue_window.index = 0
@clue_window.refresh(@class_window.index)
@help_window.visible = false
end
if Input.dir4 !=0
@clue_window.refresh(@class_window.index)
end
end
def update_clue
@help_window.visible = false
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@help_window.clear
@help_window.visible = false
@clue_window.active = false
@class_window.active = true
@clue_window.index = -1
end
if Input.trigger?(Input::C)
@item = @clue_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
if $game_party.item_can_use?(@item.id)
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@clue_window.draw_item(@clue_window.index)
end
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
return
else
$game_system.se_play($data_system.decision_se)
@clue_window.active = false
@help_window.visible = true
@help_window.active = true
return
end
end
end
def update_help
@help_window.active = true
@help_window.visible = true
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@help_window.active = false
@help_window.visible = false
@clue_window.active = true
end
end
end
复制代码
使用后无法在战斗画面使用道具……
不会是脚本冲突的问题,新工程也一样
在那里能修改?
[LINE]1,#dddddd[/LINE]
此贴于 2008-3-26 0:22:58 被版主水迭澜提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
----------------版务----------------
如果问题未解决,请继续提问
如果问题已解决,请结贴
若到末贴发贴时间后一周仍未结贴
管理员会自动为你过期帖子、结贴或强行认可答案(好人卡-1)
作者:
做游戏的新手
时间:
2008-3-22 00:58
那么,你的XP是1.02还是1.03的呢{/hx}
作者:
谢拉卡姗娜
时间:
2008-3-22 01:03
{/fd}1.03
作者:
dbshy
时间:
2008-3-23 01:22
确实是脚本冲突,作者偷懒直接用了默认的物品栏,LZ把脚本中
for i in 1...$data_items.size
unless $data_items
.name.split(/,/)
if $game_party.item_number(i) > 0
@data.push($data_items
)
end
end
end
删了
自己再写一个仓库的物品栏吧
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1