赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 1678 |
最后登录 | 2024-2-9 |
在线时间 | 125 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 230
- 在线时间
- 125 小时
- 注册时间
- 2013-12-20
- 帖子
- 57
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#encoding:utf-8 #============================================================================== # ■ Window_KeyItem #------------------------------------------------------------------------------ # 此視窗使用於事件指令中的“選擇物品”功能。 #============================================================================== class Window_KeyItem < Window_ItemList #-------------------------------------------------------------------------- # ● 查詢清單中是否含有此物品 #-------------------------------------------------------------------------- def include?(item) if @category==:key_item if ($game_variables[5000]!="")&&($game_variables[5000]!=0) item.is_a?(RPG::Item) &&(item.read_note('itype_id')==$game_variables[5000]) else item.is_a?(RPG::Item) &&item.key_item? end else false end end end
#encoding:utf-8
#==============================================================================
# ■ Window_KeyItem
#------------------------------------------------------------------------------
# 此視窗使用於事件指令中的“選擇物品”功能。
#==============================================================================
class Window_KeyItem < Window_ItemList
#--------------------------------------------------------------------------
# ● 查詢清單中是否含有此物品
#--------------------------------------------------------------------------
def include?(item)
if @category==:key_item
if ($game_variables[5000]!="")&&($game_variables[5000]!=0)
item.is_a?(RPG::Item) &&(item.read_note('itype_id')==$game_variables[5000])
else
item.is_a?(RPG::Item) &&item.key_item?
end
else
false
end
end
end
这是和农场一起的 发现物品 脚本 就是他的第15行出错
$time = {} code_time = Thread.new{ loop do $time.each do |k,v| $time[k] = [v - 1,0].max end sleep 1 end } class Sprite_time < Sprite_Base attr_accessor :ch def initialize(view_port,ch) super(view_port) @ch = ch @time = $time[[$game_map.map_id,@ch.id]] @new = true @item_inde=0 @plant_index=0 @plant_count=0 @plant_time=[] @plant_name=[] self.bitmap = Bitmap.new(96,36) end def clear_self if $time[[$game_map.map_id,@ch.id]] == 0 $time.delete([$game_map.map_id,@ch.id]) self.dispose return true else return false end end def update if @ch.name=~ /%(\d[,,])?(\d+[,,])(\d+[,,])(\d+)/ @item_index=$2.to_i @plant_index=$3.to_i @plant_count=$4.to_i @plant_time=$data_items[@item_index].read_note('Plant_Time') @plant_name=$data_items[@item_index].read_note('Plant_S') end if @time == nil if @plant_count>0 @plant_index=@plant_time.length-1 @ch.name='%1,'+@item_index.to_s+','+@plant_index.to_s+','+@plant_count.to_s end $time[[$game_map.map_id,@ch.id]] =@plant_time[@plant_index] end if @time != $time[[$game_map.map_id,@ch.id]] || @new @time = $time[[$game_map.map_id,@ch.id]] @new = false if @time != 0 ho = @time / 3600 mi = @time / 60 - ho * 60 se = @time % 60 string = sprintf("%02d:%02d:%02d", ho,mi,se) if ho >0 string = sprintf("%02d:%02d",mi,se) if ho == 0 else @plant_index+=1 @ch.name='%1,'+@item_index.to_s+','+@plant_index.to_s+','+@plant_count.to_s if @plant_index>=@plant_time.length string = "收获啦~" else $time[[$game_map.map_id,@ch.id]] =@plant_time[@plant_index] end end self.bitmap.clear self.bitmap.font.size = 14 self.bitmap.draw_text(0,18,96,18,string,1) self.bitmap.draw_text(0,0,96,18,@plant_name[@plant_index],1) end self.x = @ch.screen_x - 48 self.y = @ch.screen_y - 72 end end class Game_Interpreter def add_self(item_index,count) if $time[[$game_map.map_id,@event_id]] == nil $game_map.events[@event_id].name='%1,'+item_index.to_s+",0,"+count.to_s#+($data_items[item_index].read_note('Plant_Time_First')).to_s view_port = Viewport.new(0, 0, 544, 416) sprite = Sprite_time.new(view_port,$game_map.events[@event_id]) SceneManager.scene.spriteset.character_sprites.push(sprite) SceneManager.scene.spriteset.update end end def get_result if $time[[$game_map.map_id,@event_id]] > 0 return false elsif $time[[$game_map.map_id,@event_id]] == 0 SceneManager.scene.spriteset.clear_time($game_map.events[@event_id]) return true end end alias :iisnow_command_201 :command_201 def command_201 $flag = @params[0] == 0 ? @params[1] : $game_variables[@params[1]] iisnow_command_201 end end class Scene_Map < Scene_Base attr_accessor :spriteset alias :iisnow_start :start def start $flag = $game_map.map_id iisnow_start end end class Spriteset_Map attr_accessor :character_sprites alias :iisnow_update :update def update if $flag $time.each do |k,v| if k[0] == $flag && $flag == $game_map.map_id view_port = Viewport.new(0, 0, 544, 416) sprite = Sprite_time.new(view_port,$game_map.events[k[1]]) @character_sprites.push(sprite) end end $flag = nil if $flag == $game_map.map_id end iisnow_update end def clear_time(d) @character_sprites.each do |s| c = s.clear_self if s.is_a?(Sprite_time)&&s.ch==d @character_sprites[@character_sprites.index(s)] = nil if c end @character_sprites.compact! end end
$time = {}
code_time = Thread.new{
loop do
$time.each do |k,v|
$time[k] = [v - 1,0].max
end
sleep 1
end
}
class Sprite_time < Sprite_Base
attr_accessor :ch
def initialize(view_port,ch)
super(view_port)
@ch = ch
@time = $time[[$game_map.map_id,@ch.id]]
@new = true
@item_inde=0
@plant_index=0
@plant_count=0
@plant_time=[]
@plant_name=[]
self.bitmap = Bitmap.new(96,36)
end
def clear_self
if $time[[$game_map.map_id,@ch.id]] == 0
$time.delete([$game_map.map_id,@ch.id])
self.dispose
return true
else
return false
end
end
def update
if @ch.name=~ /%(\d[,,])?(\d+[,,])(\d+[,,])(\d+)/
@item_index=$2.to_i
@plant_index=$3.to_i
@plant_count=$4.to_i
@plant_time=$data_items[@item_index].read_note('Plant_Time')
@plant_name=$data_items[@item_index].read_note('Plant_S')
end
if @time == nil
if @plant_count>0
@plant_index=@plant_time.length-1
@ch.name='%1,'+@item_index.to_s+','+@plant_index.to_s+','+@plant_count.to_s
end
$time[[$game_map.map_id,@ch.id]] =@plant_time[@plant_index]
end
if @time != $time[[$game_map.map_id,@ch.id]] || @new
@time = $time[[$game_map.map_id,@ch.id]]
@new = false
if @time != 0
ho = @time / 3600
mi = @time / 60 - ho * 60
se = @time % 60
string = sprintf("%02d:%02d:%02d", ho,mi,se) if ho >0
string = sprintf("%02d:%02d",mi,se) if ho == 0
else
@plant_index+=1
@ch.name='%1,'+@item_index.to_s+','+@plant_index.to_s+','+@plant_count.to_s
if @plant_index>=@plant_time.length
string = "收获啦~"
else
$time[[$game_map.map_id,@ch.id]] =@plant_time[@plant_index]
end
end
self.bitmap.clear
self.bitmap.font.size = 14
self.bitmap.draw_text(0,18,96,18,string,1)
self.bitmap.draw_text(0,0,96,18,@plant_name[@plant_index],1)
end
self.x = @ch.screen_x - 48
self.y = @ch.screen_y - 72
end
end
class Game_Interpreter
def add_self(item_index,count)
if $time[[$game_map.map_id,@event_id]] == nil
$game_map.events[@event_id].name='%1,'+item_index.to_s+",0,"+count.to_s#+($data_items[item_index].read_note('Plant_Time_First')).to_s
view_port = Viewport.new(0, 0, 544, 416)
sprite = Sprite_time.new(view_port,$game_map.events[@event_id])
SceneManager.scene.spriteset.character_sprites.push(sprite)
SceneManager.scene.spriteset.update
end
end
def get_result
if $time[[$game_map.map_id,@event_id]] > 0
return false
elsif $time[[$game_map.map_id,@event_id]] == 0
SceneManager.scene.spriteset.clear_time($game_map.events[@event_id])
return true
end
end
alias :iisnow_command_201 :command_201
def command_201
$flag = @params[0] == 0 ? @params[1] : $game_variables[@params[1]]
iisnow_command_201
end
end
class Scene_Map < Scene_Base
attr_accessor :spriteset
alias :iisnow_start :start
def start
$flag = $game_map.map_id
iisnow_start
end
end
class Spriteset_Map
attr_accessor :character_sprites
alias :iisnow_update :update
def update
if $flag
$time.each do |k,v|
if k[0] == $flag && $flag == $game_map.map_id
view_port = Viewport.new(0, 0, 544, 416)
sprite = Sprite_time.new(view_port,$game_map.events[k[1]])
@character_sprites.push(sprite)
end
end
$flag = nil if $flag == $game_map.map_id
end
iisnow_update
end
def clear_time(d)
@character_sprites.each do |s|
c = s.clear_self if s.is_a?(Sprite_time)&&s.ch==d
@character_sprites[@character_sprites.index(s)] = nil if c
end
@character_sprites.compact!
end
end
这是农场脚本
而作者发的范例使用起来就没问题
我觉得不是脚本冲突问题 因为我新创建的工程也是这个错误
是不是作者在某个脚本里添加了什么被我忽略了
脚本盲 只会照猫画虎 求大神笼罩
这是出错的截图
|
|