Project1
标题:
关于物品得失
[打印本页]
作者:
卓越大白痴
时间:
2012-11-27 14:56
标题:
关于物品得失
本帖最后由 卓越大白痴 于 2012-11-27 15:08 编辑
问个问题 如果设置一个NPC一对话获得200-210号物品其中的一个 命令怎么打
和NPC说话失去某10-20号物品怎么写
谢谢 谢谢
作者:
zxcgood2009
时间:
2012-11-27 15:11
先用变量随机数值,0~9,分歧条件,变量等于0时得到物品xxx,变量等于1时得到物品xxx,等于2时得到xxxx,一直到9,
作者:
卓越大白痴
时间:
2012-11-27 15:16
额
·····这个我知道 但是物品提示麻烦 如果我小一次失去很多物品 药刷老半天的屏
如果用类似$game_party.gain_item(rand(44),1)这样的 命令就不会 有物品得失提示 额 请教方法谢谢了
作者:
卓越大白痴
时间:
2012-11-27 15:24
本帖最后由 hcm 于 2012-12-11 19:54 编辑
#请教这个怎么用啊
class Devhowadd
#随机添加一种的固定数量
#sort1为物品
# 2为武器
# 3为防具
#math 为数量
#添加的范围是数据库里编号1到编号最大值
def self.addone(sort,math)
case sort
when 1
sort1 = $data_items.size
item = rand(sort1)+1
$game_party.gain_item(item , math)
$item = item
$im = math
$sort = 1
Addwindow.new
when 2
sort1 = $data_weapons.size
weapon = rand(sort1)+1
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
when 3
sort1 = $data_armors.size
armor = rand(sort1)+1
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
when 4
msort = rand(3)+1
case msort
when 1
sort1 = $data_items.size
item = rand(sort1)+1
$game_party.gain_item(item , math)
$item = item
$im = math
$sort = 1
Addwindow.new
when 2
sort1 = $data_weapons.size
weapon = rand(sort1)+1
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
when 3
sort1 = $data_armors.size
armor = rand(sort1)+1
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
end
end
end
#随机增加一种的sn到st范围的物品的mn到mt范围的数量
#sort同上,多了一个sort=4,是指随机增加物品,武器或防具
#sn表示添加的最小范围的数据库编号
#st表示添加的最大范围的数据库编号如sn=3到st=9
#mn表示添加的最小数量
#mt表示添加的最大数量
def self.addtwo(sort,sn,st,mn,mt)
case sort
when 1
item = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_item(item , math)
$item = item
$im = math
$sort = 1
Addwindow.new
when 2
weapon = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
when 3
armor = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
when 4
msort = rand(3)+1
case msort
when 1
item = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_item(item , math)
$item = item
$im =math
$sort = 1
Addwindow.new
when 2
weapon = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
when 3
armor = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
end
end
end
#随机增加mn到mt范围的金钱
def self.addmoney(mn,mt)
money = rand(mt-mn)+mn
$game_party.gain_gold(money)
$mo = money
$sort = 4
Addwindow.new
end
#dev=1表示添加ln次随机种类的sn到st范围的物品的mn到mt范围的数量
#sn,st,mn,mt同上
#dev=2表示添加随机(ln到lt)次随机种类的sn到st范围的物品的mn到mt范围的数量
def self.addthree(dev,ln,lt,sn,st,mn,mt)
case dev
when 1
while ln != 0
sort = rand(3)+1
case sort
when 1
item = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_item(item , math)
$item = item
$im = math
$sort = 1
Addwindow.new
ln -= 1
when 2
weapon = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
ln -= 1
when 3
armor = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
ln -= 1
end
end
when 2
rand(lt-ln)+ln
while ln != 0
sort = rand(3)+1
case sort
when 1
item = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_item(item , math)
$item = item
$im = math
$sort = 1
Addwindow.new
ln -= 1
when 2
weapon = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_weapon(weapon , math)
$weapon = weapon
$wm = math
$sort = 2
Addwindow.new
ln -= 1
when 3
armor = rand(st-sn)+sn
math = rand(mt-mn)+mn
$game_party.gain_armor(armor , math)
$armor = armor
$am = math
$sort = 3
Addwindow.new
ln -= 1
end
end
end
end
end
#-----------------------------------------------#BY 123devil
#----------------呼出窗口-----------------------#
class Addwindow < Window_Base
def initialize
super(0,0,640,120)
#可换窗口外观修改下面这行
self.windowskin = RPG::Cache.windowskin("skin")
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "黑体"
self.contents.font.size = 50
self.opacity = 250
refresh
for i in 0..10
Graphics.freeze
self.contents_opacity -= 35
self.back_opacity -= 35
self.opacity -= 35
Graphics.transition
Graphics.update
end
end
def refresh
self.contents.clear
case $sort
when 1
iname = $data_items[$item].name
self.contents.font.color = Color.new(0,0,0)
Audio.se_play("Audio/SE/"+"006-System06",80,100)
self.contents.draw_text(50,0,90,90,"获得:")
self.contents.draw_text(150,0,90,90,"#{iname}")
self.contents.draw_text(250,0,90,90," ×")
self.contents.draw_text(350,0,90,90,"#{$im}")
for i in 0..10
Graphics.freeze
self.opacity += 0
Graphics.transition
Graphics.update
end
when 2
wname = $data_weapons[$weapon].name
self.contents.font.color = Color.new(0,0,0)
Audio.se_play("Audio/SE/"+"006-System06",80,100)
self.contents.draw_text(50,0,90,90,"获得:")
self.contents.draw_text(150,0,90,90,"#{wname}")
self.contents.draw_text(250,0,90,90," ×")
self.contents.draw_text(350,0,90,90,"#{$wm}")
for i in 0..10
Graphics.freeze
self.opacity += 0
Graphics.transition
Graphics.update
end
when 3
aname = $data_armors[$armor].name
self.contents.font.color = Color.new(0,0,0)
Audio.se_play("Audio/SE/"+"006-System06",80,100)
self.contents.draw_text(50,0,90,90,"获得:")
self.contents.draw_text(150,0,90,90,"#{aname}")
self.contents.draw_text(250,0,90,90," ×")
self.contents.draw_text(350,0,90,90,"#{$am}")
for i in 0..10
Graphics.freeze
self.opacity += 0
Graphics.transition
Graphics.update
end
when 4
self.contents.font.color = Color.new(0,0,0)
Audio.se_play("Audio/SE/"+"006-System06",80,100)
self.contents.draw_text(50,0,90,90,"获得金")
self.contents.draw_text(250,0,90,90," ×#{$mo}")
for i in 0..10
Graphics.freeze
self.opacity += 0
Graphics.transition
Graphics.update
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1