赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 8666 |
最后登录 | 2020-2-22 |
在线时间 | 186 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 90
- 在线时间
- 186 小时
- 注册时间
- 2010-6-24
- 帖子
- 111
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
请问如何将@芯☆淡茹水大大写的转转乐脚本,物品的图标变为支持显示48X48呢? 单纯的把24X24改成48X48后图标会向下移动 没有居中中间的转盘呢? 谢谢大大。
#==============================================================================
# ■ 转转乐(转盘式抽奖游戏) ■ -> by 芯☆淡茹水
#==============================================================================
#
# ■ 使用方法:复制该脚本,插入到 main 前,并复制范例工程 Graphics\Pictures
# 文件夹下所有图片到目标游戏工程。
#
# 呼出抽奖场景方法:事件 -> 脚本:$scene = Scene_Prize.new
#
#==============================================================================
#
# ■ 说明: 1,该转盘抽奖为随机,制作者不能控制(作弊)。制作者需要把可以抽奖
# 的物品ID对应的填入下面的设置项即可。
#
# 2,每一盘抽奖的物品不会重复,得到的物品数量为 1 。
#
# 3,该范例仅支持 24 X 24 的物品图标 。
#
# 4,该范例的图片来源于网络。
#==============================================================================
module X☆R
#==============================================================================
# ■ 设置:↓
#-------------------------------------------------------------------------
# 消耗方式(0 固定金钱; 1 变量指定金钱; 2 消耗物品<数量为1>)。
Consumption_mode = 2
#-------------------------------------------------------------------------
# 消耗方式为 0 时,抽奖一次需要的金钱。
Need_gold = 500
#-------------------------------------------------------------------------
# 消耗方式为 1 时,抽奖一次需要的指定金钱的变量ID。
Need_gold_var = 10
#-------------------------------------------------------------------------
# 消耗方式为 2 时,抽奖一次需要的物品ID。
Need_item_id = 33
#-------------------------------------------------------------------------
# 场景BGM(不需要就写空白引号 "" )。
Bgm_name = ""
#-------------------------------------------------------------------------
# 转针转动时播放的SE。
Change_se = "032-Switch01"
#-------------------------------------------------------------------------
# 转针停止时播放的SE。
Stop_se = "112-Heal08"
#-------------------------------------------------------------------------
# 可以出现在转盘里的普通物品ID。
Prize_items1 = [1,2,4,5,9,11,12,13,14,15,16,33]
#-------------------------------------------------------------------------
# 可以出现在转盘里的珍贵物品ID。
Prize_items2 = [3,6,10,17,18,19,20,21,22]
#-------------------------------------------------------------------------
# 可以出现在转盘里的普通武器ID。
Prize_weapons1 = [1,2,3,5,6,7,9,10,11,13,14,15,17,18,19]
#-------------------------------------------------------------------------
# 可以出现在转盘里的珍贵武器ID。
Prize_weapons2 = [4,8,12,16,20]
#-------------------------------------------------------------------------
# 可以出现在转盘里的普通防具ID。
Prize_armors1 = [1,2,3,5,6,7,9,10,11,13,14,15,17,18,19]
#-------------------------------------------------------------------------
# 可以出现在转盘里的珍贵防具ID。
Prize_armors2 = [4,8,12,16,20,25,26,27,28,29,30]
#-------------------------------------------------------------------------
# 物品在转盘里出现的几率(百分比)。
Item_rate = 60
#-------------------------------------------------------------------------
# 珍贵物品出现的概率为总物品数的(百分比)。
Precious_item_rate = 20
#-------------------------------------------------------------------------
# 武器在转盘里出现的几率(百分比)。
Weapon_rate = 20
#-------------------------------------------------------------------------
# 珍贵武器出现的概率为总武器数的(百分比)。
Precious_weapon_rate = 20
#-------------------------------------------------------------------------
# 防具在转盘里出现的几率(百分比)。
Armor_rate = 20
#-------------------------------------------------------------------------
# 珍贵防具出现的概率为总防具数的(百分比)。
Precious_armor_rate = 20
#==========================================================================
# ■ 脚本正文 ↓
#==========================================================================
def self.can_start?
case Consumption_mode
when 0 :return ($game_party.gold >= Need_gold)
when 1 :return ($game_party.gold >= $game_variables[Need_gold_var])
when 2 :return ($game_party.item_number(Need_item_id) >= 1)
end
end
#-------------------------------------------------------------------------
def self.consumption
case Consumption_mode
when 0 :$game_party.lose_gold(Need_gold)
when 1 :$game_party.lose_gold($game_variables[Need_gold_var])
when 2 :$game_party.lose_item(Need_item_id, 1)
end
end
#-------------------------------------------------------------------------
def self.cant_start_wodr
return Consumption_mode == 2 ? "抽奖所需物品不足!" : "抽奖所需费用不足!"
end
end
#==============================================================================
class Game_System
attr_accessor :prize_items
end
#==============================================================================
class Change < Sprite
#-------------------------------------------------------------------------
def initialize
super()
self.bitmap = Bitmap.new("Graphics/Pictures/转盘背景")
self.x = 70; self.y = 8; self.z = 500
@tit = Sprite.new
@tit.bitmap = Bitmap.new("Graphics/Pictures/转盘标题")
@tit.x = self.x + 50; @tit.y = self.y + 24; @tit.z = 600
@item_sprite = []
for i in 0..7
@item_sprite = Sprite.new
@item_sprite.bitmap = Bitmap.new(48,48)
@item_sprite.x, @item_sprite.y = get_item_place(i)
@item_sprite.x += self.x; @item_sprite.y += self.y
@item_sprite.z = 600
end
@zhen = Sprite.new
@zhen.bitmap = Bitmap.new("Graphics/Pictures/转盘指针")
@zhen.ox = @zhen.bitmap.width / 2; @zhen.oy = @zhen.bitmap.height / 2
@zhen.x = self.x + 176; @zhen.y = self.y + 230; @zhen.z = 700
@zhen.angle = 337.5
@item_index = 0
end
#-------------------------------------------------------------------------
def dispose
@item_sprite.each{|w| w.bitmap.dispose; w.dispose}
@tit.bitmap.dispose
@zhen.bitmap.dispose
self.bitmap.dispose
@tit.dispose
@zhen.dispose
super
end
#-------------------------------------------------------------------------
def get_item_place(index)
case index
when 0 :return 195, 146
when 1 :return 238, 186
when 2 :return 242, 248
when 3 :return 192, 290
when 4 :return 138, 290
when 5 :return 90, 247
when 6 :return 94, 190
when 7 :return 134, 150
end
end
#-------------------------------------------------------------------------
def item_index
return @item_index
end
#-------------------------------------------------------------------------
def set_items(items)
@item_sprite.each{|w| w.bitmap.clear}
return if items == []
for i in 0..7
item = items
bitmap = RPG::Cache.icon(item.icon_name)
@item_sprite.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 48, 48))
end
end
#-------------------------------------------------------------------------
def zhuan
Audio.se_play("Audio/SE/#{X☆R::Change_se}", 100, 100)
@zhen.angle -= 45
@item_index = (@item_index+1) % 8
end
end
#==============================================================================
class Prize < Sprite
#-------------------------------------------------------------------------
def initialize
super()
self.x = 420; self.y = 8; self.z = 500
@messages = []
end
#-------------------------------------------------------------------------
def dispose
self.bitmap.dispose if self.bitmap
super
end
#-------------------------------------------------------------------------
def add_mess(txt)
@messages.unshift(txt)
end
#-------------------------------------------------------------------------
def set_messages
self.bitmap.dispose if self.bitmap
self.bitmap = Bitmap.new("Graphics/Pictures/奖品背景")
return if @messages == []
x = 14; y = 52
self.bitmap.font.bold = true
for i in [email protected]
self.bitmap.font.size = (i == 0 ? 20 : 16)
txt = @messages
if i == 0
self.bitmap.font.color = Color.new(0,0,0)
self.bitmap.draw_text(x-1, y-1, 120, 22, txt)
self.bitmap.draw_text(x-1, y+1, 120, 22, txt)
self.bitmap.draw_text(x-1, y-1, 120, 22, txt)
self.bitmap.draw_text(x+1, y-1, 120, 22, txt)
end
self.bitmap.font.color = (i == 0 ? Color.new(255,120,0) : Color.new(255,255,255))
self.bitmap.draw_text(x, y, 120, 22, txt)
y += (i == 0 ? 32 : 24)
end
end
#-------------------------------------------------------------------------
def update
super
@messages.pop until @messages.size <= 9
if @data_mes != @messages
@data_mes = @messages.clone
set_messages
end
end
end
#==============================================================================
class Prize_Cam < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(404, 281, 182, 112)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@column_max = 1
@item_max = 2
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = Bitmap.new("Graphics/Pictures/抽奖选择#{index}")
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 150, 80))
end
#--------------------------------------------------------------------------
def update
super
if @data_index != index
@data_index = index
refresh
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(8, index*32+8, 134, 32)
end
end
#==============================================================================
class Prize_Gold < Sprite
#-------------------------------------------------------------------------
def initialize
super()
self.x = 419; self.y = 376; self.z = 500
end
#-------------------------------------------------------------------------
def dispose
self.bitmap.dispose if self.bitmap
super
end
#-------------------------------------------------------------------------
def set_show
self.bitmap.dispose if self.bitmap
self.bitmap = Bitmap.new("Graphics/Pictures/金钱窗口背景")
self.bitmap.font.bold = true
self.bitmap.font.color = Color.new(255,255,255)
if X☆R::Consumption_mode == 2
self.bitmap.font.size = 18
item = $data_items[X☆R::Need_item_id]
bitmap = RPG::Cache.icon(item.icon_name)
self.bitmap.blt(8, 5, bitmap, Rect.new(0, 0, 48, 48))
txt = "#{item.name} X #{$game_party.item_number(item.id)}"
self.bitmap.draw_text(36, 2, 110, 32, txt)
else
self.bitmap.font.size = 20
self.bitmap.draw_text(0, 2, 100, 32, $game_party.gold.to_s, 2)
self.bitmap.font.color = Color.new(192, 224, 255)
self.bitmap.draw_text(102, 2, 48, 32, $data_system.words.gold, 1)
end
end
#-------------------------------------------------------------------------
def update
super
if X☆R::Consumption_mode == 2
if @data_num != $game_party.item_number(X☆R::Need_item_id)
@data_num = $game_party.item_number(X☆R::Need_item_id)
set_show
end
else
if @data_gold != $game_party.gold
@data_gold = $game_party.gold
set_show
end
end
end
end
#==============================================================================
class Prize_Message < Sprite
attr_accessor :mess
#-------------------------------------------------------------------------
def initialize
super()
self.x = 70; self.y = 408; self.z = 500
@mess = ""
end
#-------------------------------------------------------------------------
def dispose
self.bitmap.dispose if self.bitmap
super
end
#-------------------------------------------------------------------------
def set_mess
self.bitmap.dispose if self.bitmap
self.bitmap = Bitmap.new("Graphics/Pictures/提示信息背景")
return if @mess == ""
self.bitmap.font.bold = true
self.bitmap.font.size = 26
self.bitmap.font.color = Color.new(255,255,255)
self.bitmap.draw_text(18, 14, 460, 32, @mess, 1)
end
#-------------------------------------------------------------------------
def update
super
if @data_mess != @mess
@data_mess = @mess
set_mess
end
end
end
#==============================================================================
class Scene_Prize
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@zhuan = Change.new
@prize = Prize.new
@command = Prize_Cam.new
@gold = Prize_Gold.new
@message = Prize_Message.new
@message.mess = X☆R::can_start? ? "请点击开始按钮。" : X☆R::cant_start_wodr
@wait_count = 0
@zhuan_count = 0
@count = 0
@speed = 1
set_prize_items
if X☆R::Bgm_name != ""
Audio.bgm_play("Audio/BGM/#{X☆R::Bgm_name}", 100, 100)
end
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@zhuan.dispose
@prize.dispose
@command.dispose
@gold.dispose
@message.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
def update
@zhuan.update
@prize.update
@command.update
@gold.update
@message.update
if @wait_count > 0
@wait_count -= 1
if @wait_count == 0
@message.mess = X☆R::can_start? ? "请点击开始按钮。" : X☆R::cant_start_wodr
end
return
end
if @zhuan_count > 0
@mess = ""
update_zhuan
return
end
if @command.active and Input.trigger?(Input::C)
case @command.index
when 0
unless X☆R::can_start?
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
X☆R::consumption
set_prize_items if @count > 0
@zhuan_count = rand(150) + 150
@message.mess = ""
when 1
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
def update_zhuan
if @zhuan_count % @speed == 0
@speed = [@speed + [(100 - @zhuan_count) / 20, 0].max, 6].min
@zhuan.zhuan
end
@zhuan_count -= 1
if @zhuan_count == 0
Audio.se_play("Audio/SE/#{X☆R::Stop_se}", 100, 100)
@speed = 1
@count += 1
get_prize
@wait_count = 60
end
end
#--------------------------------------------------------------------------
def get_prize
item = @prize_items[@zhuan.item_index]
return if item.nil?
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
@prize.add_mess(item.name)
$game_system.prize_items = []
@message.mess = "恭喜获得奖品!"
end
#--------------------------------------------------------------------------
def set_prize_items
@prize_items = []
if $game_system.prize_items != nil and $game_system.prize_items != []
@prize_items = $game_system.prize_items.clone
else
set_item_mod until @prize_items.size >= 8
$game_system.prize_items = @prize_items.clone
end
@zhuan.set_items(@prize_items)
end
#--------------------------------------------------------------------------
def set_item_mod
case rand (100)
when 0...X☆R::Item_rate
if rand (100) < X☆R::Precious_item_rate
mod = X☆R::Prize_items1 + X☆R::Prize_items2
else
mod = X☆R::Prize_items1.clone
end
item = $data_items[mod[rand(mod.size)]]
@prize_items << item unless @prize_items.include?(item)
when X☆R::Item_rate...(X☆R::Item_rate + X☆R::Weapon_rate)
if rand (100) < X☆R::Precious_weapon_rate
mod = X☆R::Prize_weapons1 + X☆R::Prize_weapons2
else
mod = X☆R::Prize_weapons1.clone
end
item = $data_weapons[mod[rand(mod.size)]]
@prize_items << item unless @prize_items.include?(item)
else
if rand (100) < X☆R::Precious_armor_rate
mod = X☆R::Prize_armors1 + X☆R::Prize_armors2
else
mod = X☆R::Prize_armors1.clone
end
item = $data_armors[mod[rand(mod.size)]]
@prize_items << item unless @prize_items.include?(item)
end
end
end
#============================================================================== |
评分
-
查看全部评分
|