查看: 3106|回复: 3

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

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

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

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

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


  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/     ◆                Battle Difficulty - KGC_BattleDifficulty Ace
  3. #_/     ◇                                Last Update: 2008/05/09                              ◇
  4. #_/     ◇                                Converted: 2012/09/06
  5. #_/     ◆                          Translation by Mr. Anonymous                            ◆
  6. #_/     ◇                          Converted by Tsukihime
  7. #_/----------------------------------------------------------------------------
  8. #_/  This script adds battle difficulty settings to your game.
  9. #_/============================================================================
  10. #_/  Installation: Insert below KGC_ExtraDropItem and KGC_CustomMenuCommand.
  11. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  12. #==============================================================================#
  13. #                                                       ★ Customization ★                                                                #
  14. #==============================================================================#

  15. module KGC
  16. module BattleDifficulty
  17.   #                                        ◆ Difficulty Variable ◆
  18.   #  Change the variable the difficulty setting is stored in.
  19.   DIFFICULTY_VARIABLE = 944

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

  24.   #                                       ◆ Difficulty Initialization ◆
  25.   #  DIFFICULTY Index
  26.   #  By default, 1 = Normal
  27.   INITIAL_DIFFICULTY = 1

  28.   #                                                ◆ Difficulty ◆
  29.   #  Difficulty Format:
  30.   #   DIFFICULTY << {
  31.   #      :name  => "Difficulty Name",
  32.   #      :maxhp => MaxHP,
  33.   #      :maxmp => MaxMP,
  34.   #      :atk   => Attack,
  35.   #      :def   => Defense,
  36.   #      :mat   => Magic Attack,
  37.   #      :mdf   => Magic Defense,
  38.   #      :agi   => Agility,
  39.   #      :luk   => Luck
  40.   #      :param => Attack ・ Defense ・ Mat, Mdf ・ Agility, Luck (Batch Specification),
  41.   #      :exp   => Experience,
  42.   #      :gold  => Gold,
  43.   #      :drop  => Item Drop Rate,
  44.   #   }
  45.   #  Create by the format
  46.   #  (:atk, :def, :spi, :agi (The :param field takes highest priority)
  47.   #  The unit is a percentile of a each item.
  48.   #  :name is not optional
  49.   #  An omitted item is treated as a default of 100
  50.   DIFFICULTY = [] # Do not remove or modify this line!
  51.   # 〜 Custom Difficulty Settings Inserted Below Here 〜
  52.   DIFFICULTY << {               # Difficulty Level: 0
  53.         :name  => "简单",
  54.         :maxhp => 80,
  55.         :maxmp => 80,
  56.         :param => 80,
  57.         :cri   => 50,
  58.         :drop  => 80,
  59.   }  # ← Do not remove!
  60.   DIFFICULTY << {               # Difficulty Level: 1
  61.         :name  => "普通",
  62.   }
  63.   DIFFICULTY << {               # Difficulty Level: 2
  64.         :name  => "困难",
  65.         :maxhp => 150,   #150
  66.         :maxmp => 130,
  67.         :atk   => 120,
  68.         :mat   => 120,
  69.         :mdf   => 120,
  70.         :agi   => 105,
  71.         :luk   => 110,
  72.         :exp   => 150,
  73.         :drop  => 150,
  74.   }

  75. end
  76. end

  77. #------------------------------------------------------------------------------#

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

  80. module KGC::BattleDifficulty
  81.   # Parameters
  82.   PARAMS = [
  83.         :maxhp, :maxmp, :atk, :def, :mat, :mdf, :agi, :luk,
  84.         :exp, :gold, :drop
  85.   ]

  86.   module_function
  87.   #--------------------------------------------------------------------------
  88.   # ○ 難易度補正値作成
  89.   #--------------------------------------------------------------------------
  90.   def create_param_revs
  91.         @@param_revs = []
  92.         DIFFICULTY.each { |d|
  93.           rev = {}
  94.           rev[:name] = d[:name]
  95.           # 一括指定を適用
  96.           if d[:param] != nil
  97.                 rev[:atk] = rev[:def] = rev[:mat] = rev[:mdf] = rev[:agi] = rev[:luk] = d[:param]
  98.           end
  99.           # パラメータ指定を適用
  100.           PARAMS.each { |par|
  101.                 if d[par] != nil
  102.                   rev[par] = d[par]
  103.                 else
  104.                   rev[par] = 100 if rev[par] == nil
  105.                 end
  106.           }
  107.           # リストに追加
  108.           @@param_revs << rev
  109.         }
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ○ 難易度補正値取得
  113.   #--------------------------------------------------------------------------
  114.   def param_revs
  115.         return @@param_revs
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ○ 難易度インデックス取得
  119.   #--------------------------------------------------------------------------
  120.   def get_index
  121.         vid = DIFFICULTY_VARIABLE
  122.         if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
  123.           $game_variables[vid] = INITIAL_DIFFICULTY
  124.         end
  125.         return $game_variables[vid]
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ○ 難易度取得
  129.   #--------------------------------------------------------------------------
  130.   def get
  131.         return @@param_revs[get_index]
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ 難易度変更
  135.   #      index : 難易度インデックス
  136.   #--------------------------------------------------------------------------
  137.   def set(index)
  138.         index = [[index, DIFFICULTY.size - 1].min, 0].max
  139.         $game_variables[DIFFICULTY_VARIABLE] = index
  140.   end

  141.   create_param_revs
  142. end

  143. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  144. #==============================================================================
  145. # ■ RPG::Enemy::DropItem
  146. #==============================================================================

  147. unless $@
  148. class RPG::Enemy::DropItem
  149.   #--------------------------------------------------------------------------
  150.   # ● 出現率 1/N の分母 N
  151.   #--------------------------------------------------------------------------
  152.   alias denominator_KGC_BattleDifficulty denominator
  153.   def denominator
  154.     n = @denominator
  155.     if n > 1
  156.       n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
  157.     end
  158.     return n
  159.   end

  160. end  # class
  161. end  # unless $@

  162. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  163. #==============================================================================
  164. # ■ Game_Enemy
  165. #==============================================================================

  166. class Game_Enemy < Game_Battler


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


  172.   #--------------------------------------------------------------------------
  173.   # ● 経験値の取得
  174.   #--------------------------------------------------------------------------
  175.   alias :th_KGC_BattleDifficulty_exp :exp
  176.   def exp
  177.     th_KGC_BattleDifficulty_exp * KGC::BattleDifficulty.get[:exp] / 100
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● お金の取得
  181.   #--------------------------------------------------------------------------
  182.   alias :th_KGC_BattleDifficulty_gold :gold
  183.   def gold
  184.     th_KGC_BattleDifficulty_gold * KGC::BattleDifficulty.get[:gold] / 100
  185.   end
  186. end

  187. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  188. #==============================================================================
  189. # ■ Scene_Title
  190. #==============================================================================

  191. module DataManager

  192.   class << self
  193.     alias :th_KGC_BattleDifficulty_create_game :create_game_objects
  194.   end

  195.   def self.create_game_objects
  196.     th_KGC_BattleDifficulty_create_game
  197.     variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
  198.     p variable_id
  199.     $game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
  200.   end
  201. end





  202. =begin



  203. #==============================================================================
  204. # ■ Scene_Menu
  205. #==============================================================================


  206. # new window for Ace, moving it out of Scene_Menu
  207. class Window_BattleDifficulty < Window_Command
  208.   
  209.   def make_command_list
  210.     KGC::BattleDifficulty::param_revs.each { |d|
  211.       add_command(d[:name], d[:name].to_sym)
  212.     }
  213.   end
  214. end

  215. class Window_MenuCommand
  216.   
  217.   alias :th_kgc_battle_difficulty_add_main_commands :add_main_commands
  218.   def add_main_commands
  219.     th_kgc_battle_difficulty_add_main_commands
  220.     if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
  221.       add_command("Difficulty", :difficulty, main_commands_enabled)
  222.     end
  223.   end
  224. end

  225. class Scene_Menu
  226.   
  227.   # add new menu to the scene
  228.   
  229.   alias :th_kgc_battle_difficulty_start :start
  230.   def start
  231.     th_kgc_battle_difficulty_start
  232.     create_difficulty_window
  233.   end
  234.   
  235.   alias :th_kgc_battle_difficulty_cmd_window :create_command_window
  236.   def create_command_window
  237.     th_kgc_battle_difficulty_cmd_window
  238.     @command_window.set_handler(:difficulty,      method(:command_difficulty))
  239.   end
  240.   
  241.   def create_difficulty_window
  242.     @difficulty_window = Window_BattleDifficulty.new(80, 100)
  243.     @difficulty_window.set_handler(:ok, method(:on_difficulty_ok))
  244.     @difficulty_window.set_handler(:cancel, method(:on_difficulty_cancel))
  245.     @difficulty_window.hide.deactivate
  246.   end
  247.   
  248.   def command_difficulty
  249.     @difficulty_window.show.open.activate
  250.   end
  251.   
  252.   def on_difficulty_ok
  253.     KGC::BattleDifficulty.set(@difficulty_window.index)
  254.     end_difficulty_selection
  255.   end
  256.   
  257.   def on_difficulty_cancel
  258.     end_difficulty_selection
  259.   end
  260.   
  261.   def end_difficulty_selection
  262.     @difficulty_window.close
  263.     @command_window.activate
  264.   end
  265. end


  266. =end
复制代码
梦石
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.

在本版发帖返回顶部