Project1
标题: 求大神整合脚本 [打印本页]
作者: XVI 时间: 2015-2-15 13:15
标题: 求大神整合脚本
想做个类似于mh的游戏便去搞了个物品限制脚本,可这脚本好像不太善于和其他脚本搞好关系,前两天在本站解决了一些后在实际操作中还是发现了好多问题,希望能有大神帮忙解决。
问题有这些:如果背包满了合成物品会消失,一次性的事件如宝箱里的宝物会消失。
还有些小问题:物品从仓库取出时取出数量没有上限可是包里最多99个,装备卸下时若背包已满虽会提示,但提示后人可卸下导致装备消失。
新人不是很懂规矩,不知道这样是不是太少了,真心想做个游戏希望大神帮助。
-
-
Project2.zip
219.61 KB, 下载次数: 93
作者: wolves 时间: 2015-2-15 13:15
本帖最后由 wolves 于 2015-2-16 08:40 编辑
整合好了:
加入了一个$judges变量,与其它脚本整合需要注意。
修改了解释器内容。
以下为修改部分:
背包限制:- #==============================================================================
- # 背包可容纳最大的物品种类数。(包括物品,武器,防具)
- ITEMS_MAX = 5
- # 背包满后,如果再增加物品所提示的信息。
- TOP_MESSAGE = "背包已满!"
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------
- def full_judge?(id, n, type)
- mn = 0
- @items.keys.each{|i| mn += 1 if item_number(i) > 0}
- @weapons.keys.each{|i| mn += 1 if weapon_number(i) > 0}
- @armors.keys.each{|i| mn += 1 if armor_number(i) > 0}
- return false if mn < ITEMS_MAX
- case type
- when 0
- if @items.keys.include?(id) and item_number(id) > 0
- return false if item_number(id) + n <= 99
- end
- when 1
- if @weapons.keys.include?(id) and weapon_number(id) > 0
- return false if weapon_number(id) + n <= 99
- end
- when 2
- if @armors.keys.include?(id) and armor_number(id) > 0
- return false if armor_number(id) + n <= 99
- end
- end
- return true
- end
- #---------------------------------------------------------------------
- def full_top
- $game_system.se_play($data_system.buzzer_se)
- top = Window_Base.new(200, 100, 240, 64)
- top.z = 999
- top.contents = Bitmap.new(top.width - 32, top.height - 32)
- top.contents.draw_text(0, 0, 200, 32, TOP_MESSAGE, 1)
- for i in 1..30
- Graphics.update
- end
- for i in 1..20
- top.opacity -= 13
- top.contents_opacity -= 13
- Graphics.update
- end
- top.dispose
- $judges=true
- end
- #--------------------------------------------------------------------------
- def gain_item(item_id, n)
- # 更新 hash 的个数数据
- if item_id > 0
- if n > 0 and full_judge?(item_id, n, 0)
- full_top
- return
- end
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加武器 (减少)
- # weapon_id : 武器 ID
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_weapon(weapon_id, n)
- # 更新 hash 的个数数据
- if weapon_id > 0
- if n > 0 and full_judge?(weapon_id, n, 1)
- full_top
- return
- end
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加防具 (减少)
- # armor_id : 防具 ID
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_armor(armor_id, n)
- # 更新 hash 的个数数据
- if armor_id > 0
- if n > 0 and full_judge?(armor_id, n, 2)
- full_top
- return
- end
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- end
- end
- end
- #----------------------------------------------------------------------------
- class Scene_Shop
- #--------------------------------------------------------------------------
- # ● 刷新画面 (个数输入窗口激活的情况下)
- #--------------------------------------------------------------------------
- def update_number
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 设置个数输入窗口为不活动·非可视状态
- @number_window.active = false
- @number_window.visible = false
- # 命令窗口光标位置分支
- case @command_window.index
- when 0 # 购买
- # 窗口状态转向购买模式
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- # 窗口状态转向卖出模式
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 设置个数输入窗口为不活动·非可视状态
- @number_window.active = false
- @number_window.visible = false
- # 命令窗口光标位置分支
- case @command_window.index
- when 0 # 购买
- type = @item.is_a?(RPG::Item) ? 0 : (@item.is_a?(RPG::Weapon) ? 1 : 2)
- if $game_party.full_judge?(@item.id, @number_window.number, type)
- $game_party.full_top
- @buy_window.active = true
- @buy_window.visible = true
- return
- end
- # 演奏商店 SE
- $game_system.se_play($data_system.shop_se)
- # 购买处理
- case @item
- when RPG::Item
- $game_party.gain_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.gain_weapon(@item.id, @number_window.number)
- when RPG::Armor
- $game_party.gain_armor(@item.id, @number_window.number)
- end
- $game_party.lose_gold(@number_window.number * @item.price)
- # 刷新各窗口
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- # 窗口状态转向购买模式
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- # 演奏商店 SE
- $game_system.se_play($data_system.shop_se)
- # 卖出处理
- $game_party.gain_gold(@number_window.number * (@item.price / 2))
- case @item
- when RPG::Item
- $game_party.lose_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.lose_weapon(@item.id, @number_window.number)
- when RPG::Armor
- $game_party.lose_armor(@item.id, @number_window.number)
- end
- # 刷新各窗口
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- # 窗口状态转向卖出模式
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- return
- end
- end
- end
- #==============================================================================
复制代码 合成系统
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- # 欢迎访问www.66RPG.com
- # 梦想世界,在你手中
- #==============================================================================
- #
- # Sample master list for crafting script (物品分类增强版) v1.1
- # written by Deke
- # 增强:叶子
- #
- # 12-30-2005 v1.0
- # 8-17-2006 v1.1
- # 修正了返回界面时不显示成品的BUG
- # 修正了材料大于8个不显示的BUG
- # 描绘物品美化
- # 自动检测能否合成
- #============================================================================================
- # 简介:
- # 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
- # 物品方法。
- # ------
- # 增强版补充说明:
- # 在这个增强版中,可以对成品进行手动分类。
- # 成品增加了一个分类属性。
- # 这个分类纯粹是按自己的意愿,没有规定第几类必须是什么。
- # 召唤特定分类的界面,就只会看到特定分类的成品。
- #
- # 例如:
- # 使用脚本$scene = Scene_Craft.new(1),
- # 出来的界面就只会显示成品分类为1的东西
- # 同样道理,使用脚本$scene = Scene_Craft.new(2),
- # 出来的界面就只会显示成品分类为2的东西
- #
- # 如果使用脚本$scene = Scene_Craft.new或$scene = Scene_Craft.new(0)来召唤界面
- # 就可以看到所有成品。
- #
- # 注意:不要弄混淆“成品种类”和“成品分类”
- # 成品种类是指成品是普通物品(0),防具(1)或武器(2)
- # 成品分类是指此物品的自定义分类
- #
- #
- # 使用方法:
- # 1、召唤界面:使用脚本$scene = Scene_Craft.new(分类的数字)
- # 例如:使用脚本$scene = Scene_Craft.new(1),出来分类1的界面
- #
- # 2、学习合成:$game_party.learn_recipe(合成项目)
- #
- # 2.1、其实这个脚本可以使同一成品有不同配方
- #
- # 就这样说可能解释得不清楚,先来解释一下脚本学习配方的原理:
- # $game_party.learn_recipe(合成项目)的处理过程并不是直接学习这个配方,
- # 而是在配方库中找到和合成项目成品相同的配方。
- #
- # 如果配方库中有两个配方成品相同的话,配方版本就变得重要。
- # $game_party.learn_recipe(合成项目,配方版本)
- # 配方版本为1的话,学到的配方就是@recipe_list[xx]中与合成项目成品相同且数字最小的配方
- # 配方版本为2的话,学到的配方就是数字第二小的配方
- # 在上面这个脚本语句中,不填配方版本的话就默认为1
- #
- # 2.2、忘记配方:$game_party.forget_recipe(合成项目)
- # 2.21、同样道理,这个语句也可以写配方版本
- # $game_party.forget_recipe(合成项目,配方版本)
- # 配方版本定义见2.1
- #
- # 2.3、配方版本不能乱填!例如游戏中某一个配方的成品是唯一的,与所有其它配方的成品都不相同
- # 那么学习的时候就不用填配方版本。
- # 如果这时在配方版本填了2的话,就有可能学不到或者忘不了(-_-||)
- #
- #
- # 3、合成定义:
- # 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
- # 直接写在这里就可以,另一种是在学习之前现场定义。
- #
- # 4、举例
- # 4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
- # 注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
- #
- # 4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,
- # 脚本:
- # 材料 = [$game_variables[1],$game_variables[2]] #——材料编号是变量1、2的编号
- # 材料种类 = [0,0] #——材料是物品
- # 材料数量 = [$game_variables[3],$game_variables[4]] #——需要材料数量是变量3、4的编号
- # 成品 = $game_variables[5] #——获得结果编号是5
- # 成品种类 = 1 #——成品是防具类
- # 成品分类 = 1 #——这一项不写的话默认为0
- # $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类,成品分类))
- # 上面这条语句的成品分类这一项不写也行,这样它就默认为0了。
- # (也就是此物品没有分类,不会在分类菜单中出现)
- # 省略成品分类的脚本语句可以像下面这样写:
- # $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类))
- #
- #===========================================================================================
- class Game_Temp
- attr_reader :recipe_list
- alias crafting_temp_initialize initialize
- def initialize
- crafting_temp_initialize
- @recipe_list=[]
- get_recipe_list
- end
- def get_recipe_list
- ##########################################################################
- # 1 号合成物品设定 (物品小药水×2 + 中药水 = 大药水) 成品分类:1
- ##########################################################################
- 材料 = [1, 4] # 需要材料的数据库编号
- 材料种类 = [0, 0] # 需要材料的种类,0是普通物品,1是防具,2是武器
- 材料数量 = [2, 1] # 需要材料的数量
- 成品 = 7 # 获得物品编号
- 成品种类 = 0 # 获得物品种类,0是普通物品,1是防具,2是武器
- 成品分类 = 1 # 获得成品分类
- @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
-
- 材料 = [1, 3] # 需要材料的数据库编号
- 材料种类 = [0, 0] # 需要材料的种类,0是普通物品,1是防具,2是武器
- 材料数量 = [2, 1] # 需要材料的数量
- 成品 = 8 # 获得物品编号
- 成品种类 = 0 # 获得物品种类,0是普通物品,1是防具,2是武器
- 成品分类 = 1 # 获得成品分类
- @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
-
- end # of get_recipe_list method
- end # of updates to Game_Temp Class
- #================================
- # CRAFTING PROGRAM
- #----------------------------------------------------------------
- #-written by Deke
- #-yes_no window code created by Phsylomortis
- #----------------------------------------------------------------
- #================================
- #updates to Game_Party class
- class Game_Party
-
- attr_accessor :recipes
-
- alias crafting_party_initialize initialize
-
- def initialize
- crafting_party_initialize
- @recipes=[]
- end
-
- #----------------------------------------------------------------------
- def know?(recipe, version = 1)
- unless recipe.is_a?(Game_Recipe)
- recipe = get_recipe_from_master_list(recipe, version)
- end
- return $game_party.recipes.include?(recipe)
- end
-
- #----------------------------------------------------------------------
- def learn_recipe(recipe , version = 1)
- unless recipe.is_a?(Game_Recipe)
- recipe = get_recipe_from_master_list(recipe, version)
- end
- if recipe.is_a?(Game_Recipe)
- unless know?(recipe)
- @recipes.push(recipe)
- end
- end
- end
-
- #----------------------------------------------------------------------
- def forget_recipe(recipe , version = 1)
- if !recipe.is_a?(Game_Recipe)
- recipe = get_recipe_from_master_list(recipe, version)
- end
- if recipe.is_a?(Game_Recipe)
- for i in [email protected]
- if recipe == @recipes[i]
- index = i
- break
- end
- end
- if index != nil
- @recipes.delete(@recipes[index])
- end
- end
- end
-
- #----------------------------------------------------------------------
- def get_recipe_from_master_list(item, version)
- index = nil
- for i in 0...$game_temp.recipe_list.size
- if item[0] == $game_temp.recipe_list[i].result and item[1] ==$game_temp.recipe_list[i].result_type
- version -= 1
- if version == 0
- index = i
- break
- end
- end
- end
- if index.is_a?(Integer)
- return ($game_temp.recipe_list[index])
- else
- return false
- end
- end
-
- end # of Game_Party updates
- #================================
- class Game_Recipe
- attr_reader :ingredients
- attr_reader :quantities
- attr_reader :result
- attr_reader :result_type
- attr_reader :ingredient_types
- attr_reader :craft_type #物品分类
-
- #----------------------------------------------------------------------
- def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
- @ingredients = ingredients
- @ingredient_types = ingredient_types
- @quantities = quantities
- @result = result
- @result_type = result_type
- @craft_type = craft_type
- end
-
- #----------------------------------------------------------------------
- def name
- case @result_type
- when 0
- name = $data_items[@result].name
- when 1
- name = $data_armors[@result].name
- when 2
- name = $data_weapons[@result].name
- end
- return name
- end
-
- #----------------------------------------------------------------------
- def item
- case @result_type
- when 0
- item = $data_items[@result]
- when 1
- item = $data_armors[@result]
- when 2
- item = $data_weapons[@result]
- end
- return item
- end
- #----------------------------------------------------------------------
- def have
- have_all = true
- for i in [email protected]
- case @ingredient_types[i]
- when 0
- if $game_party.item_number(@ingredients[i]) < @quantities[i]
- have_all=false
- end
- when 1
- if $game_party.armor_number(@ingredients[i]) < @quantities[i]
- have_all=false
- end
- when 2
- if $game_party.weapon_number(@ingredients[i]) < @quantities[i]
- have_all=false
- end
- end
- end
- return have_all
- end
- #----------------------------------------------------------------------
- def decrement
- for i in [email protected]
- case @ingredient_types[i]
- when 0
- $game_party.lose_item(@ingredients[i], @quantities[i])
- when 1
- $game_party.lose_armor(@ingredients[i], @quantities[i])
- when 2
- $game_party.lose_weapon(@ingredients[i], @quantities[i])
- end
- end
- end
- #----------------------------------------------------------------------
- def make
- if have
- case @result_type
- when 0
- $game_party.gain_item(@result, 1)
- when 1
- $game_party.gain_armor(@result, 1)
- when 2
- $game_party.gain_weapon(@result, 1)
- end
- decrement if $judges.nil?
- $judges=nil
- end
- end
-
- #----------------------------------------------------------------------
- def == (recipe)
- if recipe.is_a?(Game_Recipe)
- equal = true
- if recipe.ingredients != self.ingredients
- equal = false
- end
- if recipe.ingredient_types != self.ingredient_types
- equal = false
- end
- if recipe.quantities != self.quantities
- equal = false
- end
- if recipe.result != self.result
- equal=false
- end
- if recipe.result_type != self.result_type
- equal = false
- end
- else
- equal = false
- end
- return equal
- end
-
- end # of Game_Recipe class
- #===================================
- class Window_Craft < Window_Selectable
- attr_reader :data #声明数据
- #--------------------------------------------------------------------------
- def initialize(craft_type=0)
- @craft_type = craft_type
- super(0, 64, 240, 416)
- @column_max = 1
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- def recipe
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...$game_party.recipes.size
- #@craft_type为0时就显示全部物品
- #不为0时就显示对应物品
- if @craft_type == 0
- @data.push($game_party.recipes[i])
- elsif $game_party.recipes[i].craft_type == @craft_type
- @data.push($game_party.recipes[i])
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.font.name = "黑体" # = "黑体"
- self.contents.font.size = 18 # = 18
- for i in 0...@item_max
- x = 16
- y = i * 32
- able = true
- for ingredient in 0...@data[i].ingredients.size
- case @data[i].ingredient_types[ingredient]
- when 0
- count = $game_party.item_number(@data[i].ingredients[ingredient])
- when 1
- count = $game_party.armor_number(@data[i].ingredients[ingredient])
- when 2
- count = $game_party.weapon_number(@data[i].ingredients[ingredient])
- end
- if count < @data[i].quantities[ingredient]
- able = false
- break
- end
- end
- draw_item_name(@data[i].item, x, y, able)
- end
- end
- end
- #--------------------------------------------------------------------------
- #def draw_item(index)
- # recipe = @data[index]
- # self.contents.font.color = recipe.have ? normal_color : disabled_color
- # x = 16
- # y = index * 32
- # self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
- #end
-
- #--------------------------------------------------------------------------
- # ● 描绘物品名
- # item : 物品
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, able = true)
- if item == nil
- return
- end
- if !able
- self.contents.font.color = disabled_color
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.draw_text(x + 28, y, 212, 32, item.name)
- self.contents.font.color = normal_color
- end
-
- #--------------------------------------------------------------------------
- def update_help
- current_recipe = recipe
- if current_recipe.is_a?(Game_Recipe)
- case current_recipe.result_type
- when 0
- description = $data_items[current_recipe.result].description
- when 1
- description = $data_armors[current_recipe.result].description
- when 2
- description = $data_weapons[current_recipe.result].description
- end
- else
- description = ""
- end
- @help_window.set_text(description)
- @help_window.update
- end
-
- end # of Window_Craft
- #=======================================
- class Window_CraftResult < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(240, 64, 400, 184)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
- self.contents.font.size = 18 # = 20
- @result = nil
- @type = nil
- end
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- case @type
- when 0
- item = $data_items[@result]
- if item.recover_hp_rate > item.recover_hp
- hp_string = "HP回复率:"
- hp_stat = item.recover_hp_rate
- else
- hp_string = "HP回复量:"
- hp_stat = item.recover_hp
- end
- if item.recover_sp_rate > item.recover_sp
- sp_string = "SP回复率:"
- sp_stat = item.recover_sp_rate
- else
- sp_string = "SP回复量:"
- sp_stat = item.recover_sp
- end
- @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
- @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
- $game_party.item_number(@result)]
- @bitmap = RPG::Cache.icon(item.icon_name)
- when 1
- item = $data_armors[@result]
- @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
- "速度增加:", "魔力增加:"]
- @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
- item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
- @bitmap = RPG::Cache.icon(item.icon_name)
- when 2
- item = $data_weapons[@result]
- @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
- "速度增加:", "魔力增加:"]
- @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
- item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
- @bitmap = RPG::Cache.icon(item.icon_name)
- end
- for i in [email protected]
- x = i%2 * 184
- y = i /2 *28 +32
- self.contents.font.color = normal_color
- self.contents.draw_text(x,y,100, 28,@strings[i])
- self.contents.font.color = system_color
- self.contents.draw_text(x + 110, y, 45, 28, @stats[i].to_s)
- end
- self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
- self.contents.font.color= normal_color
- self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
- self.contents.font.color = system_color
- count = @stats[@stats.size - 1].to_s
- self.contents.draw_text(294, 0, 45, 28, count )
- end
-
- #----------------------------------------------------------------------
- def set_result(result , type)
- @result = result
- @type = type
- refresh
- end
- end #of Window_CraftResult
- #=======================================
- class Window_CraftIngredients < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(240, 248, 400, 232)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
- self.contents.font.size = 18 # = 20
- @ingredients = []
- @types = []
- @quantities = []
- @item = nil
- @count = 0
- @counter = 0
- @real_oy = 0
- end
- #--------------------------------------------------------------------------
- def refresh
- @counter = 0
- self.contents.clear
- self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
- for i in [email protected]
- case @types[i]
- when 0
- @item = $data_items[@ingredients[i]]
- @count = $game_party.item_number(@ingredients[i])
- when 1
- @item = $data_armors[@ingredients[i]]
- @count = $game_party.armor_number(@ingredients[i])
- when 2
- @item = $data_weapons[@ingredients[i]]
- @count = $game_party.weapon_number(@ingredients[i])
- end
- y = i *26
- self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
- self.contents.font.color = @count >= @quantities[i] ? normal_color : disabled_color
- self.contents.draw_text(30, y, 280, 28, @item.name)
- self.contents.draw_text(300, y, 45, 28, @quantities[i].to_s)
- self.contents.font.color = system_color
- self.contents.draw_text(245, y, 45, 28, @count.to_s )
- end
- end
-
- #--------------------------------------------------------------------------
- def set_ingredients(ingredients , types, quantities)
- @ingredients = ingredients
- @types = types
- @quantities = quantities
- refresh
- if @ingredients.size > 7
- self.oy = -52
- @real_oy = 0
- else
- self.oy = 0
- end
- end
- def update
- super
- @counter += 1
- if @ingredients.size > 7 and @counter > 30
- @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
- self.oy = @real_oy - 52
- end
- end
-
- end # of Window_CraftIngredients
- #======================================
- class Scene_Craft
- #--------------------------------------------------------------------------
- # @craft_type:物品种类,0就是全部
- def initialize(craft_type=0,craft_index=0)
- @craft_index=craft_index
- @craft_type = craft_type
- end
-
- #--------------------------------------------------------------------------
- def main
- @craft_window = Window_Craft.new(@craft_type)
- @craft_window.index=@craft_index
- @confirm_window = Window_Base.new(120, 188, 400, 64)
- @confirm_window.contents = Bitmap.new(368, 32)
- @confirm_window.contents.font.name = "黑体"
- @confirm_window.contents.font.size = 20
- @help_window = Window_Help.new
- @craft_window.help_window = @help_window
- @result_window=Window_CraftResult.new
- @ingredients_window=Window_CraftIngredients.new
- if @craft_window.data.size > 0 #本类窗口物品大于0的话
- @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
- @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
- @craft_window.recipe.ingredient_types,
- @craft_window.recipe.quantities)
- end
- @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
- @confirm_window.visible = false
- @confirm_window.z = 1500
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @yes_no_window.x = 270
- @yes_no_window.y = 252
- @yes_no_window.z = 1500
- @label_window = Window_Base.new(450,200,190,52)
- @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
- @label_window.contents.font.size=20
- @label_window.contents.font.color = @label_window.normal_color
- @label_window.contents.font.name = "黑体"
- @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, " 现有 需要")
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @craft_window.dispose
- @result_window.dispose
- @ingredients_window.dispose
- @confirm_window.dispose
- @yes_no_window.dispose
- @label_window.dispose
- end
- #--------------------------------------------------------------------------
- def update
- @craft_window.update
- @ingredients_window.update
- if @craft_window.active
- update_craft
- return
- end
- if @yes_no_window.active
- confirm_update
- return
- end
- end
- #--------------------------------------------------------------------------
- def update_craft
- if Input.dir4 != 0
- if @craft_window.data.size > 0 #本类窗口物品大于0的话
- @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
- @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
- @craft_window.recipe.ingredient_types,
- @craft_window.recipe.quantities)
- end
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- if Input.trigger?(Input::C) and $game_party.recipes.size != 0
- @recipe = @craft_window.recipe
- if @recipe != nil
- if @recipe.have
- @yes_no_window.active = true
- @craft_window.active = false
- else
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- else
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- def confirm_update
- @craft_index = @craft_window.index
- @confirm_window.visible = true
- @confirm_window.z = 1500
- @yes_no_window.visible = true
- @yes_no_window.active = true
- @yes_no_window.z = 1500
- @yes_no_window.update
- string = "合成 " + @recipe.name + "?"
- cw = @confirm_window.contents.text_size(string).width
- center = @confirm_window.contents.width/2 - cw /2
- unless @drawn
- @confirm_window.contents.draw_text(center, 0, cw, 30, string)
- @drawn = true
- end
- if Input.trigger?(Input::C)
- if @yes_no_window.index == 0
- $game_system.se_play($data_system.decision_se)
- @recipe.make
- $game_system.se_play($data_system.save_se)
- $scene=Scene_Craft.new(@craft_type,@craft_index)
- else
- $game_system.se_play($data_system.cancel_se)
- $scene=Scene_Craft.new(@craft_type,@craft_index)
- end
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene=Scene_Craft.new(@craft_type,@craft_index)
- end
- end
- end # of Scene_Craft
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- # 欢迎访问www.66RPG.com
- # 梦想世界,在你手中
- #==============================================================================
复制代码 附加解释器修改内容:- class Interpreter
- def command_126
- # 获取要操作的值
- value = operate_value(@parameters[1], @parameters[2], @parameters[3])
- # 增减物品
- $game_party.gain_item(@parameters[0], value)
- # 继续
- if $judges.nil?
- return true
- else
- $judges=nil
- command_115
- end
- end
- #--------------------------------------------------------------------------
- # ● 增减武器
- #--------------------------------------------------------------------------
- def command_127
- # 获取要操作的值
- value = operate_value(@parameters[1], @parameters[2], @parameters[3])
- # 增减武器
- $game_party.gain_weapon(@parameters[0], value)
- # 继续
- if $judges.nil?
- return true
- else
- $judges=nil
- command_115
- end
- end
- #--------------------------------------------------------------------------
- # ● 增减防具
- #--------------------------------------------------------------------------
- def command_128
- # 获取要操作的值
- value = operate_value(@parameters[1], @parameters[2], @parameters[3])
- # 增减防具
- $game_party.gain_armor(@parameters[0], value)
- # 继续
- if $judges.nil?
- return true
- else
- $judges=nil
- command_115
- end
- end
- end
复制代码 背包脚本问题:
Scene_Warehouse
# ————————————————————————————————————
# 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Scene_Warehouse
#------------------------------------------------------------------------------
# 处理仓库画面的类。
#==============================================================================
class Scene_Warehouse
def main
# 生成帮助窗口
@help_window = Window_Help.new
# 生成动作窗口
@action_window = Window_Warehouse_Action.new
# 生成仓库标题
@title_window = Window_Warehouse_Title.new
# 生成分类窗口
@sorting_window = Window_Warehouse_Sorting.new
@sorting_window.index = -1
@sorting_window.active = false
# 生成物品窗口
@item_window = Window_Warehouse_Item.new
@item_window.active = false
@item_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_Warehouse_Number.new
@number_window.active = false
@number_window.visible = false
# 初始化项目
@item_index = -1
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@action_window.dispose
@title_window.dispose
@sorting_window.dispose
@item_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# 更新画面
#--------------------------------------------------------------------------
def update
# 更新窗口内容
@help_window.update
@action_window.update
@title_window.update
# 更新动作窗口
if @action_window.active
update_action_window
return
end
# 更新分类窗口
if @sorting_window.active
update_sorting_window
end
# 更新物品窗口
if @item_window.active
update_item_window
return
end
# 更新数量输入窗口
if @number_window.active
update_number_window
end
end
#--------------------------------------------------------------------------
# 更新动作窗口
#--------------------------------------------------------------------------
def update_action_window
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口光标位置分支
case @action_window.index
when 0 # 存入
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@action_window.active = false
@sorting_window.active = true
@sorting_window.index = 0
when 1 # 取出
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@action_window.active = false
@sorting_window.active = true
@sorting_window.index = 0
@sorting_window.refresh(1)
when 2 # 取消
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到地图画面
$scene = Scene_Map.new
end
return
end
@sorting_window.refresh(@action_window.index)
end
#--------------------------------------------------------------------------
# 更新分类窗口
#--------------------------------------------------------------------------
def update_sorting_window
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
@sorting_window.index = -1
@sorting_window.update
@action_window.active = true
@sorting_window.active = false
@item_window.set_item("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
if @action_window.index == 0
if @sorting_window.have_item(@sorting_window.index) != @sorting_window.disabled_color
$game_system.se_play($data_system.decision_se)
@sorting_window.active = false
@item_window.active = true
@item_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
else
if @sorting_window.have_item_w(@sorting_window.index) != @sorting_window.disabled_color
$game_system.se_play($data_system.decision_se)
@sorting_window.active = false
@item_window.active = true
@item_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
# 更新物品窗口
if @action_window.index == 0
@item_window.set_item(@sorting_window.commands[@sorting_window.index])
elsif @action_window.index ==1
@item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
end
@sorting_window.update
end
#--------------------------------------------------------------------------
# 更新物品窗口
#--------------------------------------------------------------------------
def update_item_window
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@sorting_window.active = true
@item_window.active = false
@item_window.index = -1
@help_window.set_text("")
return
end
# 按下确定键
if Input.trigger?(Input::C)
# 获取物品数量
$game_system.se_play($data_system.decision_se)
if @item_window.item.is_a?(RPG::Item)
if @action_window.index == 0
i = $game_party.item_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"I")
end
elsif @item_window.item.is_a?(RPG::Weapon)
if @action_window.index == 0
i = $game_party.weapon_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"W")
end
else
if @action_window.index == 0
i = $game_party.armor_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"A")
end
end
@number_window.set(@item_window.item, i)
@number_window.active = true
@number_window.visible = true
@item_window.active = false
end
@item_window.update
if @action_window.index == 0
@item_window.set_item(@sorting_window.commands[@sorting_window.index])
elsif @action_window.index ==1
@item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
end
end
#--------------------------------------------------------------------------
# 更新输入窗口
#--------------------------------------------------------------------------
def update_number_window
@number_window.update
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@number_window.active = false
@number_window.visible = false
@item_window.active = true
return
end
if Input.trigger?(Input::C)
#处理存储操作
if @action_window.index == 0
$game_system.se_play($data_system.decision_se)
@number_window.active = false
@number_window.visible = false
@item_window.active = true
if @number_window.get_item.is_a?(RPG::Item)
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"I")
$game_party.lose_item(@number_window.get_item.id, @number_window.number)
elsif @number_window.get_item.is_a?(RPG::Weapon)
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"W")
$game_party.lose_weapon(@number_window.get_item.id, @number_window.number)
else
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"A")
$game_party.lose_armor(@number_window.get_item.id, @number_window.number)
end
#判读储存后状态
if @sorting_window.have_item(@sorting_window.index) == @sorting_window.disabled_color
@item_window.index = -1
@item_window.active = false
@sorting_window.active = true
@sorting_window.refresh
@help_window.set_text("")
end
elsif @action_window.index == 1
@item = @number_window.get_item
type = @item.is_a?(RPG::Item) ? 0 : (@item.is_a?(RPG::Weapon) ? 1 : 2)
if $game_party.full_judge?(@item.id, @number_window.number, type)
$game_party.full_top
return
end
@number_window.active = false
@number_window.visible = false
@item_window.active = true
if @number_window.get_item.is_a?(RPG::Item)
i = $game_party.item_number(@item_window.item.id) + @number_window.number
elsif @number_window.get_item.is_a?(RPG::Weapon)
i = $game_party.weapon_number(@item_window.item.id) + @number_window.number
else
i = $game_party.armor_number(@item_window.item.id) + @number_window.number
end
if i <= 99
$game_system.se_play($data_system.decision_se)
if @number_window.get_item.is_a?(RPG::Item)
$game_party.gain_item(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"I") if $judges.nil?
$judge=nil
elsif @number_window.get_item.is_a?(RPG::Weapon)
$game_party.gain_weapon(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"W") if $judges.nil?
$judge=nil
else
$game_party.gain_armor(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"A") if $judges.nil?
$judge=nil
end
else
$game_system.se_play($data_system.buzzer_se)
end
#判读储存后状态
if @sorting_window.have_item_w(@sorting_window.index) == @sorting_window.disabled_color
@item_window.index = -1
@item_window.active = false
@sorting_window.active = true
@sorting_window.refresh(1)
@help_window.set_text("")
end
end
end
end
end
# ————————————————————————————————————
# 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Scene_Warehouse
#------------------------------------------------------------------------------
# 处理仓库画面的类。
#==============================================================================
class Scene_Warehouse
def main
# 生成帮助窗口
@help_window = Window_Help.new
# 生成动作窗口
@action_window = Window_Warehouse_Action.new
# 生成仓库标题
@title_window = Window_Warehouse_Title.new
# 生成分类窗口
@sorting_window = Window_Warehouse_Sorting.new
@sorting_window.index = -1
@sorting_window.active = false
# 生成物品窗口
@item_window = Window_Warehouse_Item.new
@item_window.active = false
@item_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_Warehouse_Number.new
@number_window.active = false
@number_window.visible = false
# 初始化项目
@item_index = -1
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@action_window.dispose
@title_window.dispose
@sorting_window.dispose
@item_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# 更新画面
#--------------------------------------------------------------------------
def update
# 更新窗口内容
@help_window.update
@action_window.update
@title_window.update
# 更新动作窗口
if @action_window.active
update_action_window
return
end
# 更新分类窗口
if @sorting_window.active
update_sorting_window
end
# 更新物品窗口
if @item_window.active
update_item_window
return
end
# 更新数量输入窗口
if @number_window.active
update_number_window
end
end
#--------------------------------------------------------------------------
# 更新动作窗口
#--------------------------------------------------------------------------
def update_action_window
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口光标位置分支
case @action_window.index
when 0 # 存入
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@action_window.active = false
@sorting_window.active = true
@sorting_window.index = 0
when 1 # 取出
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@action_window.active = false
@sorting_window.active = true
@sorting_window.index = 0
@sorting_window.refresh(1)
when 2 # 取消
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到地图画面
$scene = Scene_Map.new
end
return
end
@sorting_window.refresh(@action_window.index)
end
#--------------------------------------------------------------------------
# 更新分类窗口
#--------------------------------------------------------------------------
def update_sorting_window
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
@sorting_window.index = -1
@sorting_window.update
@action_window.active = true
@sorting_window.active = false
@item_window.set_item("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
if @action_window.index == 0
if @sorting_window.have_item(@sorting_window.index) != @sorting_window.disabled_color
$game_system.se_play($data_system.decision_se)
@sorting_window.active = false
@item_window.active = true
@item_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
else
if @sorting_window.have_item_w(@sorting_window.index) != @sorting_window.disabled_color
$game_system.se_play($data_system.decision_se)
@sorting_window.active = false
@item_window.active = true
@item_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
# 更新物品窗口
if @action_window.index == 0
@item_window.set_item(@sorting_window.commands[@sorting_window.index])
elsif @action_window.index ==1
@item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
end
@sorting_window.update
end
#--------------------------------------------------------------------------
# 更新物品窗口
#--------------------------------------------------------------------------
def update_item_window
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@sorting_window.active = true
@item_window.active = false
@item_window.index = -1
@help_window.set_text("")
return
end
# 按下确定键
if Input.trigger?(Input::C)
# 获取物品数量
$game_system.se_play($data_system.decision_se)
if @item_window.item.is_a?(RPG::Item)
if @action_window.index == 0
i = $game_party.item_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"I")
end
elsif @item_window.item.is_a?(RPG::Weapon)
if @action_window.index == 0
i = $game_party.weapon_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"W")
end
else
if @action_window.index == 0
i = $game_party.armor_number(@item_window.item.id)
else
i = $game_party.get_warehouse(@item_window.item.id,"A")
end
end
@number_window.set(@item_window.item, i)
@number_window.active = true
@number_window.visible = true
@item_window.active = false
end
@item_window.update
if @action_window.index == 0
@item_window.set_item(@sorting_window.commands[@sorting_window.index])
elsif @action_window.index ==1
@item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
end
end
#--------------------------------------------------------------------------
# 更新输入窗口
#--------------------------------------------------------------------------
def update_number_window
@number_window.update
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@number_window.active = false
@number_window.visible = false
@item_window.active = true
return
end
if Input.trigger?(Input::C)
#处理存储操作
if @action_window.index == 0
$game_system.se_play($data_system.decision_se)
@number_window.active = false
@number_window.visible = false
@item_window.active = true
if @number_window.get_item.is_a?(RPG::Item)
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"I")
$game_party.lose_item(@number_window.get_item.id, @number_window.number)
elsif @number_window.get_item.is_a?(RPG::Weapon)
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"W")
$game_party.lose_weapon(@number_window.get_item.id, @number_window.number)
else
$game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"A")
$game_party.lose_armor(@number_window.get_item.id, @number_window.number)
end
#判读储存后状态
if @sorting_window.have_item(@sorting_window.index) == @sorting_window.disabled_color
@item_window.index = -1
@item_window.active = false
@sorting_window.active = true
@sorting_window.refresh
@help_window.set_text("")
end
elsif @action_window.index == 1
@item = @number_window.get_item
type = @item.is_a?(RPG::Item) ? 0 : (@item.is_a?(RPG::Weapon) ? 1 : 2)
if $game_party.full_judge?(@item.id, @number_window.number, type)
$game_party.full_top
return
end
@number_window.active = false
@number_window.visible = false
@item_window.active = true
if @number_window.get_item.is_a?(RPG::Item)
i = $game_party.item_number(@item_window.item.id) + @number_window.number
elsif @number_window.get_item.is_a?(RPG::Weapon)
i = $game_party.weapon_number(@item_window.item.id) + @number_window.number
else
i = $game_party.armor_number(@item_window.item.id) + @number_window.number
end
if i <= 99
$game_system.se_play($data_system.decision_se)
if @number_window.get_item.is_a?(RPG::Item)
$game_party.gain_item(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"I") if $judges.nil?
$judge=nil
elsif @number_window.get_item.is_a?(RPG::Weapon)
$game_party.gain_weapon(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"W") if $judges.nil?
$judge=nil
else
$game_party.gain_armor(@number_window.get_item.id, @number_window.number)
$game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"A") if $judges.nil?
$judge=nil
end
else
$game_system.se_play($data_system.buzzer_se)
end
#判读储存后状态
if @sorting_window.have_item_w(@sorting_window.index) == @sorting_window.disabled_color
@item_window.index = -1
@item_window.active = false
@sorting_window.active = true
@sorting_window.refresh(1)
@help_window.set_text("")
end
end
end
end
end
卸下装备的问题解决代码:
class Game_Actor
def tests(id)
case id
when 0
$game_party.gain_weapon($data_actors[@actor_id].weapon_id,1)
when 1
$game_party.gain_weapon($data_actors[@actor_id].armor1_id,1)
when 2
$game_party.gain_weapon($data_actors[@actor_id].armor2_id,1)
when 3
$game_party.gain_weapon($data_actors[@actor_id].armor3_id,1)
when 4
$game_party.gain_weapon($data_actors[@actor_id].armor4_id,1)
end
if $judges.nil?
case id
when 0
$game_party.gain_weapon($data_actors[@actor_id].weapon_id,-1)
when 1
$game_party.gain_weapon($data_actors[@actor_id].armor1_id,-1)
when 2
$game_party.gain_weapon($data_actors[@actor_id].armor2_id,-1)
when 3
$game_party.gain_weapon($data_actors[@actor_id].armor3_id,-1)
when 4
$game_party.gain_weapon($data_actors[@actor_id].armor4_id,-1)
end
return false
else
$judges = nil
return true
end
end
end
class Scene_Equip
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(2)
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@right_window.index) or @actor.tests(@right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
end
class Game_Actor
def tests(id)
case id
when 0
$game_party.gain_weapon($data_actors[@actor_id].weapon_id,1)
when 1
$game_party.gain_weapon($data_actors[@actor_id].armor1_id,1)
when 2
$game_party.gain_weapon($data_actors[@actor_id].armor2_id,1)
when 3
$game_party.gain_weapon($data_actors[@actor_id].armor3_id,1)
when 4
$game_party.gain_weapon($data_actors[@actor_id].armor4_id,1)
end
if $judges.nil?
case id
when 0
$game_party.gain_weapon($data_actors[@actor_id].weapon_id,-1)
when 1
$game_party.gain_weapon($data_actors[@actor_id].armor1_id,-1)
when 2
$game_party.gain_weapon($data_actors[@actor_id].armor2_id,-1)
when 3
$game_party.gain_weapon($data_actors[@actor_id].armor3_id,-1)
when 4
$game_party.gain_weapon($data_actors[@actor_id].armor4_id,-1)
end
return false
else
$judges = nil
return true
end
end
end
class Scene_Equip
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(2)
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@right_window.index) or @actor.tests(@right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
end
范例:
Project2.rar
(731.34 KB, 下载次数: 78)
作者: a554187203 时间: 2015-2-15 13:56
需求呢
比如说你装备卸下,你是希望 此件装备 无法卸下去
还是会提示丢掉某件物品
比如说仓库里取出物品有限制
不过我觉得为脚本互相添加逻辑是很麻烦的一件事情(主要是我不想读这些脚本),不过没有需求问题不会被实际解决这点请你注意
作者: XVI 时间: 2015-2-15 16:07
a554187203 发表于 2015-2-15 13:56 ![](static/image/common/back.gif)
需求呢
比如说你装备卸下,你是希望 此件装备 无法卸下去
还是会提示丢掉某件物品
我不想弄的太复杂,背包满时一切往背包里添加东西的行动都无法进行就可以了,当然这些东西不要凭空消失
作者: a554187203 时间: 2015-2-15 16:42
XVI 发表于 2015-2-15 16:07 ![](static/image/common/back.gif)
我不想弄的太复杂,背包满时一切往背包里添加东西的行动都无法进行就可以了,当然这些东西不要凭空消失 ...
你这功能实际上还是异常复杂的
您的整合脚本中添加物品有几种方法
合成添加 - 合成之后的物品还要个额外的合成仓库来存储吗……
仓库提取 - 这个无法提取还是好解决的
关键是,一个添加了独立开关的宝箱或是npc ,此物品应放在哪里?
(σ゚д゚)σ
作者: XVI 时间: 2015-2-15 17:43
a554187203 发表于 2015-2-15 16:42 ![](static/image/common/back.gif)
你这功能实际上还是异常复杂的
您的整合脚本中添加物品有几种方法
合成添加 - 合成之后的物品还 ...
合成的话 所有物品的分类都是数据库定义的
最后一句话我不是很理解,你的意思是拿不下了东西该怎么办么,那样的话不用担心 我还备有丢弃物品的脚本
作者: XVI 时间: 2015-2-15 21:46
wolves 发表于 2015-2-15 19:45 ![](static/image/common/back.gif)
整合好了:
加入了一个$judges变量,与其它脚本整合需要注意。
修改了解释器内容。
范例工程中写不下防具 从箱子里取出道具时依然可以取出99+个 能否再看一下 谢谢
作者: wolves 时间: 2015-2-15 21:51
XVI 发表于 2015-2-15 21:46 ![](static/image/common/back.gif)
范例工程中写不下防具 从箱子里取出道具时依然可以取出99+个 能否再看一下 谢谢 ...
改完了,看看如何
作者: XVI 时间: 2015-2-15 22:16
wolves 发表于 2015-2-15 21:51 ![](static/image/common/back.gif)
改完了,看看如何
老样子啊 难道我打开方式不对么![](static/image/smiley/nm/2.gif)
作者: wolves 时间: 2015-2-16 00:20
本帖最后由 wolves 于 2015-2-16 08:47 编辑
XVI 发表于 2015-2-15 22:16 ![](static/image/common/back.gif)
老样子啊 难道我打开方式不对么
找到问题了,忘了加个$judges=nil了,这回试试看,应该没有问题了@XVI
作者: XVI 时间: 2015-2-16 09:42
wolves 发表于 2015-2-16 00:20 ![](static/image/common/back.gif)
找到问题了,忘了加个$judges=nil了,这回试试看,应该没有问题了@XVI
非常感谢您解决之前三个问题 真的就剩这最后一个问题了 再看看好么
-
QQ截图20150216094003.jpg
(233 KB, 下载次数: 10)
作者: wolves 时间: 2015-2-16 13:01
XVI 发表于 2015-2-16 09:42 ![](static/image/common/back.gif)
非常感谢您解决之前三个问题 真的就剩这最后一个问题了 再看看好么 ...
你试试,过了99就取不出来了,不过可以显示出115个。
作者: XVI 时间: 2015-2-16 13:16
本帖最后由 XVI 于 2015-2-16 13:45 编辑
wolves 发表于 2015-2-16 13:01 ![](static/image/common/back.gif)
你试试,过了99就取不出来了,不过可以显示出115个。
万分抱歉,似乎加入了自动提示脚本后独立开关时间还是会消失,能否解决,感激不尽。还有如何才能把悬赏金给你呢#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
# 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。
# 开关定义:
$不显示金钱窗口 = 41
$不显示物品窗口 = 42
$不显示武器窗口 = 43
$不显示防具窗口 = 44
# 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示
# ————————————————————————————————————
class Interpreter
#--------------------------------------------------------------------------
# ● 增减金钱
#--------------------------------------------------------------------------
def command_125
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
$game_party.gain_gold(value)
if $game_switches[$不显示金钱窗口]==false
carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"支付金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减物品
#--------------------------------------------------------------------------
def command_126
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_item(@parameters[0], value)
if $game_switches[$不显示物品窗口]==false
carol3_66RPG_item = $data_items[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减武器
#--------------------------------------------------------------------------
def command_127
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_weapon(@parameters[0], value)
if $game_switches[$不显示武器窗口]==false
carol3_66RPG_item = $data_weapons[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减防具
#--------------------------------------------------------------------------
def command_128
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_armor(@parameters[0], value)
if $game_switches[$不显示防具窗口]==false
carol3_66RPG_item = $data_armors[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
# 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。
# 开关定义:
$不显示金钱窗口 = 41
$不显示物品窗口 = 42
$不显示武器窗口 = 43
$不显示防具窗口 = 44
# 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示
# ————————————————————————————————————
class Interpreter
#--------------------------------------------------------------------------
# ● 增减金钱
#--------------------------------------------------------------------------
def command_125
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
$game_party.gain_gold(value)
if $game_switches[$不显示金钱窗口]==false
carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"支付金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减物品
#--------------------------------------------------------------------------
def command_126
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_item(@parameters[0], value)
if $game_switches[$不显示物品窗口]==false
carol3_66RPG_item = $data_items[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减武器
#--------------------------------------------------------------------------
def command_127
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_weapon(@parameters[0], value)
if $game_switches[$不显示武器窗口]==false
carol3_66RPG_item = $data_weapons[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
#--------------------------------------------------------------------------
# ● 增减防具
#--------------------------------------------------------------------------
def command_128
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_armor(@parameters[0], value)
if $game_switches[$不显示防具窗口]==false
carol3_66RPG_item = $data_armors[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
作者: wolves 时间: 2015-2-16 20:17
本帖最后由 wolves 于 2015-2-16 20:18 编辑
XVI 发表于 2015-2-16 13:16 ![](static/image/common/back.gif)
万分抱歉,似乎加入了自动提示脚本后独立开关时间还是会消失,能否解决,感激不尽。还有如何才能把悬赏金 ...
看看可以么,整合过程改的东西有点多,冲突的可能性也变大了些,还有冲突的话就问吧。
-
-
Project2.rar
732.68 KB, 下载次数: 38
作者: XVI 时间: 2015-2-16 20:31
wolves 发表于 2015-2-16 20:17 ![](static/image/common/back.gif)
看看可以么,整合过程改的东西有点多,冲突的可能性也变大了些,还有冲突的话就问吧。 ...
拿不到的东西确实是不会消失了 但好像只提示拿不到的东西 拿得到的反而不会有提示了
作者: wolves 时间: 2015-2-17 10:59
XVI 发表于 2015-2-16 20:31 ![](static/image/common/back.gif)
拿不到的东西确实是不会消失了 但好像只提示拿不到的东西 拿得到的反而不会有提示了 ...
这回应该可以了。
-
-
Project2.rar
732.22 KB, 下载次数: 46
作者: XVI 时间: 2015-2-17 11:03
wolves 发表于 2015-2-17 10:59 ![](static/image/common/back.gif)
这回应该可以了。
非常感谢 问题已解决
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |