Project1
标题:
那个。。。魔法商店脚本。。哪里有啊?
[打印本页]
作者:
xyq049858
时间:
2008-7-31 19:32
标题:
那个。。。魔法商店脚本。。哪里有啊?
找到一个 用不起来啊 怎么回事 [LINE]1,#dddddd[/LINE]
此贴于 2008-9-1 21:01:51 被版主火鸡三毛老大提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
版务信息:版主帮忙结贴~
作者:
xyq049858
时间:
2008-7-31 19:34
$mShop_use_1 = "金钱" #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
$mShop_use_2 = "G" #——这项是购买魔法特技的货币单位,如“点”、“¥”
$mShop_use_variable = 0 #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
$mShop_Window_Opacity = 200 #——这项是窗口透明度
class Window_MGold < 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 ,$mShop_use_1)
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
end
end
class Scene_MShop < Scene_Base
def initialize(id)
@id = id
end
def start
super
create_menu_background
if $mShop_use_variable == 0
$mShop_gold = $game_party.gold
else
$mShop_gold = $game_variables[$mShop_use_variable]
end
@help_window = Window_Help.new
@help_window.opacity = $mShop_Window_Opacity
@gold_window = Window_MGold.new
@gold_window.x = 0
@gold_window.y = 352
@gold_window.opacity = $mShop_Window_Opacity
@buy_window = Window_MShopBuy.new(@id)
@buy_window.active = true
@buy_window.visible = true
@buy_window.help_window = @help_window
@buy_window.opacity = $mShop_Window_Opacity
@status_window = Window_MShopStatus.new
@status_window.visible = true
@status_window.active = false
@status_window.opacity = $mShop_Window_Opacity
end
def terminate
@help_window.dispose
@gold_window.dispose
@buy_window.dispose
@status_window.dispose
dispose_menu_background
end
def update
@help_window.update
@gold_window.update
@buy_window.update
@status_window.update
if @buy_window.active
update_buy
return
end
if @status_window.active
update_status
return
end
end
def update_buy
@status_window.skill = @buy_window.skill
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@skill = @buy_window.skill
if @skill == nil or @skill.price > $mShop_gold
Sound.play_buzzer
return
end
Sound.play_decision
@buy_window.active = false
@status_window.index = 0
@status_window.active = true
end
end
def update_status
if Input.trigger?(Input::B)
Sound.play_cancel
@status_window.active = false
@status_window.index = -1
@buy_window.active = true
end
if Input.trigger?(Input::C)
if $game_party.members[@status_window.index].skill_learn?(@skill.id)
Sound.play_cancel
else
Sound.play_decision
if $mShop_use_variable == 0
$game_party.gain_gold(
[email protected]
)
$mShop_gold -= @skill.price
else
$game_variables[$mShop_use_variable] -= @skill.price
$mShop_gold -= @skill.price
end
$game_party.members[@status_window.index].learn_skill(@skill.id)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@status_window.active = false
@status_window.index = -1
@buy_window.active = true
end
end
end
end
class Window_MShopStatus < Window_Selectable
def initialize
super(272, 56, 272, 360)
@skill = nil
@top_row = 0
refresh
end
def refresh
create_contents
self.contents.clear
self.contents.font.size = 18
for i in 0...$game_party.members.size
actor = $game_party.members[i]
draw_actor_graphic(actor,12,80*i+64)
self.contents.font.color = system_color
self.contents.draw_text(44, 80*i, 240, 32, actor.name)
self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
self.contents.font.color = normal_color
self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
self.contents.font.color = system_color
self.contents.draw_text(44, 80*i+22, 45, 32, Vocab::hp)
self.contents.font.color = normal_color
self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
self.contents.font.color = system_color
self.contents.draw_text(150, 80*i+22, 45, 32, Vocab::mp)
self.contents.font.color = normal_color
self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxmp.to_s,2)
if actor.skill_learn?(@skill.id)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)
else
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
end
end
@item_max = $game_party.members.size
end
def skill=(skill)
if @skill != skill
@skill = skill
refresh
end
end
def update_cursor
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 80, contents.width, 80)
end
self.refresh
end
end
class Window_MShopBuy < Window_Selectable
def initialize(id)
super(0, 56, 272, 296)
@id = id
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
self.contents.clear
@data = []
for skill_id in @id
skill = $data_skills[skill_id]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
create_contents
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
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
if $mShop_gold < skill.price
enabled = false
else
enabled = true
end
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, skill.price.to_s , 2)
end
end
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
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
复制代码
这个用不起来啊 怎么用啊?
作者:
a1234123
时间:
2008-7-31 23:58
提示:
作者被禁止或删除 内容自动屏蔽
作者:
越前リョーマ
时间:
2008-8-1 00:17
http://rpg.blue/viewthread.php?tid=80588&ntime=2008%2D7%2D31+16%3A17%3A03 [LINE]1,#dddddd[/LINE]
系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1