Project1
标题:
8人限制和通用魔法商店并存
[打印本页]
作者:
eciling
时间:
2007-8-23 02:56
标题:
8人限制和通用魔法商店并存
小弟做游戏时饮用了风中萧萧大人的八人限制和通用魔法商店脚本,但是只能使用通用的,我想求个两种都可以用的脚本,我是新人
八人制战斗
http://rpg.blue/web/htm/news713.htm
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
eciling
时间:
2007-8-23 02:56
标题:
8人限制和通用魔法商店并存
小弟做游戏时饮用了风中萧萧大人的八人限制和通用魔法商店脚本,但是只能使用通用的,我想求个两种都可以用的脚本,我是新人
八人制战斗
http://rpg.blue/web/htm/news713.htm
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
湛蓝de海
时间:
2007-8-23 03:00
本人脚本盲一个,不懂.
建议去综合应援区,悬赏整合下.
作者:
enghao_lim
时间:
2007-8-23 03:06
不好意思,对于你的问题请详细解说一下。
因为在那个八人的战斗范例里已经攻给魔法商店的脚本,
你要的到底是什么?
还有,附带一提,我们不会因为你是新人就什么都帮你做,你应该先尝试专研一下他人的范例,
这样对自己是有帮助的。
作者:
eciling
时间:
2007-8-23 03:08
但是通用的会把限制的屏蔽掉
作者:
enghao_lim
时间:
2007-8-23 03:30
对于你的问题,你是说你想限制和通用的魔法商店一起用是吧?
作者:
eciling
时间:
2007-8-23 03:35
恩
作者:
enghao_lim
时间:
2007-8-23 03:42
只是修改了一些脚本,就几个字而已。
呼叫场面 使用 脚本:
$scene = Scene_XShop.new([技能编号])
注:用法和以前的一样。
如果有问题在发短信给我。
#==============================================================================
# ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
#==============================================================================
#——以下是一些自定义的内容
$XShop_use_1 = "金钱" #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
$XShop_use_2 = "G" #——这项是购买魔法特技的货币单位,如“点”、“¥”
$XShop_use_variable = 0 #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
$XShop_Window_Opacity = 200 #——这项是窗口透明度
#==============================================================================
# ■ Window_XGold
#------------------------------------------------------------------------------
# 显示金钱的窗口。
#==============================================================================
class Window_XGold < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 272, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0 , 240,32 ,$XShop_use_1)
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 240-contents.text_size($XShop_use_2).width-6, 32, $XShop_gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 240, 32, $XShop_use_2, 2)
end
end
#==============================================================================
# ■ Scene_XShop
#------------------------------------------------------------------------------
# 处理特技商店画面的类。
#==============================================================================
class Scene_XShop
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(id)
@id = id
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
screen = Spriteset_Map.new
if $XShop_use_variable == 0
$XShop_gold = $game_party.gold
else
$XShop_gold = $game_variables[$XShop_use_variable]
end
# 生成帮助窗口
@help_window = Window_Help.new
@help_window.opacity = $XShop_Window_Opacity
# 生成金钱窗口
@gold_window = Window_XGold.new
@gold_window.x = 368
@gold_window.y = 416
@gold_window.opacity = $XShop_Window_Opacity
# 生成购买窗口
@buy_window = Window_XShopBuy.new(@id)
@buy_window.active = true
@buy_window.visible = true
@buy_window.help_window = @help_window
@buy_window.opacity = $XShop_Window_Opacity
# 生成状态窗口
@status_window = Window_XShopStatus.new
@status_window.visible = true
@status_window.active = false
@status_window.opacity = $XShop_Window_Opacity
#生成指令窗口
@command_window = Window_Command.new(160,["学会","遗忘"])
@command_window.x = 320
@command_window.y = 240
@command_window.z = 500
@command_window.visible = false
@command_window.active = false
@command_window.opacity = $XShop_Window_Opacity
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
#@mhelp_window.dispose
@gold_window.dispose
@command_window.dispose
@buy_window.dispose
@status_window.dispose
screen.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
#@mhelp_window.update
@gold_window.update
@buy_window.update
@status_window.update
@command_window.update
# 购买窗口激活的情况下: 调用 update_buy
if @buy_window.active
update_buy
return
end
if @status_window.active
update_status
return
end
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (购买窗口激活的情况下)
#--------------------------------------------------------------------------
def update_buy
@status_window.skill = @buy_window.skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@skill = @buy_window.skill
if @skill == nil or @skill.price > $XShop_gold
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@buy_window.active = false
@status_window.index = 0
@status_window.active = true
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (状态窗口激活的情况下)
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@status_window.active = false
@status_window.index = -1
@buy_window.active = true
end
if Input.trigger?(Input::C)
@status_window.active = false
@command_window.visible = true
@command_window.active = true
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (指令窗口激活的情况下)
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@status_window.index = -1
@command_window.active = false
@command_window.visible = false
@buy_window.active = true
return
end
if Input.trigger?(Input::C)
if @command_window.index == 0
if $game_party.actors[@status_window.index].skill_learn?(@skill.id)
$game_system.se_play($data_system.cancel_se)
return
else
$game_system.se_play($data_system.decision_se)
if $XShop_use_variable == 0
$game_party.gain_gold(
[email protected]
)
$XShop_gold -= @skill.price
else
$game_variables[$XShop_use_variable] -= @skill.price
$XShop_gold -= @skill.price
end
$game_party.actors[@status_window.index].learn_skill(@skill.id)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@status_window.index = -1
@buy_window.active = true
@command_window.active = false
@command_window.visible = false
end
elsif @command_window.index == 1
if $game_party.actors[@status_window.index].skill_learn?(@skill.id) == false
$game_system.se_play($data_system.cancel_se)
return
else
$game_system.se_play($data_system.decision_se)
if $XShop_use_variable == 0
$game_party.gain_gold(@skill.price/2) #<-遗忘价格为学习的一半,/2的地方相同
$XShop_gold += @skill.price/2
else
$game_variables[$XShop_use_variable] += @skill.price/2
$XShop_gold += @skill.price/2
end
$game_party.actors[@status_window.index].forget_skill(@skill.id)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@status_window.index = -1
@buy_window.active = true
@command_window.active = false
@command_window.visible = false
end
end
return
end
end
#==============================================================================
# ■ Window_XShopStatus
#------------------------------------------------------------------------------
# 特技商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_XShopStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(368, 64, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 18
@skill = nil
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
self.contents.font.color = system_color
self.contents.draw_text(0, 40*i, 240, 32, actor.name)
if actor.skill_learn?(@skill.id)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(0, 40*i, 200, 32, "此特技已经学习",2)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(75, 40*i, 240, 32, "此特技尚未学习")
end
end
@item_max = $game_party.actors.size
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 新的物品
#--------------------------------------------------------------------------
def skill=(skill)
if @skill != skill
@skill = skill
refresh
end
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 40, self.width - 32, 32)
end
end
end
#==============================================================================
# ■ Window_XShopBuy
#------------------------------------------------------------------------------
# 特技商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_XShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# shop_goods : 商品
#--------------------------------------------------------------------------
def initialize(id)
super(0, 64, 368, 416)
@id = id
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for skill_id in @id
skill = $data_skills[skill_id]
if skill != nil
@data.push(skill)
end
end
@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)
skill = @data[index]
# 除此之外的情况设置为无效文字色
if skill.price <= $XShop_gold
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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 + 28, y, 212, 32, skill.name, 0)
self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# ■ RPG原装定义
#==============================================================================
module RPG
class Skill
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def price
price = @description.split(/@/)[1]
return price != nil ? price.to_i : 0
end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
凝眸
时间:
2007-8-23 03:49
{/pz}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1