查看: 3061|回复: 3

[已经解决] 难度脚本的使用方法

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2017-5-10 13:48:22 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
问一下这难度脚本怎么使用,都是英文的看不懂,试了下完全找不到方向


[pre lang="ruby"]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/     ◆                Battle Difficulty - KGC_BattleDifficulty Ace
#_/     ◇                                Last Update: 2008/05/09                              ◇
#_/     ◇                                Converted: 2012/09/06
#_/     ◆                          Translation by Mr. Anonymous                            ◆
#_/     ◇                          Converted by Tsukihime
#_/----------------------------------------------------------------------------
#_/  This script adds battle difficulty settings to your game.
#_/============================================================================
#_/  Installation: Insert below KGC_ExtraDropItem and KGC_CustomMenuCommand.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================#
#                                                       ★ Customization ★                                                                #
#==============================================================================#

module KGC
module BattleDifficulty
  #                                        ◆ Difficulty Variable ◆
  #  Change the variable the difficulty setting is stored in.
  DIFFICULTY_VARIABLE = 944

  #                              ◆ Add Difficulty Command to Main Menu ◆
  #  This toggle enables/disables the difficulty command selection to be added
  #   to the main command menu.
  USE_MENU_DIFFICULTY_COMMAND = true

  #                                       ◆ Difficulty Initialization ◆
  #  DIFFICULTY Index
  #  By default, 1 = Normal
  INITIAL_DIFFICULTY = 1

  #                                                ◆ Difficulty ◆
  #  Difficulty Format:
  #   DIFFICULTY << {
  #      :name  => "Difficulty Name",
  #      :maxhp => MaxHP,
  #      :maxmp => MaxMP,
  #      :atk   => Attack,
  #      :def   => Defense,
  #      :mat   => Magic Attack,
  #      :mdf   => Magic Defense,
  #      :agi   => Agility,
  #      :luk   => Luck
  #      :param => Attack ・ Defense ・ Mat, Mdf ・ Agility, Luck (Batch Specification),
  #      :exp   => Experience,
  #      :gold  => Gold,
  #      :drop  => Item Drop Rate,
  #   }
  #  Create by the format
  #  (:atk, :def, :spi, :agi (The :param field takes highest priority)
  #  The unit is a percentile of a each item.
  #  :name is not optional
  #  An omitted item is treated as a default of 100
  DIFFICULTY = [] # Do not remove or modify this line!
  # 〜 Custom Difficulty Settings Inserted Below Here 〜
  DIFFICULTY << {               # Difficulty Level: 0
        :name  => "简单",
        :maxhp => 80,
        :maxmp => 80,
        :param => 80,
        :cri   => 50,
        :drop  => 80,
  }  # ← Do not remove!
  DIFFICULTY << {               # Difficulty Level: 1
        :name  => "普通",
  }
  DIFFICULTY << {               # Difficulty Level: 2
        :name  => "困难",
        :maxhp => 150,   #150
        :maxmp => 130,
        :atk   => 120,
        :mat   => 120,
        :mdf   => 120,
        :agi   => 105,
        :luk   => 110,
        :exp   => 150,
        :drop  => 150,
  }

end
end

#------------------------------------------------------------------------------#

$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true

module KGC::BattleDifficulty
  # Parameters
  PARAMS = [
        :maxhp, :maxmp, :atk, :def, :mat, :mdf, :agi, :luk,
        :exp, :gold, :drop
  ]

  module_function
  #--------------------------------------------------------------------------
  # ○ 難易度補正値作成
  #--------------------------------------------------------------------------
  def create_param_revs
        @@param_revs = []
        DIFFICULTY.each { |d|
          rev = {}
          rev[:name] = d[:name]
          # 一括指定を適用
          if d[:param] != nil
                rev[:atk] = rev[:def] = rev[:mat] = rev[:mdf] = rev[:agi] = rev[:luk] = d[:param]
          end
          # パラメータ指定を適用
          PARAMS.each { |par|
                if d[par] != nil
                  rev[par] = d[par]
                else
                  rev[par] = 100 if rev[par] == nil
                end
          }
          # リストに追加
          @@param_revs << rev
        }
  end
  #--------------------------------------------------------------------------
  # ○ 難易度補正値取得
  #--------------------------------------------------------------------------
  def param_revs
        return @@param_revs
  end
  #--------------------------------------------------------------------------
  # ○ 難易度インデックス取得
  #--------------------------------------------------------------------------
  def get_index
        vid = DIFFICULTY_VARIABLE
        if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
          $game_variables[vid] = INITIAL_DIFFICULTY
        end
        return $game_variables[vid]
  end
  #--------------------------------------------------------------------------
  # ○ 難易度取得
  #--------------------------------------------------------------------------
  def get
        return @@param_revs[get_index]
  end
  #--------------------------------------------------------------------------
  # ○ 難易度変更
  #      index : 難易度インデックス
  #--------------------------------------------------------------------------
  def set(index)
        index = [[index, DIFFICULTY.size - 1].min, 0].max
        $game_variables[DIFFICULTY_VARIABLE] = index
  end

  create_param_revs
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Enemy::DropItem
#==============================================================================

