Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Difficult-Unlocker v.2

Difficulty script + Difficult-Unlocker v.1

KCG_BattleDifficulty http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/frame.html

dibujocb7.jpg

dibujo2df8.jpg

just add the two scripts above main

you can change the background at this line
SPRITESET_TYPE = 2 #choose spriteset type, 1=>title screen, 2=>picture, 3+map
PICTURE_NAME = "picture name" #choose spriteset type 2 to use, put the image in yours pictures folder

thanks to Trickster, SephirothSpawn, and dubealex for the tutorials
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#_/    â—†æˆ¦é—˜é›£æ˜“度 - KGC_BattleDifficultyâ—†

#_/----------------------------------------------------------------------------

#_/  æˆ¦é—˜é›£æ˜“åº¦ã®è¨­å®šæ©Ÿèƒ½ã‚’è¿½åŠ ã—ã¾ã™ã€‚

#_/  (ãƒ¡ãƒ‹ãƒ¥ãƒ¼ç­‰ã«è¡¨ç¤ºã™ã‚‹å ´åˆã¯[MenuAlter][TitleOption]参照)

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

 

#==============================================================================

# ★ ã‚«ã‚¹ã‚¿ãƒžã‚¤ã‚ºé …ç›® ★

#==============================================================================

 

module KGC

  # ◆難易度配列

  #  â‰ª"名称", HP, SP, 他能力値, EXP, ゴールド, トレジャー出現率≫

  #  å„é …ç›®ã®å€çŽ‡ã‚’æŒ‡å®š(百分率)。

  BD_DIFFICULTY_LIST = [

    ["Rookie",   60,  50,  60, 100, 100, 100],

    ["Easy",     80,  80,  70, 100, 100, 100],

    ["Normal",  100, 100, 100, 100, 100, 100],

    ["Hard",    150, 130, 120, 100, 100, 100],

    ["Mania",   200, 180, 150, 100, 100, 100],

    ["Unknown", 300, 260, 200, 100, 100, 100],

    ["Divine",  500, 400, 300, 100, 100, 100]

  ]

  # ◆初期難易度

  #  BD_DIFFICULTY_LIST のインデックス。

  BD_INITIAL_DIFFICULTY = 2

end

 

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

 

$imported = {} if $imported == nil

$imported["BattleDifficulty"] = true

 

module Difficulty

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

  # ● 難易度設定取得

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

  def self.get

    # 難易度設定を返す

    return KGC::BD_DIFFICULTY_LIST[$game_system.difficulty]

  end

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

  # ● 難易度設定変更

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

  def self.set(index)

    # 範囲外ならば変更しない

    return if index < 0 || index >= KGC::BD_DIFFICULTY_LIST.size

    $game_system.difficulty = index

  end

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

  # ● 能力値補正済みエネミー取得

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

  def self.get_revised_enemy(enemy)

    en = enemy.clone

    diff = self.get

    en.maxhp = en.maxhp * diff[1] / 100

    en.maxsp = en.maxsp * diff[2] / 100

    en.str   = en.str   * diff[3] / 100

    en.dex   = en.dex   * diff[3] / 100

    en.agi   = en.agi   * diff[3] / 100

    en.int   = en.int   * diff[3] / 100

    en.atk   = en.atk   * diff[3] / 100

    en.pdef  = en.pdef  * diff[3] / 100

    en.mdef  = en.mdef  * diff[3] / 100

    en.exp   = en.exp   * diff[4] / 100

    en.gold  = en.gold  * diff[4] / 100

    if en.treasure_prob < 100

      en.treasure_prob = [en.treasure_prob * diff[5] / 100, 100].min

    end

    return en

  end

end

 

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

 

#==============================================================================

# â–  Game_System

#==============================================================================

 

class Game_System

  attr_accessor :difficulty  # 難易度

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

  # ● オブジェクト初期化

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

  alias initialize_KGC_BattleDifficulty initialize

  def initialize

    # 元の処理を実行

    initialize_KGC_BattleDifficulty

 

    @difficulty = KGC::BD_INITIAL_DIFFICULTY

  end

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

  # ● 難易度一覧

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

  def difficulty_list

    return KGC::BD_DIFFICULTY_LIST

  end

