| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2026-11-12 |
| 在线时间 | 2462 小时 |
- 梦石
- 0
- 星屑
- 97
- 在线时间
- 2462 小时
- 注册时间
- 2011-12-18
- 回帖
- 1419
|
发表于 2013-1-21 15:58:57
|
显示全部楼层
大概就是这种效果了
把下面两个脚本插到main上就行了。
沉影大大的读取备注脚本:
- #==============================================================================
- # ■ [VX] 读取rmvx备注栏
- # [VX] ReadNote
- #----------------------------------------------------------------------------
- # 使用说明:
- # 【例】在vx数据库比如1号物品的备注栏里写: 耐久度 = 10
- # 读取时使用: p $data_items[1].read_note('耐久度')
- # 几点注意:
- # ① 支持汉字,英文忽略大小写
- # ② 等号右边遵循ruby语法格式,例如:
- # test1 = 1 #=> 1
- # test2 = "a" #=> "a"
- # test3 = true #=> true
- # test4 = [1,2,3] #=> [1,2,3]
- # test5 = {"orz"=>1} #=> {"orz"=>1}
- # ③ 等号忽略空格,以下均正确:
- # test = nil; test= nil; test =nil; test=nil
- #----------------------------------------------------------------------------
- # 更新作者: 沉影不器
- # 许可协议: FSL
- # 项目版本: 2.02.1001
- # 引用网址: [url]http://rpg.blue/thread-99474-1-1.html[/url]
- #----------------------------------------------------------------------------
- # - *2.02.1001* (2010-10-01) By 沉影不器
- # *修复引用方法带Binding的错误
- #
- # - *2.01.0806* (2010-08-06) By 沉影不器
- # *完全用eval执行文本,进一步简化代码
- #
- # - *2.00.0729* (2010-07-29) By 沉影不器
- # *改用eval执行赋值内容,支持浮点.数组.哈希等
- # *强制忽略大小写
- # *简化脚本
- #
- # - *1.11.0824* (2008-08-24) By 沉影不器
- # *修正rmvx英文帮助带来的类名错误
- #
- # - *1.10.0821* (2008-08-21) By 沉影不器
- # *扩展到支持rmvx数据库内所有带备注栏的选项
- # *改了一下算法,使备注栏的注释也同ruby语法一样忽略空格
- #
- # - *1.02.0819* (2008-08-19) By 沉影不器
- # *直接成为RPG::BaseItem内一个函数,简化使用方法
- #
- # - *1.00.0818* (2008-08-18) By 沉影不器
- # *初版
- #==============================================================================
- $fscript = {} if $fscript == nil
- $fscript["ReadNote"] = "2.02.1001"
- #==============================================================================
- # ■ RPG
- #==============================================================================
- module RPG
- #=============================================================================
- # □ ReadNote
- #=============================================================================
- module ReadNote
- def self.read(str, section, mismatch = nil)
- str.each_line do |line|
- ## 不希望忽略大小写,则删掉下一行最后一个i
- eval("#{line}; return #{section}") if line =~ /^\s*#{section}\s*=/i
- end
- return mismatch
- end
- end
- #=============================================================================
- # ■ BaseItem
- #=============================================================================
- class BaseItem
- #-------------------------------------------------------------------------
- # ○ 读取rmvx备注栏指定字段
- # section : 字段名
- # mismatch : 未匹配时的返回值
- #-------------------------------------------------------------------------
- def read_note(section, mismatch = nil)
- ReadNote.read(self.note, section, mismatch)
- end
- end
- #=============================================================================
- # ■ Enemy
- #=============================================================================
- class Enemy
- def read_note(section, mismatch = nil)
- ReadNote.read(self.note, section, mismatch)
- end
- end
- #=============================================================================
- # ■ State
- #=============================================================================
- class State
- def read_note(section, mismatch = nil)
- ReadNote.read(self.note, section, mismatch)
- end
- end
- end
复制代码
更改某个物品出售价格的脚本:
- class Window_ShopNumber < Window_Base
- def set(item, max, price)
- @item = item
- [url=home.php?mod=space&uid=25307]@Max[/url] = max
- if @item.read_note('售价') != nil
- @price = @item.read_note('售价')
- else
- @price = price
- end
- [url=home.php?mod=space&uid=27178]@Number[/url] = 1
- refresh
- end
- end
- ###################################################
- class Scene_Shop < Scene_Base
- def update_sell_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @dummy_window.visible = true
- @sell_window.active = false
- @sell_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- elsif Input.trigger?(Input::C)
- @item = @sell_window.item
- @status_window.item = @item
- if @item == nil or @item.price == 0
- Sound.play_buzzer
- else
- Sound.play_decision
- max = $game_party.item_number(@item)
- @sell_window.active = false
- @sell_window.visible = false
- if @item.read_note('售价') != nil
- @number_window.set(@item, max, @item.read_note('售价'))
- else
- @number_window.set(@item, max, @item.price/2)
- end
-
- @number_window.active = true
- @number_window.visible = true
- @status_window.visible = true
- end
- end
- end
-
- def decide_number_input
- Sound.play_shop
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 买入
- $game_party.lose_gold(@number_window.number * @item.price)
- $game_party.gain_item(@item, @number_window.number)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- if @item.read_note('售价') != nil
- $game_party.gain_gold(@number_window.number * @item.read_note('售价'))
- else
- $game_party.gain_gold(@number_window.number * (@item.price / 2))
- end
-
- $game_party.lose_item(@item, @number_window.number)
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- end
- end
复制代码
使用方法:
在物品的备注栏里写 售价 = 30000,那么该物品的出售价格就会是30000,其余的还是原来的不变 |
评分
-
查看全部评分
|