unless $@
class RPG::Enemy::DropItem
  #--------------------------------------------------------------------------
  # ● 出現率 1/N の分母 N
  #--------------------------------------------------------------------------
  alias denominator_KGC_BattleDifficulty denominator
  def denominator
    n = @denominator
    if n > 1
      n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
    end
    return n
  end

end  # class
end  # unless $@

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler


  # Ace defines one method for accessing all basic parameters
  alias :th_kgc_difficulty_param_base :param_base
  def param_base(i)
    th_kgc_difficulty_param_base(i) * KGC::BattleDifficulty.get[:maxhp] / 100
  end


  #--------------------------------------------------------------------------
  # ● 経験値の取得
  #--------------------------------------------------------------------------
  alias :th_KGC_BattleDifficulty_exp :exp
  def exp
    th_KGC_BattleDifficulty_exp * KGC::BattleDifficulty.get[:exp] / 100
  end
  #--------------------------------------------------------------------------
  # ● お金の取得
  #--------------------------------------------------------------------------
  alias :th_KGC_BattleDifficulty_gold :gold
  def gold
    th_KGC_BattleDifficulty_gold * KGC::BattleDifficulty.get[:gold] / 100
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Title
#==============================================================================

module DataManager

  class << self
    alias :th_KGC_BattleDifficulty_create_game :create_game_objects
  end

  def self.create_game_objects
    th_KGC_BattleDifficulty_create_game
    variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
    p variable_id
    $game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
  end
end





=begin



#==============================================================================
# ■ Scene_Menu
#==============================================================================


# new window for Ace, moving it out of Scene_Menu
class Window_BattleDifficulty < Window_Command
  
  def make_command_list
    KGC::BattleDifficulty::param_revs.each { |d|
      add_command(d[:name], d[:name].to_sym)
    }
  end
end

class Window_MenuCommand
  
  alias :th_kgc_battle_difficulty_add_main_commands :add_main_commands
  def add_main_commands
    th_kgc_battle_difficulty_add_main_commands
    if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
      add_command("Difficulty", :difficulty, main_commands_enabled)
    end
  end
end

class Scene_Menu
  
  # add new menu to the scene
  
  alias :th_kgc_battle_difficulty_start :start
  def start
    th_kgc_battle_difficulty_start
    create_difficulty_window
  end
  
  alias :th_kgc_battle_difficulty_cmd_window :create_command_window
  def create_command_window
    th_kgc_battle_difficulty_cmd_window
    @command_window.set_handler(:difficulty,      method(:command_difficulty))
  end
  
  def create_difficulty_window
    @difficulty_window = Window_BattleDifficulty.new(80, 100)
    @difficulty_window.set_handler(:ok, method(:on_difficulty_ok))
    @difficulty_window.set_handler(:cancel, method(:on_difficulty_cancel))
    @difficulty_window.hide.deactivate
  end
  
  def command_difficulty
    @difficulty_window.show.open.activate
  end
  
  def on_difficulty_ok
    KGC::BattleDifficulty.set(@difficulty_window.index)
    end_difficulty_selection
  end
  
  def on_difficulty_cancel
    end_difficulty_selection
  end
  
  def end_difficulty_selection
    @difficulty_window.close
    @command_window.activate
  end
end


=end[/pre]
梦石
0
星屑
6375
在线时间
1473 小时
注册时间
2015-7-25
回帖
609

极短25参与开拓者

发表于 2017-5-10 14:23:31 | 显示全部楼层
本帖最后由 魔法丶小肉包 于 2017-5-10 14:28 编辑

目测貌似跟944号变量的值有关....也就是DIFFICULTY_VARIABLE
944号变量的值为0时,简单
为1时,普通
为2时,困难
具体的数值在DIFFICULTY里设置

点评

fjm
已经可以使用了,非常感谢  发表于 2017-5-10 15:16
fjm
多谢指点,我试下  发表于 2017-5-10 14:56

评分

参与人数 1星屑 +250 收起 理由
RaidenInfinity + 250 认可答案

查看全部评分

笨肉包的游戏讨论群932812135 (实时更新) 喜欢的话欢迎加入~
目前的坑
??? #像素风OC游戏 准备中 短篇-约5小时
花城梦之心 #像素风OC游戏 系统开发+素材绘制中
【不可思议的迷宫】幽灵契约外传:歌莉娅 v0.4 游戏文件已更新
同时更新中~ (沉迷摸鱼中~更新速度较慢请见谅w)
这是属于笨肉包一个人的旅行~(这只肉包又在摸鱼!
旅途的最终目标~ ???(保密~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部