end

 

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

 

#==============================================================================

# â–  Game_Enemy

#==============================================================================

 

class Game_Enemy < Game_Battler

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

  # ● 基本 MaxHP の取得

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

  alias base_maxhp_KGC_BattleDifficulty base_maxhp

  def base_maxhp

    n = base_maxhp_KGC_BattleDifficulty

    n *= Difficulty.get[1]

    return n / 100

  end

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

  # ● 基本 MaxSP の取得

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

  alias base_maxsp_KGC_BattleDifficulty base_maxsp

  def base_maxsp

    n = base_maxsp_KGC_BattleDifficulty

    n *= Difficulty.get[2]

    return n / 100

  end

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

  # ● 基本腕力の取得

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

  alias base_str_KGC_BattleDifficulty base_str

  def base_str

    n = base_str_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本器用さの取得

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

  alias base_dex_KGC_BattleDifficulty base_dex

  def base_dex

    n = base_dex_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● åŸºæœ¬ç´ æ—©ã•ã®å–å¾—

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

  alias base_agi_KGC_BattleDifficulty base_agi

  def base_agi

    n = base_agi_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本魔力の取得

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

  alias base_int_KGC_BattleDifficulty base_int

  def base_int

    n = base_int_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本攻撃力の取得

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

  alias base_atk_KGC_BattleDifficulty base_atk

  def base_atk

    n = base_atk_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本物理防御の取得

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

  alias base_pdef_KGC_BattleDifficulty base_pdef

  def base_pdef

    n = base_pdef_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本魔法防御の取得

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

  alias base_mdef_KGC_BattleDifficulty base_mdef

  def base_mdef

    n = base_mdef_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● 基本回避修正の取得

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

  alias base_eva_KGC_BattleDifficulty base_eva

  def base_eva

    n = base_eva_KGC_BattleDifficulty

    n *= Difficulty.get[3]

    return n / 100

  end

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

  # ● EXP の取得

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

  alias exp_KGC_BattleDifficulty exp

  def exp

    n = exp_KGC_BattleDifficulty

    n *= Difficulty.get[4]

    return n / 100

  end

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

  # ● ゴールドの取得

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

  alias gold_KGC_BattleDifficulty gold

  def gold

    n = gold_KGC_BattleDifficulty

    n *= Difficulty.get[5]

    return n / 100

  end

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

  # ● トレジャー出現率の取得

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

  alias treasure_prob_KGC_BattleDifficulty treasure_prob

  def treasure_prob

    n = treasure_prob_KGC_BattleDifficulty

    if n < 100

      n *= Difficulty.get[6]

      return [n / 100, 100].min

    else

      return n

    end

  end

end
Code:
 

#===================================================

#Scene_difficult_menu by panchokoster

#===================================================

 

module DIFFICULT

  SPRITESET_TYPE = 2 #choose spriteset type, 1=>title screen, 2=>picture, 3+map

  PICTURE_NAME = "picture name" #choose spriteset type 2 to use, put the image in yours pictures folder

end

 

 

 

 class Scene_Title

  alias old_command_new_game command_new_game

  def command_new_game

    old_command_new_game

    $scene = Scene_select_yes_no.new

  end

end

 

 

