Project1
标题:
[RM脚本] 战斗后获得物品窗口的改进
[打印本页]
作者:
kksq
时间:
2006-10-1 11:07
标题:
[RM脚本] 战斗后获得物品窗口的改进
一个比较简单的效果,大家可以看一下,也许有用。
获得2个以上相同物品的时候就直接
2 x 恢复剂...
就不会像默认的
恢复剂
恢复剂
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
set_treasures(treasures)
super(160, 0, 320, @treasures[0].size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for i in
[email protected]
draw_item(@treasures[0][i], 4, y, @treasures[1][i])
y += 32
end
end
def set_treasures(treasures)
items = []
weapons = []
armors = []
stuff = []
qua = []
for i in treasures
items.push(i.id) if i.is_a?(RPG::Item)
weapons.push(i.id) if i.is_a?(RPG::Weapon)
armors.push(i.id) if i.is_a?(RPG::Armor)
end
for id in items
if stuff.include?($data_items[id])
qua[stuff.index($data_items[id])] += 1
else
stuff.push($data_items[id])
qua.push(1)
end
end
for id in weapons
if stuff.include?($data_weapons[id])
qua[stuff.index($data_weapons[id])] += 1
else
stuff.push($data_weapons[id])
qua.push(1)
end
end
for id in armors
if stuff.include?($data_armors[id])
qua[stuff.index($data_armors[id])] += 1
else
stuff.push($data_armors[id])
qua.push(1)
end
end
@treasures = []
@treasures.push(stuff)
@treasures.push(qua)
end
def draw_item(item, x, y, qua = 1)
if item == nil
return
end
w1 = self.contents.text_size("0").width
w2 = self.contents.text_size("x ").width
x += w1 + w2 + 4
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(w1 + 8, y, w2, 32, "x")
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
复制代码
作者:
kksq
时间:
2006-10-1 11:07
标题:
[RM脚本] 战斗后获得物品窗口的改进
一个比较简单的效果,大家可以看一下,也许有用。
获得2个以上相同物品的时候就直接
2 x 恢复剂...
就不会像默认的
恢复剂
恢复剂
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
set_treasures(treasures)
super(160, 0, 320, @treasures[0].size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for i in
[email protected]
draw_item(@treasures[0][i], 4, y, @treasures[1][i])
y += 32
end
end
def set_treasures(treasures)
items = []
weapons = []
armors = []
stuff = []
qua = []
for i in treasures
items.push(i.id) if i.is_a?(RPG::Item)
weapons.push(i.id) if i.is_a?(RPG::Weapon)
armors.push(i.id) if i.is_a?(RPG::Armor)
end
for id in items
if stuff.include?($data_items[id])
qua[stuff.index($data_items[id])] += 1
else
stuff.push($data_items[id])
qua.push(1)
end
end
for id in weapons
if stuff.include?($data_weapons[id])
qua[stuff.index($data_weapons[id])] += 1
else
stuff.push($data_weapons[id])
qua.push(1)
end
end
for id in armors
if stuff.include?($data_armors[id])
qua[stuff.index($data_armors[id])] += 1
else
stuff.push($data_armors[id])
qua.push(1)
end
end
@treasures = []
@treasures.push(stuff)
@treasures.push(qua)
end
def draw_item(item, x, y, qua = 1)
if item == nil
return
end
w1 = self.contents.text_size("0").width
w2 = self.contents.text_size("x ").width
x += w1 + w2 + 4
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(w1 + 8, y, w2, 32, "x")
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
复制代码
作者:
koalli
时间:
2006-10-2 02:13
这个是干嘛的?没看懂。。。
作者:
神思
时间:
2006-10-2 02:16
获得2个以上相同物品的时候就直接
2 x 恢复剂...
就不会像默认的
恢复剂
恢复剂
作者:
亿万星辰
时间:
2006-10-2 03:51
这个……作者原创?还是转载??
作者:
小传子
时间:
2006-10-2 03:55
发到地球 应该是转载吧``如果是原创 恩 厉害
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1