赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2690 |
最后登录 | 2015-4-29 |
在线时间 | 58 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 58 小时
- 注册时间
- 2007-8-10
- 帖子
- 284
|
4楼
楼主 |
发表于 2012-11-27 15:24:22
|
只看该作者
本帖最后由 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
复制代码 |
|