class Scene_select_yes_no

  

 

  def initialize(menu_index = 0)

   @menu_index = menu_index 

  end  

 

  def main

   case DIFFICULT::SPRITESET_TYPE

     when 1

      @sprite = Sprite.new

      @sprite.bitmap = RPG::Cache.title($data_system.title_name)

     when 2

      @sprite = Sprite.new

      @sprite.bitmap = RPG::Cache.picture(DIFFICULT::PICTURE_NAME)

     when 3

       @spriteset = Spriteset_Map.new

      

   end

   @window_q=Window_question.new 

   @window_q.x = 200

   @window_q.y = 220-64

 

     s1 = "yes"

     s2 = "not right now"

     

   @window_yes_no = Window_Command.new(200, [s1,s2]) 

   @window_yes_no.y = 220

   @window_yes_no.x = 220

   @window_yes_no.index = @menu_index

      

   Graphics.transition

   loop do

   Graphics.update

   Input.update

   update 

   if $scene != self

     break

     end

   end

   Graphics.freeze

   @window_yes_no.dispose

   @window_q.dispose

    case DIFFICULT::SPRITESET_TYPE

    when 1..2

    @sprite.bitmap.dispose

    @sprite.dispose

    when 3

     @spriteset.dispose

 

   

   end

  end

 

  def update

     @window_yes_no.update 

  

  if Input.trigger?(Input::C)   

   case @window_yes_no.index 

  when 0 

    yes

  when 1

    no

    end  

   end

  end

 

  def yes

   $game_system.se_play($data_system.decision_se)

   $scene = Scene_difficult_menu.new

  end

  

  def no

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(2) 

   $scene = Scene_Map.new 

  end

 

end

 

 

 

#===================================================

#Scene_difficult_menu

#===================================================

class Scene_difficult_menu

 

  def initialize(menu_index = 0)

   @menu_index = menu_index 

  end  

 

  def main

    

   case DIFFICULT::SPRITESET_TYPE

     when 1

      @sprite = Sprite.new

      @sprite.bitmap = RPG::Cache.title($data_system.title_name)

     when 2

      @sprite = Sprite.new

      @sprite.bitmap = RPG::Cache.picture(DIFFICULT::PICTURE_NAME)

     when 3

       @spriteset = Spriteset_Map.new

   end

   @window_q2 = Window_question2.new 

   @window_q2.x = 50

   @window_q2.y = 125-64

   @window_help = Window_Help_dif_menu.new 

   @window_help.update(" ") 

     s1 = "Rookie"

     s2 = "Easy"

     s3 = "Normal"

     s4 = "Hard"

     s5 = "Mania"

     s6 = "Unknown"

     s7 = "Divine"

   @window_help.x = 50

   @window_help.y = 125

   @window_command_dif = Window_Command.new(200, [s1,s2,s3,s4,s5,s6,s7]) 

   @window_command_dif.y = 114+75

   @window_command_dif.x = 220

   @window_command_dif.index = @menu_index

 

   Graphics.transition

   loop do

   Graphics.update

   Input.update

   update 

   if $scene != self

     break

    end

  end 

 

#Execute when exiting the scene:

   Graphics.freeze

   @window_command_dif.dispose

   @window_help.dispose

   @window_q2.dispose

   case DIFFICULT::SPRITESET_TYPE

   when 1..2 

    @sprite.bitmap.dispose

    @sprite.dispose

   when 3

    @spriteset.dispose

 

   end

  end

 

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

 

  def update

  

          @window_command_dif.update 

   case @window_command_dif.index 

  when 0  

   @window_help.update("The minimal difficulty only for losers") #"Rookie"

  when 1

   @window_help.update("An easy difficult level for kids") #"Easy"

  when 2

   @window_help.update("The defaut game difficluty") #"Normal"

  when 3

    @window_help.update("Start fighting stronger monsters") #"Hard"

  when 4

   @window_help.update("Maniac difficult level, only for advanced gamers") #"Mania"

  when 5

    @window_help.update("????")#"Unknown"

  when 6

    @window_help.update("Master the game fighting the strongest monsters")#"Divine"

   end  

  

  #THIS IS FOR THE OPTION FUNCTIONS:

   if Input.trigger?(Input::C) 

   case @window_command_dif.index 

  when 0 

    rookie

  when 1

    easy

  when 2

    normal 

  when 3

    hard

  when 4

    mania

  when 5

    unknown

  when 6

    divine

    end  

   end

  end

 

  def rookie #s1

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(0)

   $scene = Scene_Map.new

  end  

 

  def easy #s2

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(1)

   $scene = Scene_Map.new

  end  

 

  def normal #s3

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(2) 

   $scene = Scene_Map.new 

  end

 

  def hard #s4

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(3)  

   $scene = Scene_Map.new

  end 

 

  def mania #s5

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(4)  

   $scene = Scene_Map.new

  end 

 

  def unknown #s6

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(5) 

   $scene = Scene_Map.new

  end 

 

  def divine #s7

   $game_system.se_play($data_system.decision_se)

   Difficulty.set(6)

   $scene = Scene_Map.new

  end

 

 

