赞 | 287 |
VIP | 11 |
好人卡 | 74 |
积分 | 226 |
经验 | 281171 |
最后登录 | 2024-11-16 |
在线时间 | 9414 小时 |
Lv5.捕梦者 (暗夜天使) 只有笨蛋才会看到
- 梦石
- 1
- 星屑
- 21631
- 在线时间
- 9414 小时
- 注册时间
- 2012-6-19
- 帖子
- 7118
|
本帖最后由 喵呜喵5 于 2013-9-26 18:25 编辑
- =begin
- ===============================================================================
- 变量商店 By喵呜喵5
- ===============================================================================
- 【说明】
-
- 可以使用变量在商店进行购物
-
- 首先先在事件中使用脚本命令输入:shop_set(变量的ID,"变量的单位"),例如:
- shop_set(1,"节操")
-
- 接着使用事件中的商店处理时,购买物品不会消耗金钱而是消耗对应的变量
-
- 使用命令shop_set可以恢复原来使用金钱购物的商店
-
- =end
- #==============================================================================
- # 脚本部分
- #==============================================================================
- $shop_set = [0,0] if $shop_set == nil
- class Game_Interpreter
- def shop_set(gold=0,unit="")
- $shop_set = gold,unit
- end
- end
- class Window_Gold_New < Window_Base
- def initialize(gold,unit)
- super(0, 0, window_width, fitting_height(1))
- [url=home.php?mod=space&uid=236945]@gold[/url] = gold
- @unit = unit
- refresh
- end
- def window_width
- return 160
- end
- def refresh
- contents.clear
- draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
- end
- def value
- if [url=home.php?mod=space&uid=236945]@gold[/url] == 0
- $game_party.gold
- else
- $game_variables[@gold]
- end
- end
- def currency_unit
- if @gold == 0
- Vocab::currency_unit
- else
- @unit
- end
- end
- def open
- refresh
- super
- end
- end
- class Scene_Shop < Scene_MenuBase
- def create_gold_window
- @gold_window = Window_Gold_New.new($shop_set[0],$shop_set[1])
- @gold_window.viewport = @viewport
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = @help_window.height
- end
- def do_buy(number)
- if $shop_set[0] == 0
- $game_party.lose_gold(number * buying_price)
- else
- $game_variables[$shop_set[0]] -= number * buying_price
- end
- $game_party.gain_item(@item, number)
- end
- def do_sell(number)
- if $shop_set[0] == 0
- $game_party.gain_gold(number * selling_price)
- else
- $game_variables[$shop_set[0]] += number * selling_price
- end
- $game_party.lose_item(@item, number)
- end
- def money
- @gold_window.value
- end
- def currency_unit
- @gold_window.currency_unit
- end
- def selling_price
- if $shop_set[0] == 0
- @item.price / 2
- else
- buying_price / 2
- end
- end
- end
复制代码 |
|