Project1
标题:
帮忙!帮忙!要紧事
[打印本页]
作者:
a5396982
时间:
2008-11-7 03:07
标题:
帮忙!帮忙!要紧事
为什么我一起用上主站的射击ARPG和图片标题就出错?
谁能帮我改改?
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ 图片标题菜单1.0
# Scene_Title
#------------------------------------------------------------------------------
# 作者:chaochao
# http://zhuchao.go1.icpcn.com
#==============================================================================
class Scene_Title
def main
if $BTEST
battle_test
return
end
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
# 生成标题图形
@sprite = [Sprite.new]
for i in 0..6
@sprite[i] = Sprite.new
@sprite[i].opacity = 0
end
@sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
@sprite[0].opacity = 0
#开始游戏的图片
@sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start-1.png")
@sprite[2].bitmap = Bitmap.new("Graphics/Pictures/start-2.png")
#继续游戏的图片
@sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue-1.png")
@sprite[4].bitmap = Bitmap.new("Graphics/Pictures/continue-2.png")
#结束游戏的图片
@sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit-1.png")
@sprite[6].bitmap = Bitmap.new("Graphics/Pictures/exit-2.png")
#图片位置
for i in 1..6
x=170
y=(i+1)/2*35+240
@sprite[i].x =x
@sprite[i].y =y
end
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
if @continue_enabled
@command_index = 1
else
@command_index = 0
@sprite[3].tone = Tone.new(0, 0, 0, 255)
@sprite[4].tone = Tone.new(0, 0, 0, 255)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
#淡出背景圖形
if @sprite[0].opacity <= 255
@sprite[0].opacity += 15
end
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
# 釋放圖形
for i in 0..6
@sprite[i].bitmap.dispose
@sprite[i].dispose
end
end
def update
chaochaocommandchaochao
if Input.trigger?(Input::C)
case @command_index
when 0
command_new_game
when 1
command_continue
when 2
command_shutdown
end
end
end
def chaochaocommandchaochao
if Input.trigger?(Input::UP)
@command_index -= 1
if @command_index < 0
@command_index = 2
end
$game_system.se_play($data_system.cursor_se)
end
if Input.trigger?(Input::DOWN)
@command_index += 1
if @command_index > 2
@command_index = 0
end
$game_system.se_play($data_system.cursor_se)
end
case @command_index
when 0
if @sprite[1].opacity >= 0
@sprite[1].opacity -= 30
end
if @sprite[2].opacity <= 240
@sprite[2].opacity += 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
when 1
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity >= 0
@sprite[3].opacity -= 30
end
if @sprite[4].opacity <= 240
@sprite[4].opacity += 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
when 2
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity >= 0
@sprite[5].opacity -= 30
end
if @sprite[6].opacity <= 240
@sprite[6].opacity += 30
end
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
谁来帮帮我啊?? [LINE]1,#dddddd[/LINE]
此贴于 2008-11-7 3:15:14 被版主天圣的马甲提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
此贴于 2008-11-10 14:51:02 被版主darkten提醒,请楼主看到后对本贴做出回应。
作者:
天圣的马甲
时间:
2008-11-7 11:14
某处的参数未定义。问题是Title的脚本怎么可能和战斗脚本冲突= =
把你的那些核心脚本和工程都弄上来。然后修改标题,否则D字大刀伺候。
作者:
a5396982
时间:
2008-11-8 01:20
=begin
脚本:【怨念产物 - GIF图片播放】
功能:在游戏中播放GIF图片 ※ 表情优先。
说明: 使用步骤:
1、使用 @gs = GIFSprite.new([viewport,[x,[,y,[loop_counts]]]])
创建GIF图片对象;
2、然后使用 @gs.bitmap = "gif_filename" ※ 包含文件夹路径;
3、可以 @gs.loop_counts = n
设置循环次数,-1表示无限循环(默认的),0就释放图片。
4、@gs.x = x,@gs.y = y,@gs.z = z 等设置各种坐标值。
补充:1、由于考虑的效率问题,提供了生成临时文件技术,即第一运行之后以后每次运
行会直接读取临时文件生成对象,可以使用 GIFSprite.TmpFileclear 清空临时
文件。
2、可以使用 GIFSprite.pre_load(filename_arr) 数组预加载一组图片。
版本:v1.0
作者:灼眼的夏娜
=end
#==============================================================================
# ■ System
#------------------------------------------------------------------------------
# 处理系统相关的模块 。
#==============================================================================
module System
#--------------------------------------------------------------------------
# ● 模块函数
#--------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
# ● API函数声明
#--------------------------------------------------------------------------
WinExec = Win32API.new("kernel32","WinExec",'pi','i')
#--------------------------------------------------------------------------
# ● 查看或修改文件及文件夹属性
# filename :文件或文件夹名字
#
# +a -a :添加、删除 存档 属性
# +r -r :添加、删除 只读 属性
# +s -s :添加、删除 系统 属性
# +h -h :添加、删除 隐藏 属性
#--------------------------------------------------------------------------
def attrib(filename,*args)
if args.empty?
astr = `attrib #{filename}`
attri_arr = Array.new
astr = astr.split(/:/)[0]
astr = astr[0,astr.size - 1]
astr.gsub!(/ /,"")
return astr.split(//)
else
cmdline = ""
for cmdchar in args
cmdchar.downcase!
next if cmdline.include? cmdchar
if ["+a","-a","+r","-r","+s","-s","+h","-h"].include? cmdchar
cmdline += " " + cmdchar
end
end
cmdline += " "
result = WinExec.call("attrib #{cmdline}#{filename}",0)
if result < 31
return
end
end
end
end
#==============================================================================
# ■ GIF
#------------------------------------------------------------------------------
# 分析处理GIF图片的核心模块 。
#==============================================================================
module GIF
# 定义常量
SIZE_GIFH = 6
SIZE_GIFS = 7
SIZE_GIFI = 9
SIZE_GIFC = 6
SIZE_GIFP = 13
SIZE_GIFA = 12
CODE_MASK = [0x0000,
0x0001,0x0003,0x0007,0x000f,
0x001f,0x003f,0x007f,0x00ff,
0x01ff,0x03ff,0x07ff,0x0fff]
INC_TABLE = [8,8,4,2,0]
BGN_TABLE = [0,4,2,1,0]
# 建立文件夹
Dir.mkdir("GIF") unless Dir["*"].include?("GIF")
# 函数定义
module_function
#--------------------------------------------------------------------------
# ● 分解gif图片
#--------------------------------------------------------------------------
def analyze_gif
@old_dir = Dir.pwd
Dir.chdir("GIF")
@total_gif = []
for g in Dir["*"]
suf = g.split(/\./)
if suf[1].is_a?(String) and suf[1].downcase == "gif"
@total_gif.push(g)
Dir.mkdir(suf[0]) unless Dir["*"].include? suf[0]
end
end
@total_gif.each{|file| self.readdata(file)}
Dir.chdir(@old_dir)
p '全部分解完毕,点击确定退出'
exit
end
#--------------------------------------------------------------------------
# ● 读取文件数据:成功返回@gif_infos,失败返回nil
#--------------------------------------------------------------------------
def readdata(filename)
# 检查是否有临时记忆文件
tmp_filename = File.basename(filename,".*")
unless Dir["~TEMP/#{tmp_filename}_infos.fmd"].empty?
begin
giffr = open("~TEMP/#{tmp_filename}_infos.fmd","rb")
tmp_infos = Marshal.load(giffr)
giffr.close
if Dir["~TEMP/#{tmp_filename}_*.png"].size == tmp_infos.total_frames
return tmp_infos
end
rescue
end
end
# 初始化数据
self.initial_var(filename)
# 打开文件
begin
@f = open(filename,"rb")
# 读取文件头
self.read_gifh
# 读取逻辑屏幕描述块
self.read_gifs
# 读取下一个字节
@temp = @f.read(1)[0]
# 循环读取每个图象描述块
while true
if @temp == 0x2c
# 读取图象描述块
self.read_gifi
end
if @temp == 0x21
# 读取图象扩展块
self.read_gife
end
if @temp == 0x3b
break
end
# 读取下一个字节
@temp = @f.read(1)[0]
end
# ※ 设置图象帧数
@gif_infos.total_frames = @frame_count
# ※ 写入图象分解数据
giffw = open("~TEMP/#{@filename}_infos.fmd","wb")
Marshal.dump(@gif_infos,giffw)
giffw.close
rescue
return nil
ensure
@f.close
end
return @gif_infos
end
#--------------------------------------------------------------------------
# ● 初始化变量
#--------------------------------------------------------------------------
def initial_var(filename)
# ※ 生成图象数据对象
@gif_infos = GIFSprite::Infos.new
# 帧数计数
@frame_count = 0
@f = nil
@temp = nil
# 获取文件名
@filename = File.basename(filename,".*")
end
#--------------------------------------------------------------------------
# ● 读取文件头
#--------------------------------------------------------------------------
def read_gifh
@gifh = @f.read(SIZE_GIFH)
if @gifh[0,3] != "GIF"
raise "不是GIF文件!"
end
if @gifh[3,3] != "87a" and @gifh[3,3] != "89a"
raise "不支持的版本!"
end
end
#--------------------------------------------------------------------------
# ● 读取逻辑屏幕描述块
#--------------------------------------------------------------------------
def read_gifs
@gifs = @f.read(SIZE_GIFS).unpack("S2C3")
# 获取调色板位数
@_pal_bits = (@gifs[2] & 7) + 1
# ※ 获取图象宽度
@gif_infos.width = @gifs[0]
# ※ 获取图象高度
@gif_infos.height = @gifs[1]
# 是否有全局调色板
if @gifs[2] >> 7 == 1
# 全局调色板大小
@g_pal_size = 3 * (1 << @_pal_bits)
# 读取全局调色板数据
@g_pal = @f.read(@g_pal_size).unpack("C*")
end
end
#--------------------------------------------------------------------------
# ● 读取图象描述块
#--------------------------------------------------------------------------
def read_gifi
# 读取图象描述块
@gifi = @f.read(SIZE_GIFI).unpack("S4C")
# ※ 生成临时帧数据对象
@gif_fd = GIFSprite::Infos::FrameData.new if @gif_fd.nil?
# ※ 获取帧偏移
@gif_fd.offset_x = @gifi[0]
@gif_fd.offset_y = @gifi[1]
# 获取宽度和高度
@_width = @gifi[2]
@_height = @gifi[3]
# 清空局部调色板
@l_pal = nil
# 是否有局部调色板
if @gifi[4] >> 7 == 1
# 获取调色板位数
@_pal_bits = (@gifi[4] & 7) + 1
# 局部调色板大小
@l_pal_size = 3 * (1 << @_pal_bits)
# 读取局部调色板数据
@l_pal = @f.read(@l_pal_size).unpack("C*")
end
# 获取交错标记
@_lace = (@gifi[4] >> 6) & 1
# 修正调色板位数
@_pal_bits = @_pal_bits == 1 ? 1 : (@_pal_bits <= 4 ? 4 : 8)
# 获取行字节数
@_width_bytes = (((@_width * @_pal_bits) + 31) >> 5) << 2
# 读取图象压缩数据
self.read_lzw_data
# ※ 设置GIF帧数据
@gif_infos.frame_data[@frame_count - 1] = @gif_fd
# ※ 清除帧数据
@gif_fd = nil
end
#--------------------------------------------------------------------------
# ● 读取图象压缩数据
#--------------------------------------------------------------------------
def read_lzw_data
# 解码用
lzw_mincodelen = @f.read(1)[0]
# 帧数加 1
@frame_count += 1
# 图象块数据
image_data = ""
# 块大小
blocksize = @f.read(1)[0]
while blocksize > 0
image_data += @f.read(blocksize)
blocksize = @f.read(1)[0]
end
# 导出图象
self.dump_imgs(image_data,lzw_mincodelen)
end
#--------------------------------------------------------------------------
# ● 读取扩充块
#--------------------------------------------------------------------------
def read_gife
label = @f.read(1)[0]
case label
when 0xf9 # 图形控制扩展块
@gifc = @f.read(SIZE_GIFC).unpack("C2SC2")
# ※ 生成帧数据对象
@gif_fd = GIFSprite::Infos::FrameData.new
# ※ 获取帧数据 延迟时间
@gif_fd.delay_time = @gifc[2]
# ※ 获取下一帧的处理方法
@gif_fd.disposal_method = (@gifc[1] & 28) >> 2
# 获取透明颜色
@_trans_index = nil
if @gifc[1] & 1 > 0
@_trans_index = @gifc[3]
end
when 0x01 # 图形说明扩展块
@gifp = @f.read(SIZE_GIFP).unpack("CS4C4")
blocksize = @f.read(1)[0]
while blocksize > 0
@f.read(blocksize)
blocksize = @f.read(1)[0]
end
when 0xfe # 注解说明扩展块
blocksize = @f.read(1)[0]
while blocksize > 0
@f.read(blocksize)
blocksize = @f.read(1)[0]
end
when 0xff # 应用程序扩展块
@gifa = @f.read(SIZE_GIFA).unpack("C*")
blocksize = @f.read(1)[0]
while blocksize > 0
@f.read(blocksize)
blocksize = @f.read(1)[0]
end
end
end
#--------------------------------------------------------------------------
# ● 设置调色板
#--------------------------------------------------------------------------
def set_pal
@_pal = []
if @l_pal != nil
@_pal = @l_pal
elsif @g_pal != nil
@_pal = @g_pal
else
for i in 0...1 << @_pal_bits
@_pal.push i,i,i
end
end
end
#--------------------------------------------------------------------------
# ● 解码图形数据
#--------------------------------------------------------------------------
def dump_imgs(image_data,lze_len)
@image_data = image_data.unpack("C*")
self.set_pal
@png_data = []
@stack = []
@images = []
@prefix = []
@suffix = []
@bitcount = @_pal_bits
@widthcount = 0
@left_bits = 0x00
@current_bits = lze_len + 0x01
@lzw_clear = 1 << lze_len
@lzw_eoi = @lzw_clear + 1
@nowtablendx = @lzw_clear + 2
@toptablendx = 1 << @current_bits
@wdata = 0
@wcode = 0
@oldcode = 0xffff
@row_num = 0
@tempchar = 0x00
@pass = 0x00
@firstchar = 0
@tempndx = 0
# 读取编码字符
self.read_byte
# 不是@lzw_eoi则循环
while @wcode != @lzw_eoi
# @lzw_clear码
if @wcode == @lzw_clear
for i in 0...@lzw_clear
@prefix[i] = 0xffff
@suffix[i] = i
end
for i in @nowtablendx...4096
@prefix[i] = 0xffff
@suffix[i] = 0x00
end
@current_bits = lze_len + 0x01
@nowtablendx = @lzw_clear + 2
@toptablendx = 1 << @current_bits
@oldcode = 0xffff
# 读取编码字符
self.read_byte
if @wcode != @lzw_eoi
while @prefix[@wcode] != 0xffff
@stack.push(@suffix[@wcode])
@wcode = @prefix[@wcode]
end
@stack.push(@suffix[@wcode])
@firstchar = @stack[-1]
# 输出解码数据
self.output_data
end
else
if @wcode < @nowtablendx
@tempndx = @wcode
else
@tempndx = @oldcode
@stack.push(@firstchar)
end
while @prefix[@tempndx] != 0xffff
@stack.push(@suffix[@tempndx])
@tempndx = @prefix[@tempndx]
end
@stack.push(@suffix[@tempndx])
@firstchar = @stack[-1]
@prefix[@nowtablendx] = @oldcode
@suffix[@nowtablendx] = @firstchar
@nowtablendx += 1
if @nowtablendx == @toptablendx and @current_bits < 12
@current_bits += 1
@toptablendx = 1 << @current_bits
end
# 输出解码数据
self.output_data
end
@oldcode = @wcode
# 读取编码字符
self.read_byte
end
Graphics.update
# 生成png图
self.make_png
end
#--------------------------------------------------------------------------
# ● 读取下一个字节
#--------------------------------------------------------------------------
def read_byte
while @left_bits < @current_bits
@next_char = @image_data.shift
@wdata |= (@next_char << @left_bits)
@left_bits += 0x08
end
@wcode = @wdata & CODE_MASK[@current_bits]
@wdata >>= @current_bits
@left_bits -= @current_bits
end
#--------------------------------------------------------------------------
# ● 输出解码数据
#--------------------------------------------------------------------------
def output_data
while
[email protected]
?
@tempchar |= (@stack.pop << (8 - @bitcount))
if @bitcount == 8
@images.push(@tempchar)
@tempchar = 0x00
@bitcount = @_pal_bits
else
@bitcount += @_pal_bits
end
@widthcount += 1
if @widthcount == @_width
if @bitcount != @_pal_bits
@images.push(@tempchar)
@tempchar = 0x00
@bitcount = @_pal_bits
end
@png_data[@row_num] = @images.clone
@images.clear
if @_lace > 0
@row_num += INC_TABLE[@pass]
if @row_num >= @_height
@pass += 1
@row_num = BGN_TABLE[@pass]
end
else
@row_num += 1
end
@widthcount = 0
end
end
end
#--------------------------------------------------------------------------
# ● 生成png图片
#--------------------------------------------------------------------------
def make_png
fp = open("~TEMP/#@filename" + sprintf("_%02d",@frame_count)+".png","wb")
fp.write(self.make_png_header)
fp.write(self.make_png_ihdr)
fp.write(self.make_png_plte) if @_trans_index.nil?
fp.write(self.make_png_idat)
fp.write(self.make_png_iend)
fp.close
end
#--------------------------------------------------------------------------
# ● png头文件
#--------------------------------------------------------------------------
def make_png_header
return [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a].pack("C*")
end
#--------------------------------------------------------------------------
# ● png信息头块
#--------------------------------------------------------------------------
def make_png_ihdr
ih_size = [13].pack("N")
ih_sign = "IHDR"
ih_width = [@_width].pack("N")
ih_height = [@_height].pack("N")
if @_trans_index != nil
ih_bit_depth = [@_pal_bits > 8 ? 16 : 8].pack("C")
ih_color_type = [6].pack("C")
else
ih_bit_depth = [@_pal_bits].pack("C")
ih_color_type = [3].pack("C")
end
ih_compression_method = [0].pack("C")
ih_filter_method = [0].pack("C")
ih_interlace_method = [0].pack("C")
string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type +
ih_compression_method + ih_filter_method + ih_interlace_method
ih_crc = [Zlib.crc32(string)].pack("N")
return ih_size + string + ih_crc
end
#--------------------------------------------------------------------------
# ● png调色板块
#--------------------------------------------------------------------------
def make_png_plte
pl_size = [@_pal.size].pack("N")
pl_sign = "PLTE"
pl_data = @_pal.pack("C*")
pl_crc = [Zlib.crc32(pl_sign + pl_data)].pack("N")
return pl_size + pl_sign + pl_data + pl_crc
end
#--------------------------------------------------------------------------
# ● png数据块
#--------------------------------------------------------------------------
def make_png_idat
lz_data = []
if @_trans_index != nil
for i in 0...@png_data.size
lz_data.push 0
for j in @png_data[i]
if j == @_trans_index
lz_data.push @_pal[j*3],@_pal[j*3+1],@_pal[j*3+2],0
else
lz_data.push @_pal[j*3],@_pal[j*3+1],@_pal[j*3+2],255
end
end
end
else
for i in 0...@png_data.size
lz_data.push 0
lz_data += @png_data[i]
end
end
id_data = Zlib::Deflate.deflate(lz_data.pack("C*"),9)
id_size = [id_data.size].pack("N")
id_sign = "IDAT"
id_crc = [Zlib.crc32(id_sign + id_data)].pack("N")
return id_size + id_sign + id_data + id_crc
end
#--------------------------------------------------------------------------
# ● png 结尾块
#--------------------------------------------------------------------------
def make_png_iend
ie_size = [0].pack("N")
ie_sign = "IEND"
ie_crc = [Zlib.crc32(ie_sign)].pack("N")
return ie_size + ie_sign + ie_crc
end
end
#==============================================================================
# ■ Graphics
#------------------------------------------------------------------------------
# 处理画面的模块 。
#==============================================================================
class << Graphics
#--------------------------------------------------------------------------
# ● 添加别名、线程、临界区
#--------------------------------------------------------------------------
unless method_defined? :origin_update
alias origin_update update
def update_critical
Thread.critical = true
origin_update
Thread.critical = false
end
Thread.new{loop{Graphics.update_critical;sleep(9)}}
end
#--------------------------------------------------------------------------
# ● 定义类变量
#--------------------------------------------------------------------------
@@gif_sprites = Array.new
#--------------------------------------------------------------------------
# ● 添加GIF图片精灵
#--------------------------------------------------------------------------
def add(gs)
@@gif_sprites << gs
end
#--------------------------------------------------------------------------
# ● 删除GIF图片精灵
#--------------------------------------------------------------------------
def del(gs)
@@gif_sprites.delete gs
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
update_critical
@@gif_sprites.each{|gs| gs.update}
end
end
#==============================================================================
# ■ GIFSprite
#------------------------------------------------------------------------------
# GIF精灵的核心类 。
#==============================================================================
class GIFSprite
#============================================================================
# ● GIFSprite::Infos
#----------------------------------------------------------------------------
# GIF图片信息类 。
#============================================================================
class Infos
#------------------------------------------------------------------------
# ● 定义实例变量
#------------------------------------------------------------------------
attr_accessor :total_frames
attr_accessor :width
attr_accessor :height
attr_accessor :frame_data
#------------------------------------------------------------------------
# ● 初始化
#------------------------------------------------------------------------
def initialize
@total_frames = 0
@width = 0
@height = 0
@frame_data = Array.new
end
#==========================================================================
# ● GIFSprite::Infos::FrameData
#--------------------------------------------------------------------------
# GIF图片每帧信息类 。
#==========================================================================
class FrameData
#----------------------------------------------------------------------
# ● 定义实例变量
#----------------------------------------------------------------------
attr_accessor :offset_x
attr_accessor :offset_y
attr_accessor :delay_time
attr_accessor :disposal_method
#----------------------------------------------------------------------
# ● 初始化
#----------------------------------------------------------------------
def initialize
@offset_x = 0
@offset_y = 0
@delay_time = 0
@disposal_method = 0
end
end
end
#--------------------------------------------------------------------------
# ● 预处理:建立临时文件夹
#--------------------------------------------------------------------------
unless Dir["*"].include?("~TEMP")
Dir.mkdir("~TEMP")
System.attrib("~TEMP","+h","+s")
end
#--------------------------------------------------------------------------
# ● 清空硬缓存
#--------------------------------------------------------------------------
def self.TmpFileclear
begin
Dir["~TEMP/*"].each{|filename| File.delete filename}
rescue
end
end
#--------------------------------------------------------------------------
# ● 预加载图片
#--------------------------------------------------------------------------
def self.pre_load(filename_arr)
filename_arr.each{|fn| GIF.readdata(fn)}
end
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :x
attr_accessor :y
attr_reader :z
attr_accessor :loop_counts
attr_accessor :viewport
#--------------------------------------------------------------------------
# ● 创建对象
#--------------------------------------------------------------------------
def self.new(viewport = nil,x = 0,y = 0,loop_counts = -1)
obj = super()
obj.viewport = viewport
obj.x = x
obj.y = y
obj.loop_counts = loop_counts
Graphics.add(obj)
obj
end
#--------------------------------------------------------------------------
# ● 获取图片信息
#--------------------------------------------------------------------------
def bitmap
@gif_infos
end
#--------------------------------------------------------------------------
# ● 设置图片文件名
#--------------------------------------------------------------------------
def bitmap=(filename)
@gif_infos = GIF.readdata(filename)
if @gif_infos != nil
@sp_arr = Array.new
basename = File.basename(filename,".*")
for i in 0...@gif_infos.total_frames
sp = Sprite.new(@viewport)
sp.bitmap = Bitmap.new(sprintf("~TEMP/#{basename}_%02d.png",i + 1))
sp.visible = i == 0
sp.x = @gif_infos.frame_data[i].offset_x
sp.y = @gif_infos.frame_data[i].offset_y
@sp_arr << sp
end
@update_frame_count = 0
@current_show_frame = 0
@next_frame_counts =
(@gif_infos.frame_data[0].delay_time * Graphics.frame_rate / 100)
end
end
#--------------------------------------------------------------------------
# ● 定义x=
#--------------------------------------------------------------------------
def x=(x)
if @gif_infos.nil?
@x = 0
return
end
@x = x
for i in 0...@gif_infos.total_frames
@sp_arr[i].x = @gif_infos.frame_data[i].offset_x + @x
end
end
#--------------------------------------------------------------------------
# ● 定义y=
#--------------------------------------------------------------------------
def y=(y)
if @gif_infos.nil?
@y = 0
return
end
@y = y
for i in 0...@gif_infos.total_frames
@sp_arr[i].y = @gif_infos.frame_data[i].offset_y + @y
end
end
#--------------------------------------------------------------------------
# ● 定义z=
#--------------------------------------------------------------------------
def z=(z)
if @gif_infos.nil?
@z = 0
return
end
@z = z
for i in 0...@gif_infos.total_frames
@sp_arr[i].z = @z
end
end
#--------------------------------------------------------------------------
# ● 获取宽度
#--------------------------------------------------------------------------
def width
return @gif_infos.nil? ? 0 : @gif_infos.width
end
#--------------------------------------------------------------------------
# ● 获取高度
#--------------------------------------------------------------------------
def height
return @gif_infos.nil? ? 0 : @gif_infos.height
end
#--------------------------------------------------------------------------
# ● 释放精灵
#--------------------------------------------------------------------------
def dispose
Graphics.del(self)
@sp_arr.each{|sp|
sp.bitmap.dispose
sp.dispose
}
@sp_arr.clear
@gif_infos = nil
end
#--------------------------------------------------------------------------
# ● 更新精灵
#--------------------------------------------------------------------------
def update
if @gif_infos.nil?
return
end
@update_frame_count += 1
if @update_frame_count >= @next_frame_counts
@current_show_frame = (@current_show_frame + 1) % @gif_infos.total_frames
case @gif_infos.frame_data[@current_show_frame - 1].disposal_method
when 0 # 不处理
when 1 # 图象保留在原处
when 2 # 当前图象消失
@sp_arr[@current_show_frame - 1].visible = false
when 3 # 尚不明 = =
end
@sp_arr[@current_show_frame].visible = true
if @current_show_frame == 0
@loop_counts -= 1 if @loop_counts > 0
if @loop_counts == 0
self.dispose
return
end
for i in 0...@sp_arr.size
@sp_arr[i].visible = i == @current_show_frame
end
end
@update_frame_count = 0
@next_frame_counts = (@gif_infos.frame_data[@current_show_frame]. delay_time * Graphics.frame_rate / 100)
end
end
end
复制代码
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#
# 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
# 可以更改的种类包括物品、防具、特技、武器。
#
# 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
# 数字为颜色编号,和对话框中的一样。
# ——————————————————————————————————————
module RPG
class Skill
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def name_color_66RPG
name_color = @description.split(/@/)[1]
return name_color != nil ? name_color.to_i : 0
end
end
class Weapon
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def name_color_66RPG
name_color = @description.split(/@/)[1]
return name_color != nil ? name_color.to_i : 0
end
end
class Item
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def name_color_66RPG
name_color = @description.split(/@/)[1]
return name_color != nil ? name_color.to_i : 0
end
end
class Armor
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def name_color_66RPG
name_color = @description.split(/@/)[1]
return name != nil ? name_color.to_i : 0
end
end
end
复制代码
作者:
a5396982
时间:
2008-11-8 01:23
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
# 若要更改属性,请搜索element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"} 改成对应属性即可
#==============================================================================
class Window_Help_Self < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(150,200, 180, 430)
self.opacity = 150
self.z=3001
self.visible = false
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
# align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
#--------------------------------------------------------------------------
def set_text(data)
@data=data
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon
set_weapon_text(@data)
when RPG::Armor
set_armor_text(@data)
when RPG::Skill
set_skill_text(@data)
end
end
#--------------------------------------------------------------------------
# ● 物品帮助窗口
#--------------------------------------------------------------------------
def set_item_text(item)
@item=item
[email protected]
x=0
y=0
height=1 #依要显示的内容确定高
#由描叙确定高
height+=description.size/3/10
if description.size%10!=0
height+=1
end
height+=3 #空行,效果范围,价格
if @item.recover_hp_rate!=0 #HP 回复率。
height+=1
end
if @item.recover_hp!=0 #HP 回复量。
height+=1
end
if @item.recover_sp_rate!=0 #SP 回复率。
height+=1
end
if @item.recover_sp!=0 #SP 回复量。
height+=1
end
if @item.parameter_type!=0 #增加能力值
height+=1
end
if @item.element_set.empty?!=true #属性。为属性 ID 的数组
height+=1
end
if @item.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
[email protected]
_state_set.size
end
if @item.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
[email protected]
_state_set.size
end
self.height=height*15+40+15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color =text_color(4)
self.contents.font.size=18
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @item.name.size*7, 20, text, 0)
else
self.visible = false
end
x=0
y+=1
text=description
#描绘描叙
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
x+=1
if x==10#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#效果范围
scope = {0=>"特殊物品",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
text="范围:"+scope[@item.scope]
x=0
y+=2 #空一行
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#价格
x=0
y+=1
text="价格:"
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#HP 回复率
if @item.recover_hp_rate!=0
x=0
y+=1
text="回复HP:"
[email protected]
_hp_rate.to_s+"%"
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#HP回复量
if @item.recover_hp!=0
x=0
y+=1
text="回复HP:"
[email protected]
_hp.to_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#SP 回复率
if @item.recover_sp_rate!=0
x=0
y+=1
text="回复MP:"
[email protected]
_sp_rate.to_s+"%"
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#SP 回复量
if @item.recover_sp!=0
x=0
y+=1
text="回复MP:"
[email protected]
_sp.to_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#增加能力值
if @item.parameter_type!=0
parameter_type={1=>"MaxHP",2=>"MaxSP",3=>$data_system.words.str,4=>$data_system.words.dex,5=>$data_system.words.agi,6=>$data_system.words.int}
x=0
y+=1
text="增益:"+parameter_type[@item.parameter_type]+" +"
[email protected]
_points.to_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#物品属性
if @item.element_set.empty?!=true #属性。为属性 ID 的数组
element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"}
text="属性:"
for i in
[email protected]
_set.size
text+=element_set[@item.element_set[i]]+" "
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#附加状态
if @item.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text="附加状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@item.plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
#解除状态
if @item.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text="解除状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@item.minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 武器帮助窗口
#--------------------------------------------------------------------------
def set_weapon_text(weapon)
@weapon=weapon
[email protected]
x=0
y=0
height=1 #依要显示的内容确定高
#由描叙确定高
height+=description.size/3/10
if description.size%10!=0
height+=1
end
height+=4 #2个空行,攻击,价格
if @weapon.pdef!=0 #物理防御
height+=1
end
if @weapon.mdef!=0 #魔法防御
height+=1
end
if @weapon.str_plus!=0 #力量
height+=1
end
if @weapon.dex_plus!=0#体质
height+=1
end
if @weapon.agi_plus!=0#敏捷
height+=1
end
if @weapon.int_plus!=0 #智力
height+=1
end
if @weapon.element_set.empty?!=true #属性。为属性 ID 的数组
height+=1
end
if @weapon.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
[email protected]
_state_set.size
end
if @weapon.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
[email protected]
_state_set.size
end
self.height=height*15+40+15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=18
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @weapon.name.size*7, 20, text, 0)
else
self.visible = false
end
x=0
y+=1
text=description
#描绘描叙
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
x+=1
if x==10#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#攻击
x=0
y+=2 #空行
text="攻击:"
[email protected]
_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#价格
x=0
y+=1
text="价格:"
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
if @weapon.pdef!=0 #物理防御
x=0
y+=1
text="物理防御:"
[email protected]
_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @weapon.mdef!=0 #魔法防御
x=0
y+=1
text="魔法防御:"
[email protected]
_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#武器属性
if @weapon.element_set.empty?!=true #属性。为属性 ID 的数组
element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"}
text="属性:"
for i in
[email protected]
_set.size
text+=element_set[@weapon.element_set[i]]+" "
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#附加状态
if @weapon.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text="附加状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@weapon.plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
#解除状态
if @weapon.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text="解除状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@weapon.minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
y+=1 #空行
if @weapon.str_plus!=0 #力量
x=0
y+=1
text=$data_system.words.str+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @weapon.dex_plus!=0#体质
x=0
y+=1
text=$data_system.words.dex+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @weapon.agi_plus!=0#敏捷
x=0
y+=1
text=$data_system.words.agi+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @weapon.int_plus!=0 #智力
x=0
y+=1
text=$data_system.words.int+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
#--------------------------------------------------------------------------
# ● 防具帮助窗口
#--------------------------------------------------------------------------
def set_armor_text(armor)
def set_armor_text(armor)
@armor=armor
[email protected]
x=0
y=0
height=1 #依要显示的内容确定高
#由描叙确定高
height+=description.size/3/10
if description.size%10!=0
height+=1
end
height+=2 #2个空行,价格
if @armor.pdef!=0 #物理防御
height+=1
end
if @armor.mdef!=0 #魔法防御
height+=1
end
if @armor.str_plus!=0 #力量
height+=1
end
if @armor.dex_plus!=0#体质
height+=1
end
if @armor.agi_plus!=0#敏捷
height+=1
end
if @armor.int_plus!=0 #智力
height+=1
end
if @armor.guard_element_set.empty?!=true #属性防御。为属性 ID 的数组
height+=1
end
if @armor.guard_state_set.empty?!=true #状态防御。为状态 ID 的数组
[email protected]
_state_set.size
end
self.height=height*15+40+15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=18
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @armor.name.size*7, 20, text, 0)
else
self.visible = false
end
x=0
y+=1
text=description
#描绘描叙
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
x+=1
if x==10#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#价格
x=0
y+=2#空行
text="价格:"
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
if @armor.pdef!=0 #物理防御
x=0
y+=1
text="物理防御:"
[email protected]
_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @armor.mdef!=0 #魔法防御
x=0
y+=1
text="魔法防御:"
[email protected]
_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#属性防御
if @armor.guard_element_set.empty?!=true #属性。为属性 ID 的数组
element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"}
text="属性防御:"
for i in
[email protected]
_element_set.size
text+=element_set[@armor.guard_element_set[i]]+" "
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#状态防御
if @armor.guard_state_set.empty?!=true #附加状态。为状态 ID 的数组
text="状态防御:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@armor.guard_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
y+=1 #空行
if @armor.str_plus!=0 #力量
x=0
y+=1
text=$data_system.words.str+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @armor.dex_plus!=0#体质
x=0
y+=1
text=$data_system.words.dex+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @armor.agi_plus!=0#敏捷
x=0
y+=1
text=$data_system.words.agi+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
if @armor.int_plus!=0 #智力
x=0
y+=1
text=$data_system.words.int+" + "
[email protected]
_plus.to_s
self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 技能帮助窗口
#--------------------------------------------------------------------------
def set_skill_text(skill)
@skill=skill
[email protected]
x=0
y=0
height=1 #依要显示的内容确定高
#由描叙确定高
height+=description.size/3/10
if description.size%10!=0
height+=1
end
height+=4 #空行,效果范围,消费SP,命中率
if @skill.power!=0 #威力,威力为0,则可能为状态魔法
height+=1
end
if @skill.element_set.empty?!=true #属性。为属性 ID 的数组
height+=1
end
if @skill.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
[email protected]
_state_set.size
end
if @skill.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
[email protected]
_state_set.size
end
self.height=height*15+40+15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color =text_color(6)
self.contents.font.size=18
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @skill.name.size*7, 20, text, 0)
else
self.visible = false
end
x=0
y+=1
text=description
#描绘描叙
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
x+=1
if x==10#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#效果范围
scope = {0=>"特殊技能",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
text="范围:"+scope[@skill.scope]
x=0
y+=2 #空一行
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#威力
if @skill.power!=0
x=0
y+=1
[email protected]
> 0 ? @skill.power : -1* @skill.power
text="威力:"+c.to_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#描绘消费SP
x=0
y+=1
text="消耗SP:"
[email protected]
_cost.to_s
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#命中率
x=0
y+=1
text="命中率:"
[email protected]
_s+"%"
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
#攻击属性
if @skill.element_set.empty?!=true #属性。为属性 ID 的数组
element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"}
text="属性:"
for i in
[email protected]
_set.size
text+=element_set[@skill.element_set[i]]+" "
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
#附加状态
if @skill.plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text="附加状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@skill.plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
#解除状态
if @skill.minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text="解除状态:"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
y-=1
x+=text.size*5
for i in
[email protected]
_state_set.size
y+=1
text=$data_states[@skill.minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=14
self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 设置角色
# actor : 要显示状态的角色
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# ● 设置敌人
# enemy : 要显示名字和状态的敌人
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
#--------------------------------------------------------------------------
# ● 校正帮助窗口位置
#--------------------------------------------------------------------------
def set_pos(x,y,width,oy,index,column_max)
#光标坐标
cursor_width = width / column_max - 32
xx = index % column_max * (cursor_width + 32)
yy = index / column_max * 32 - oy
self.x=xx+x
self.y=yy+y+30
if self.x+self.width>320
self.x=320-self.width
end
if self.y+self.height>480
self.y=480-self.height
end
end
end
复制代码
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# 物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64-64, 180, 416+64)#★★★★★★★★★★★★★★★★★★★★
@column_max = 4
refresh
self.index = 0
# 战斗中的情况下将窗口移至中央并将其半透明化
self.y = 110
self.height = 256
self.back_opacity = 255
self.z=3000
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加报务
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# 在战斗中以外添加武器、防具
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@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)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = index % 4 * 35
y = -2 + index / 4 * 35
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(-255, -255, -255, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 1, y+5, 24, 32, number.to_s, 2)
self.contents.draw_text(5, 250, 120, 32, $game_party.gold.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
#@help_window.set_text(self.item == nil ? "" : self.item.description)
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
@help_window.set_text(item)
#校正帮助窗口位置
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
end
end
复制代码
作者:
a5396982
时间:
2008-11-8 01:27
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
# 显示文章的信息窗口。
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化状态
#--------------------------------------------------------------------------
def initialize
super(80, 304, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false
@cursor_width = 0
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
if @input_number_window != nil
@input_number_window.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 处理信息结束
#--------------------------------------------------------------------------
def terminate_message
self.active = false
self.pause = false
self.index = -1
self.contents.clear
# 清除显示中标志
@contents_showing = false
# 呼叫信息调用
if $game_temp.message_proc != nil
$game_temp.message_proc.call
end
# 清除文章、选择项、输入数值的相关变量
$game_temp.message_text = nil
$game_temp.message_proc = nil
$game_temp.choice_start = 99
$game_temp.choice_max = 0
$game_temp.choice_cancel_type = 0
$game_temp.choice_proc = nil
$game_temp.num_input_start = 99
$game_temp.num_input_variable_id = 0
$game_temp.num_input_digits_max = 0
# 开放金钱窗口
if @gold_window != nil
@gold_window.dispose
@gold_window = nil
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
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 $game_temp.message_text != nil
text = $game_temp.message_text
# 限制文字处理
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
# 为了方便、将 "\\\\" 变换为 "\000"
text.gsub!(/\\\\/) { "\000" }
# "\\C" 变为 "\001" に、"\\G" 变为 "\002"
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
text.gsub!(/\\[Gg]/) { "\002" }
# GIF图片播放
text.gsub!(/\\[Gg][Ss]\[(.*?)\]/) { "\003[#{$1}]" }
# c 获取 1 个字 (如果不能取得文字就循环)
while ((c = text.slice!(/./m)) != nil)
# \\ 的情况下
if c == "\000"
# 还原为本来的文字
c = "\\"
end
# \C[n] 的情况下
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
# \G 的情况下
if c == "\002"
# 生成金钱窗口
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
if $game_temp.in_battle
@gold_window.y = 192
else
@gold_window.y = self.y >= 128 ? 32 : 384
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
# 下面的文字
next
end
# 另起一行文字的情况下
if c == "\n"
# 刷新选择项及光标的高
if y >= $game_temp.choice_start
@cursor_width = [@cursor_width, x].max
end
# y 加 1
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 为要描绘文字的加法运算
x += self.contents.text_size(c).width
end
end
# 选择项的情况
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active = true
self.index = 0
end
# 输入数值的情况
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
end
#--------------------------------------------------------------------------
# ● 设置窗口位置与不透明度
#--------------------------------------------------------------------------
def reset_window
if $game_temp.in_battle
self.y = 16
else
case $game_system.message_position
when 0 # 上
self.y = 16
when 1 # 中
self.y = 160
when 2 # 下
self.y = 304
end
end
if $game_system.message_frame == 0
self.opacity = 255
else
self.opacity = 0
end
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 渐变的情况下
if @fade_in
self.contents_opacity += 24
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end
# 输入数值的情况下
if @input_number_window != nil
@input_number_window.update
# 确定
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# 释放输入数值窗口
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end
# 显示信息中的情况下
if @contents_showing
# 如果不是在显示选择项中就显示暂停标志
if $game_temp.choice_max == 0
self.pause = true
end
# 取消
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# 确定
if Input.trigger?(Input::C)
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
return
end
# 在渐变以外的状态下有等待显示的信息与选择项的场合
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
refresh
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0
if @input_number_window != nil
@input_number_window.contents_opacity = 0
end
@fade_in = true
return
end
# 没有可以显示的信息、但是窗口为可见的情况下
if self.visible
@fade_out = true
self.opacity -= 48
if self.opacity == 0
self.visible = false
@fade_out = false
$game_temp.message_window_showing = false
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index >= 0
n = $game_temp.choice_start + @index
self.cursor_rect.set(8, n * 32, @cursor_width, 32)
else
self.cursor_rect.empty
end
end
end
复制代码
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# 处理物品画面的类。
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
make_sprite
# 生成帮助窗口、物品窗口
#@help_window = Window_Help.new
@help_window = Window_Help_Self.new#★★★★★★★★★★★★★★★★
@item_window = Window_Item.new
# 关联帮助窗口
@item_window.help_window = @help_window
# 生成目标窗口 (设置为不可见・不活动)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# 执行过度
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
def make_sprite
@spriteset = Spriteset_Map.new
end
def dispose_sprite
@spriteset.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@item_window.update
@target_window.update
# 物品窗口被激活的情况下: 调用 update_item
if @item_window.active
update_item
return
end
# 目标窗口被激活的情况下: 调用 update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口当前选中的物品数据
@item = @item_window.item
# 不使用物品的情况下
unless @item.is_a?(RPG::Item)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 不能使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @item.scope >= 3
# 激活目标窗口
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@item_window.draw_item(@item_window.index)
end
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (目标窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 由于物品用完而不能使用的场合
unless $game_party.item_can_use?(@item.id)
# 再次生成物品窗口的内容
@item_window.refresh
end
# 删除目标窗口
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 如果物品用完的情况下
if $game_party.item_number(@item.id) == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @target_window.index == -1
# 对同伴全体应用物品使用效果
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# 目标是单体的情况下
if @target_window.index >= 0
# 对目标角色应用物品的使用效果
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# 使用物品的情况下
if used
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@item_window.draw_item(@item_window.index)
end
# 再生成目标窗口的内容
@target_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用物品的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end[code]
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ 图片标题菜单1.0
# Scene_Title
#------------------------------------------------------------------------------
# 作者:chaochao
# http://zhuchao.go1.icpcn.com
#==============================================================================
class Scene_Title
def main
if $BTEST
battle_test
return
end
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
# 生成标题图形
@sprite = [Sprite.new]
for i in 0..6
@sprite[i] = Sprite.new
@sprite[i].opacity = 0
end
@sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
@sprite[0].opacity = 0
#开始游戏的图片
@sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start-1.png")
@sprite[2].bitmap = Bitmap.new("Graphics/Pictures/start-2.png")
#继续游戏的图片
@sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue-1.png")
@sprite[4].bitmap = Bitmap.new("Graphics/Pictures/continue-2.png")
#结束游戏的图片
@sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit-1.png")
@sprite[6].bitmap = Bitmap.new("Graphics/Pictures/exit-2.png")
#图片位置
for i in 1..6
x=170
y=(i+1)/2*35+240
@sprite[i].x =x
@sprite[i].y =y
end
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
if @continue_enabled
@command_index = 1
else
@command_index = 0
@sprite[3].tone = Tone.new(0, 0, 0, 255)
@sprite[4].tone = Tone.new(0, 0, 0, 255)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
#淡出背景圖形
if @sprite[0].opacity <= 255
@sprite[0].opacity += 15
end
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
# 釋放圖形
for i in 0..6
@sprite[i].bitmap.dispose
@sprite[i].dispose
end
end
def update
chaochaocommandchaochao
if Input.trigger?(Input::C)
case @command_index
when 0
command_new_game
when 1
command_continue
when 2
command_shutdown
end
end
end
def chaochaocommandchaochao
if Input.trigger?(Input::UP)
@command_index -= 1
if @command_index < 0
@command_index = 2
end
$game_system.se_play($data_system.cursor_se)
end
if Input.trigger?(Input::DOWN)
@command_index += 1
if @command_index > 2
@command_index = 0
end
$game_system.se_play($data_system.cursor_se)
end
case @command_index
when 0
if @sprite[1].opacity >= 0
@sprite[1].opacity -= 30
end
if @sprite[2].opacity <= 240
@sprite[2].opacity += 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
when 1
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity >= 0
@sprite[3].opacity -= 30
end
if @sprite[4].opacity <= 240
@sprite[4].opacity += 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
when 2
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity >= 0
@sprite[5].opacity -= 30
end
if @sprite[6].opacity <= 240
@sprite[6].opacity += 30
end
end
end
end
复制代码
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#
# 使用方法:
#
# ★、对角色显示伤害,如下3步:
#
# 1、设置伤害内容:$game_player.damage = 数值
# 注意:如果数值是负数,就变成补血的颜色了。
#
# 2、设置是否会心一击:$game_player.critical = true/false
# 如果不是会心一击,就不用这一步了
#
# 3、释放伤害:$game_player.damage_pop = true
#
#
# ★、对普通NPC和事件进行伤害,类似的3步:
#
# 1、设置伤害内容:$game_map.events[事件编号].damage = 数值
#
# 2、设置是否会心一击:$game_map.events[事件编号].critical = true/false
#
# 3、释放伤害:$game_map.events[事件编号].damage_pop = true
#
# 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
#
#------------------------------------------------------------------------------
# 预祝有人能早日做出华丽的ARPG来,别忘了到网站发布哦~
#------------------------------------------------------------------------------
class Sprite_Character < RPG::Sprite
alias carol3_66RPG_damage_pop_update update
def update
carol3_66RPG_damage_pop_update
if @character.damage_pop
damage(@character.damage, @character.critical)
@character.damage = nil
@character.critical = false
@character.damage_pop = false
end
#------------------------------
# 动画 ID 与当前的情况有差异的情况下
if @character.damage == nil and
@character.state_animation_id != @state_animation_id
@state_animation_id = @character.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
#collapse
# 明灭
if @character.blink
blink_on
else
blink_off
end
# 白色闪烁
if @character.white_flash
whiten
@character.white_flash = false
end
# 死亡
if @character.dead
collapse
@character.dead = false
end
#------------------------------
end
end
class Game_Character
attr_accessor :damage_pop
attr_accessor :damage
attr_accessor :critical
attr_accessor :white_flash # 白色屏幕闪烁标志
attr_accessor :blink # 闪烁标志
attr_accessor :dead # 死亡消失标志
attr_accessor :state_animation_id # 状态动画ID
alias carol3_66RPG_damage_pop_initialize initialize
def initialize
@damage_pop = false
@damage = nil
@critical = false
carol3_66RPG_damage_pop_initialize
@white_flash = false
@blink = false
@dead = false
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
[code]
[code]Graphics.frame_rate = 40
复制代码
#==============================================================================
# ◎ Window_MapVar
#------------------------------------------------------------------------------
# ◎ 地图右下显示变量窗口
#------------------------------------------------------------------------------
# 制作者:绿梨子红苹果
# 个人主页:vbgm.9126.com
# E-Mail:
[email protected]
# QQ:42378361
#==============================================================================
class Window_MapVar < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(116,410,640,100)
self.opacity=0
self.contents_opacity=255
self.z = 9000
self.contents = Bitmap.new(width, height)
@var_value_old = -1
@var_icon = Bitmap.new("Graphics/Icons/#{$data_weapons[$game_actors[1].weapon_id].icon_name}")
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 在这里加上判断语句,就可以完成变量值改变才刷新的效果,节约资源
if @var_value_old==$game_party.gold then
return
end
# 先清空内容啦
self.contents.clear
# 设定字色为白色。生成RGB颜色参数(红,绿,蓝),这个不用我来说吧...
self.contents.font.color = Color.new(255,255,255)
# 绘制金钱数字。记住要用“.to_s”将数字转换为字符!
# 注:这里24是留着画24*24图标的,104表示所有字符总宽
self.contents.font.size = 15
if $game_actors[1].sp >= 10
self.contents.draw_text(0, 0, 30, 30, $game_actors[1].sp.to_s, 2)
else
self.contents.draw_text(-4, 0, 30, 30, $game_actors[1].sp.to_s, 2)
end
self.contents.draw_text(0, 10, 375, 40,$game_party.item_number(1).to_s, 2)
self.contents.draw_text(0, 10, 407, 40,$game_party.item_number(2).to_s, 2)
self.contents.draw_text(0, 10, 439, 40,$game_party.item_number(3).to_s, 2)
self.contents.draw_text(0, 10, 471, 40,$game_party.item_number(4).to_s, 2)
self.contents.blt(476, 25, @var_icon, Rect.new(0, 0, 24, 24))
# 设定字色为金色
self.contents.font.color = Color.new(255,255,0)
end
end
复制代码
#==========================================================================
# ■ Window_ARPGStatus
#--------------------------------------------------------------------------
# 顯示腳色基本狀態畫面與及時變化的狀態窗口。
#==========================================================================
class Window_ARPGStatus < Window_Base
#------------------------------------------------------------------------
# ● 初始化對像
# actor : 角色
#------------------------------------------------------------------------
def initialize(actor)
super(70, 20, 105, 130)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#------------------------------------------------------------------------
# ● 刷新
#------------------------------------------------------------------------
def refresh
self.contents.clear
self.back_opacity = 0 #背景透明
self.opacity = 0 #外框透明
draw_arpg_hp_bar(1,0,$t1, width = 72)
draw_arpg_mp_bar(1,0,$t2, width = 72)
draw_arpg_exp_bar(1,0,$t3, width = 72)
end
#------------------------------------------------------------------------
# ● 更新資料
#------------------------------------------------------------------------
def update
super
refresh
end
end
复制代码
作者:
a5396982
时间:
2008-11-8 01:29
#--------------------------------------------------------------------------
# ● 定义ARPG
#--------------------------------------------------------------------------
class ARPG_zhadan
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@zhadan_ID = $game_variables[152]
@zhadan_x = $game_map.events[$game_variables[152]].x
@zhadan_y = $game_map.events[$game_variables[152]].y
update
end
#--------------------------------------------------------------------------
# ● 更新数值变化
#--------------------------------------------------------------------------
def refresh(type)
case type
when 0
if $game_switches[21] == true
if (@zhadan_x - $game_player.x).abs <=10
if (@zhadan_y - $game_player.y).abs <=10
if Input.trigger?(Input::UP)
$game_map.events[$game_variables[152]].move_up
end
if Input.trigger?(Input::DOWN)
$game_map.events[$game_variables[152]].move_down
end
if Input.trigger?(Input::RIGHT)
$game_map.events[$game_variables[152]].move_right
end
if Input.trigger?(Input::LEFT)
$game_map.events[$game_variables[152]].move_left
end
if Input.trigger?(Input::C)
x = $game_map.events[$game_variables[152]].x - $game_map.events[$game_variables[151]].x
y = $game_map.events[$game_variables[152]].y - $game_map.events[$game_variables[151]].y
$game_map.events[$game_variables[151]].jump(x,y)
$game_switches[22] = true
end
return
else
$game_map.events[$game_variables[152]].move_backward
end
else
$game_map.events[$game_variables[152]].move_backward
end
end
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
@zhadan_x = $game_map.events[$game_variables[152]].x
@zhadan_y = $game_map.events[$game_variables[152]].y
refresh(0)
end
end
#--------------------------------------------------------------------------
# ● 定义ARPG
#--------------------------------------------------------------------------
class ARPG_zhadan2
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@zhadan2_ID = $game_variables[151]
@zhadan2_x = $game_map.events[$game_variables[151]].x
@zhadan2_y = $game_map.events[$game_variables[151]].y
update
end
#--------------------------------------------------------------------------
# ● 更新数值变化
#--------------------------------------------------------------------------
def refresh(type)
case type
when 0
$n2 = 0
$game_map.events[$game_variables[151]].animation_id =7
while $n2 <= $game_variables[123]
$n2 += 1
if $game_variables[200+$n2] >= 0
if ($game_map.events[$n2].x - @zhadan2_x).abs <= 3
if ($game_map.events[$n2].y - @zhadan2_y).abs <= 3
$攻击1=$game_actors[1].str * 4
$攻击1 /= 2
$攻击3 = $攻击1
$攻击3 +=$game_actors[1].atk
$攻击3 -= rand(10)
$攻击3 += rand(10)
$game_map.events[$n2].damage=$攻击3
$game_map.events[$n2].damage_pop = true
$game_variables[200+$n2] -= $攻击3
Audio.se_play("Audio/SE/052-Cannon01",90,100)
end
end
end
end
if ($game_player.x - @zhadan2_x).abs <= 3
if ($game_player.y - @zhadan2_y).abs <= 3
$攻击1=$game_actors[1].str * 4
$攻击1 /= 2
$攻击3 = $攻击1
$攻击3 +=$game_actors[1].atk
$攻击3 -= rand(10)
$攻击3 += rand(10)
$game_player.damage= $攻击3
$game_player.damage_pop = true
$game_actors[1].hp -= $攻击3
Audio.se_play("Audio/SE/052-Cannon01",90,100)
$game_switches[24] = true
end
end
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
@zhadan2_x = $game_map.events[$game_variables[151]].x
@zhadan2_y = $game_map.events[$game_variables[151]].y
refresh(0)
end
end
复制代码
#--------------------------------------------------------------------------
# ● 定义ARPG怪物
#--------------------------------------------------------------------------
class ARPG_gw
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
update
end
#--------------------------------------------------------------------------
# ● 更新数值变化
#--------------------------------------------------------------------------
def refresh(type)
case type
when 0
if $n3 >= $game_variables[123]
$n3 = 0
else
$n3 +=1
if $game_variables[200+$n3] >= 0
if $game_map.events[$n3].y == $game_player.y
if ($game_map.events[$n3].x - $game_player.x).abs <= 5
xianggongji = rand (100)
xianggongji - 20
if xianggongji >= 20
if $game_switches[47] == false
$game_map.events[$game_variables[139]].moveto($game_map.events[$n3].x,$game_map.events[$n3].y)
$game_variables[141] = $game_map.events[$n3].direction
$game_switches[47] = true
end
if $game_switches[48] == false
$game_map.events[$game_variables[140]].moveto($game_map.events[$n3].x,$game_map.events[$n3].y)
$game_variables[142] = $game_map.events[$n3].direction
$game_switches[48] = true
end
$time2 +=1
if $time2 >= 2
$game_switches[47] = false
$game_switches[48] = false
$time2 =0
end
end
end
end
if $game_map.events[$n3].x == $game_player.x
if ($game_map.events[$n3].y - $game_player.y).abs <= 5
xianggongji = rand (100)
xianggongji - 20
if xianggongji >= 30
if $game_switches[47] == false
$game_map.events[$game_variables[139]].moveto($game_map.events[$n3].x,$game_map.events[$n3].y)
$game_variables[141] = $game_map.events[$n3].direction
$game_switches[47] = true
end
if $game_switches[48] == false
$game_map.events[$game_variables[140]].moveto($game_map.events[$n3].x,$game_map.events[$n3].y)
$game_variables[142] = $game_map.events[$n3].direction
$game_switches[48] = true
end
$time2 +=1
if $time2 >= 5
$game_switches[47] = false
$game_switches[48] = false
$time2 =0
end
end
end
end
end
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
refresh(0)
end
end
复制代码
作者:
a5396982
时间:
2008-11-8 01:30
==============================================================================
彩虹神剑(伤害分段显示)显示总伤害版 v1.0d
==============================================================================
彩虹神剑 -柳柳
6-20-2006 v1.0 -叶子
在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的
v1.0a -叶子
修正了显示伤害和实际伤害有差别的问题
修正了miss的情况下显示miss混乱的问题
修正了对己方技能重复显示伤害的问题
未修正播放目标动画第一帧时目标有时无端跳动的BUG
v1.0b -叶子
修改了总伤害数字的位置和z坐标
未修正播放目标动画第一帧时目标有时无端跳动的BUG
v1.0c -柳柳
? ? ?
v1.0d -柳柳
1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法
7-24-2006 v1.0e -叶子
修正全屏幕闪烁弹出伤害错误的问题
修正连续伤害不会弹出伤害的问题
仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG
我鼓起很大勇气才敢动偶像们的脚本的,不知道会不会出问题啊...... -cftx
修正了总伤害显示
增加了伤害美化和HIT数显示
修正了两次音效
==============================================================================
=end
# 核心的说明:
# damage_pop 不再附带damage()的功能,这个放到animation里面去了
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = false
# 连续伤害的动画ID
SLIP_DAMAGE_ANIMATION_ID = 10
class Sprite < ::Sprite
#==========================================
# 修改说明:
# @flash_shake用来制作挨打时候跳跃
# @_damage 用来记录每次打击之后弹出数字
# @_total_damage 记录总伤害
# @_total_damage_duration 总伤害持续帧
#==========================================
#alias 66RPG_rainbow_initialize : initialize
def initialize(viewport = nil)
#66RPG_rainbow_initialize(viewport)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
# 挨打时候跳跃
@flash_shake = 0
# 伤害记录数组
@_damage = []
# 总伤害数字
@_total_damage = 0
# 总伤害持续帧
@_total_damage_duration = 0
#记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
@p_dam=0
@hits=0
end
#美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
def damage(value, critical)
# 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
#dispose_damage
#清除hit数
dispose_hit
# 如果伤害值是数值
if value.is_a?(Numeric)
# 绝对值转为字符串
damage_string = value.abs.to_s
else
# 转为字符串
damage_string = value.to_s
end
# 初始化位图
bitmap = Bitmap.new(162, 64)
bitmap.font.name = ["黑体","华文行楷", "宋体"]
bitmap.font.size = 32
# 伤害值是数值的情况下
if value.is_a?(Numeric)
# 分割伤害值字符串
damage_array = damage_string.scan(/./)
damage_x = 81 - damage_string.size * 9
# 伤害值为负的情况下
if value < 0
# 调用回复数字表
rect_y = 32
else
# 调用伤害数字表
rect_y = 0
end
# 循环伤害值字符串
for char in damage_array
number = char.to_i
# 显示伤害数字
bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
Rect.new(number * 18, rect_y, 18, 32))
# 后移一位
damage_x += 18
end
# 伤害值不是数值的情况
else
if $game_variables[6] <= $game_variables[5]
# 系统默认描画字符串
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
# Miss 的情况下
else
# 显示未击中图画
bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
end
end
# 会心一击标志打开的情况
if critical
# 显示会心一击图画
bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
end
# 伤害值定位
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 81
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
@_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
make_total_damage(value)
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
# hit数的美化描绘
def hit
# 如果伤害值是数值
# 转为字符串
value=@hits
hits_string = value.to_s
# 初始化位图
bitmap = Bitmap.new(320, 64)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
# 分割伤害值字符串
hits_array = hits_string.scan(/./)
hits_x = 81 - hits_string.size * 18.1
rect_y = 0
# 循环伤害值字符串
for char in hits_array
number = char.to_i
# 显示伤害数字
bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
Rect.new(number * 36.2, rect_y, 36.2, 50))
# 后移一位
hits_x += 36.2
end
bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
Rect.new(0, -21, 90, 50))
# 伤害值定位
@_hits_sprite = ::Sprite.new(self.viewport)
@_hits_sprite.bitmap = bitmap
@_hits_sprite.ox = 81
@_hits_sprite.oy = 20
@_hits_sprite.x = 300
@_hits_sprite.y = 20
@_hits_sprite.z = 3000
@_hits_duration = 40
end
#--------------------------------------------------------------------------
# ● 总伤害处理
#--------------------------------------------------------------------------
def make_total_damage(value)
if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
@_total_damage += value
# 绝对值转为字符串
damage_string = @_total_damage.abs.to_s
else
return
end
# 初始化位图
bitmap = Bitmap.new(300, 150)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
# 伤害值是数值的情况下
if value.is_a?(Numeric)
# 分割伤害值字符串
damage_array = damage_string.scan(/./)
damage_x = 40 - damage_string.size * 9
# 伤害值为负的情况下
if value < 0
name="Number3"
else
# 调用伤害数字表
name="Number2"
end
# 循环伤害值字符串
for char in damage_array
number = char.to_i
# 显示伤害数字
bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
Rect.new(number * 36.2, 0, 36.2, 50))
# 后移一位
damage_x += 36.2
end
end
# if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
# @_total_damage += value
# else
# return
# end
# bitmap = Bitmap.new(300, 150)
# bitmap.font.name = "Arial Black"
# bitmap.font.size = 40
# bitmap.font.color.set(0, 0, 0)
# bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
# if @_total_damage < 0
# bitmap.font.color.set(80, 255, 00)
# else
# bitmap.font.color.set(255, 140, 0)
# end
# bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
# bitmap.font.color.set(55, 55,255)
if @_total_damage_sprite.nil?
@_total_damage_sprite = ::Sprite.new(self.viewport)
@_total_damage_sprite.ox = 80
@_total_damage_sprite.oy = 20
@_total_damage_sprite.z = 3000
end
@_total_damage_sprite.bitmap = bitmap
@_total_damage_sprite.zoom_x = 0.8
@_total_damage_sprite.zoom_y = 0.8
@_total_damage_sprite.x = self.x
@_total_damage_sprite.y = self.y - self.oy / 2 - 64
@_total_damage_sprite.z = 3001
@_total_damage_duration = 80
#hit数描绘
@hits+=1
if @_total_damage > 0
hit
end
end
def animation(animation, hit, battler_damage="", battler_critical=false)
dispose_animation
#=======================================
# 修改:记录伤害和critical
#=======================================
@battler_damage = battler_damage
@battler_critical = battler_critical
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
#=======================================
# 修改:计算总闪光权限值
#=======================================
for timing in @_animation.timings
quanzhong = animation_process_timing(timing, @_animation_hit,true)
@all_quanzhong += quanzhong
# 记录最后一次闪光
@_last_frame = timing.frame if quanzhong != 0
end
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
#=======================================
# 修改:行动方动画不显示伤害
#=======================================
if $scene.is_a?(Scene_Battle)
if $scene.animation1_id == @battler.animation_id
@battler_damage = ""
end
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
#=======================================
# 修改:更换清除伤害的算法,以防万一
# 本内容在脚本中没有使用过
#=======================================
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
@_total_damage = 0
@_last_frame = -1
if @_total_damage_sprite != nil
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
# 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#=======================================
def dispose_hit
if @_hits_sprite != nil
@_hits_sprite.bitmap.dispose
@_hits_sprite.dispose
@_hits_sprite = nil
end
end
def dispose_animation
#=======================================
# 修改:清除记录的伤害,清除权重记录
#=======================================
@battler_damage = nil
@battler_critical = nil
@all_quanzhong = 1
@_total_damage = 0
@_last_frame = -1
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#=======================================
# 修改:更新算法,更新弹出
#=======================================
if @_damage_duration > 0
@_damage_duration -= 1
for damage in @_damage
damage[0].x = self.x + self.viewport.rect.x
damage[0].y -= 3
damage[0].opacity = damage[1]*20
damage[1] -= 1
if damage[1]==0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
next
end
end
end
#=======================================
# 添加:弹出总伤害
#=======================================
if @_total_damage_duration > 0
@_total_damage_duration -= 1
@_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
if @_total_damage_sprite.zoom_x > 1.0
@_total_damage_sprite.zoom_x -= 0.05
end
if @_total_damage_sprite.zoom_y > 1.0
@_total_damage_sprite.zoom_y -= 0.05
end
@_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
if @_total_damage_duration <= 0
dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
@_total_damage = 0
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
if timing.se.name != ""
se=timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
t *= @battler_damage
t /= @all_quanzhong
t = t.to_i
#在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index != @_last_frame
@p_dam+= t
end
#p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
#闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
t=@battler_damage-@p_dam
end
#p t,"当前伤害",@battler_damage,"总伤害"
# 最后一次闪光的话,伤害修正
if frame_index == @_last_frame
@_total_damage = @battler_damage - t
@p_dam=0 #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
end
#p t,@battler_damage,@all_quanzhong
damage(t,@battler_critical)
#连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
@hits=0
end
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
#=======================================
# 修改:敌人跳跃的功能 + 添加返回数值
#=======================================
def animation_process_timing(timing, hit,dontflash=false)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
case timing.flash_scope
when 1
unless dontflash
self.flash(timing.flash_color, timing.flash_duration * 2)
if @_total_damage >0
@flash_shake_switch = true
@flash_shake = 10
end
end
return timing.flash_color.alpha * timing.flash_duration
when 2
unless dontflash
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
end
end
return timing.flash_color.alpha * timing.flash_duration
when 3
unless dontflash
self.flash(nil, timing.flash_duration * 2)
end
return timing.flash_color.alpha * timing.flash_duration
end
end
return 0
end
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
# 添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
@flash_shake_switch = true
end
#--------------------------------------------------------------------------
# ● 刷新画面
# 增添跳跃功能
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 文件名和色相与当前情况有差异的情况下
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# 获取、设置位图
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
# 动画 ID 与当前的情况有差异的情况下
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 应该被显示的角色的情况下
if @battler.is_a?(Game_Actor) and @battler_visible
# 不是主状态的时候稍稍降低点透明度
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
# 明灭
if @battler.blink
blink_on
else
blink_off
end
# 不可见的情况下
unless @battler_visible
# 出现
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
# 可见的情况下
if @battler_visible
# 逃跑
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白色闪烁
if @battler.white_flash
whiten
@battler.white_flash = false
end
# 动画
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
# 设置活动块的坐标
if @flash_shake_switch == true
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
@flash_shake_switch = false
end
if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
case @flash_shake
when 9..10
self.x = @battler.screen_x
self.y -=4
self.z = @battler.screen_z
when 6..8
self.x = @battler.screen_x
self.y -=2
self.z = @battler.screen_z
when 3..5
self.x = @battler.screen_x
self.y +=2
self.z = @battler.screen_z
when 2
self.x = @battler.screen_x
self.y += 4
self.z = @battler.screen_z
when 1
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
@flash_shake -= 1
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :animation1_id # 行动方动画ID
end
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
#class Game_Battler
# #--------------------------------------------------------------------------
# # ● 应用连续伤害效果
# #--------------------------------------------------------------------------
# alias rainbow_sword_slip_damage_effect slip_damage_effect
# def slip_damage_effect
# self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
# self.animation_hit = true
# rainbow_sword_slip_damage_effect
# end
#end
复制代码
#--------------------------------------------------------------------------
# ● 定义ARPG
#--------------------------------------------------------------------------
class ARPG_map
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@maxsp = $game_actors[1].maxsp - 1
@maxsp2 = $game_actors[1].maxsp - 1
update
end
#--------------------------------------------------------------------------
# ● 更新数值变化
#--------------------------------------------------------------------------
def refresh(type)
case type
when 0
if $game_actors[1].sp <= @maxsp2
if $game_player.moving?
$cdjc = 0
else
$cd -= rand(2)
$cdjc +=1
if $cdjc >= 80
$cd -= rand(2)
$game_actors[1].hp += rand(1)
end
if $cdjc >= 160
$cd -= rand(3)
$game_actors[1].hp += rand(2)
end
if $cdjc >= 320
$cd -= rand(3)
end
end
else
$cdjc = 0
end
复制代码
#--------------------------------------------------------------------------
# ● 华丽的跟随
#--------------------------------------------------------------------------
class ARPG_gensui
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
update
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
if $game_player.direction == 8
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 18
$game_screen.pictures[1].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y += 12
$game_screen.pictures[2].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y += 42
$game_screen.pictures[3].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y += 72
$game_screen.pictures[4].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y += 102
$game_screen.pictures[5].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y += 132
$game_screen.pictures[6].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
end
if $game_player.direction == 2
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 78
$game_screen.pictures[1].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 108
$game_screen.pictures[2].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 138
$game_screen.pictures[3].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 168
$game_screen.pictures[4].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 198
$game_screen.pictures[5].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 34
$主角画面Y -= 228
$game_screen.pictures[6].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
end
if $game_player.direction == 4
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 4
$主角画面Y -= 34
$game_screen.pictures[1].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X += 26
$主角画面Y -= 34
$game_screen.pictures[2].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X += 56
$主角画面Y -= 34
$game_screen.pictures[3].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X += 86
$主角画面Y -= 34
$game_screen.pictures[4].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X += 116
$主角画面Y -= 34
$game_screen.pictures[5].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X += 146
$主角画面Y -= 34
$game_screen.pictures[6].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
end
if $game_player.direction == 6
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 64
$主角画面Y -= 34
$game_screen.pictures[1].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 94
$主角画面Y -= 34
$game_screen.pictures[2].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 124
$主角画面Y -= 34
$game_screen.pictures[3].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 154
$主角画面Y -= 34
$game_screen.pictures[4].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 184
$主角画面Y -= 34
$game_screen.pictures[5].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
$主角画面X = $game_player.screen_x
$主角画面Y = $game_player.screen_y
$主角画面X -= 214
$主角画面Y -= 34
$game_screen.pictures[6].move(40, 0, $主角画面X, $主角画面Y, 100, 100, 255, 0)
end
end
end
复制代码
# ————————————————————————————————————
# 本脚本来自www.66rpg.com,转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias old_update update
def update
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if $城市中 ==true
if Kboard.keyb($R_Key_S) == 1
@move_speed = 5
else
@move_speed = 4
end
end
if $cd <= 155
if Kboard.keyb($R_Key_S) == 1
$cd += 6
$game_actors[1].hp -= rand(5)
if $cd >=310
$cd =310
end
@move_speed = 5
else
@move_speed = 4
end
end
end
old_update
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
#==============================================================================
# ■ ARPG_Actor
#------------------------------------------------------------------------------
# 处理ARPG角色的类。
#==============================================================================
class ARPG_Actor
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@parameter = []
make_sprite
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def visible=(val)
@parameter.each{|pict|pict.visible = val}
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
@parameter.each{|pict|pict.dispose}
end
#--------------------------------------------------------------------------
# ● 生成精灵的实例
#--------------------------------------------------------------------------
def make_sprite
@parameter[0] = Sprite.new
@parameter[0].bitmap = Bitmap.new(310,50)
w = $cd * 310 / $cdmax
@parameter[0].bitmap.blt(0,0,RPG::Cache.picture("充弹条"),Rect.new(0,0,310-w,50))
@parameter[0].x = 0;@parameter[0].y = 430
@parameter[1] = Sprite.new
@parameter[1].bitmap = Bitmap.new(310,50)
@parameter[1].bitmap.blt(0,0,RPG::Cache.picture("充弹底框"),Rect.new(0,0,310,50))
@parameter[1].x = 0;@parameter[1].y = 430
@parameter.each{|e|e.z += 1}
@parameter.each{|e|e.z += 2}
end
#--------------------------------------------------------------------------
# ● 更新数值变化
#--------------------------------------------------------------------------
def refresh(type)
case type
when 0
@parameter[0].bitmap.clear
w = $cd * 310 / $cdmax
@parameter[0].bitmap.blt(0,0,RPG::Cache.picture("充弹条"),Rect.new(0,0,310-w,50))
@parameter[1].bitmap.clear
@parameter[1].bitmap.blt(0,0,RPG::Cache.picture("充弹底框"),Rect.new(0,0,310,50))
return
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
refresh(0)
end
end
复制代码
作者:
塑望
时间:
2008-11-8 01:31
为什么我一起用上主站的射击ARPG和图片标题就出错?
我感觉我知道为什么出错了..
我要是这样的话也出错...
这里有几个脚本看来貌似是冲突的
-----------------------------
天圣接的单???
To 天圣 {/hx}别累死了
作者:
a5396982
时间:
2008-11-8 01:33
哪几个?
作者:
金色天空
时间:
2008-11-8 02:12
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2008-11-8 18:22
{/hx}我没接单,因为他不听我话改标题上工程。我最讨厌的就是把这么多乱七八糟的脚本自己拿去整合了,拜托别人帮忙的话就要有点诚意嘛。
LS严重水贴。杀。
作者:
redant
时间:
2008-11-8 19:06
这么多脚本 看见眼晕{/fd}
被吓到了=。=
不上工程的话 估计还是有人会被吓跑的……
作者:
a5396982
时间:
2008-11-8 21:29
怎么上传工程?
作者:
redant
时间:
2008-11-10 05:51
论坛附件 或者 网盘
最后一次 帮顶上
否则按过期 处理
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1