end #of the Scene 

 

 

#===================================================

#Window_Help_dif_menu 

#===================================================

class Window_Help_dif_menu < Window_Base  

    

def initialize 

super(0, 0, 540,64)

self.contents = Bitmap.new(width-32, height-32)

self.contents.font.name = "Harlow Solid Italic"

self.contents.font.size = 20

end

 

def update(help_text) 

  self.contents.clear 

  self.contents.draw_text(0, 0, 440, 32, help_text) 

end

 

end 

 

class Window_question < Window_Base

 

  def initialize 

   super(0, 0, 240,64)

   self.contents = Bitmap.new(width-32, height-32)

   self.contents.font.name = "Harlow Solid Italic"

   self.contents.font.size = 20

   self.contents.draw_text(0, 0, 210, 32, "    Change game difficulty?")

  end

 

end 

 

class Window_question2 < Window_Base

 

  def initialize 

   super(0, 0, 240,64)

   self.contents = Bitmap.new(width-32, height-32)

   self.contents.font.name = "Harlow Solid Italic"

   self.contents.font.size = 20

   self.contents.draw_text(0, 0, 210, 32, "Choose the difficult Level... ")

  end

 

end 

 
 
Yeah. See that grid at the top, where there are rows of six numbers? Those're the percentages the enemy stats are multiplied by. The first controls HP, the second SP, the third all of the stats, the fourth EXP, the fifth gold, the sixth chances of getting an item.

So on "Divine" enemes get 5 times more HP, 4 times more SP, all stats are trebled, but you get the same EXP, gold and chance of getting an item as on normal mode.
 

Kaoii

Member

Would it be possible to have events ingame that will only appear on a certain difficulty. For example, lets say you have an NPC or an autorun event that you only want to appear on "Divine" difficulty, would that be possible? If so, how?

If it is possible, I will definately use this in my game.
 

Kaoii

Member

I tried to test this, but when using the "my first script" script, this is the error I get after hitting New Game:

"line 27: NoMethodError occurred.
undefined method 'DIFFICULT' for #<Scene_select_yes_no:0x4187418 @menu_index=0>"

any suggestions?
 

Kaoii

Member

bleh, just noticed that in the script, my bad >.<

edit: even after removing the smilies in the script posted and replacing them with the letter "S", i still get the same error.
 

Kaoii

Member

I'm no scripter, so excuse me if this a dumb question =p

When you hit "New Game" and it prompts you whether or not to change the difficulty, it cancels out the title BGM and goes straight into the next map's BGM (and if that map's BGM is the title BGM, it starts over regardless). What do I need to change/edit/replace/whatever to keep the BGM going?
 
I'm sure you have to comment out just one line (as I did with my Scene_Title) related to audio, but I don't really know where in this script.

Anyway, let's say a player choose Easy difficulty (while the only difficulty available is Easy). After s/he beats the game once, s/he will unlock Normal difficulty. And so on, beating Normal will reveal Hard, and Hard reveals Nightmare (just as Diablo II and Dungeon Siege II do, if you play either). Can I do this with this script? If I can, how?

Thank you.
 
This was a hell of a necro post.... Don't do that if you don't have problem/suggestions to the scripter to solve/add....
 
thanks RoaringSasuke :)
and BTW the ver.2 is almost done sure i`ll post it tomorrow, and in the new ver. you unlock a new difficulty when you end the game something like...
Èxsharaèn :

let's say a player choose Easy difficulty (while the only difficulty available is Easy). After s/he beats the game once, s/he will unlock Normal difficulty. And so on, beating Normal will reveal Hard, and Hard reveals Nightmare (just as Diablo II and Dungeon Siege II do, if you play either).
 
Hey, I'm just wondering how I would go about disabling the choice where it says "Change Game Difficulty?"? I want mine to just simply go to the list of choices to set the difficulty.

I've tried disabling the part where it starts to define the menu choice, but it obviously can't figure it out.. any help?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top