Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] Difficulty Script Please?

Started by Karo Rushe, March 21, 2007, 02:31:05 PM

0 Members and 1 Guest are viewing this topic.

Karo Rushe

Is there a way to make a Script that makes one decide the Difficulty level?
As in Easy, Normal, Hard, Nightmare, etc.?

And one that doesn't have like a Hundred useless lines...

Blizzard

I WAS going to say Seph's script before I read the 3rd sentence. What do you want to become harder in your game? Taking more damage, getting less EXP/Gold, etc...?
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

Quote from: Blizzard on March 21, 2007, 03:01:25 PM
I WAS going to say Seph's script before I read the 3rd sentence. What do you want to become harder in your game? Taking more damage, getting less EXP/Gold, etc...?
Taking More Damage, Less EXP/Gold, Monsters with Bigger Def and Lower Stats. =D

Blizzard

Manipulating the damage would be enough to make it look like enemies are stronger. By how many % do you want the enemy damage to increase and by how many % do you want the actor damage to decrease?
If you want everything, this would require more indepth editing of your scripts.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

Quote from: Blizzard on March 22, 2007, 12:55:12 PM
Manipulating the damage would be enough to make it look like enemies are stronger. By how many % do you want the enemy damage to increase and by how many % do you want the actor damage to decrease?
If you want everything, this would require more indepth editing of your scripts.
ENemies Increases By 30% Actors Decreases by 20%

italianstal1ion

[spoiler]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ?????? ? KGC_BattleDifficulty?
#_/----------------------------------------------------------------------------
#_/  ?????????????????
#_/  (?????????????[MenuAlter][TitleOption]??)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ? ???????? ?
#==============================================================================

module KGC
  # ??????
  #  ?"??", HP, SP, ????, EXP, ????, ?????????
  #  ?????????(???)?
  BD_DIFFICULTY_LIST = [
    ["Rookie",   60,  50,  60, 100, 100, 100], #set like this; ["Name",  HP, SP, ***, EXP, ***,***]
    ["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 #Difficulty if none is chosen
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





#===================================================
#Scene_difficult_menu by panchokoster
#===================================================

module DIFFICULT
  SPRITESET_TYPE = 1 #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 difficulty level for kids") #"Easy"
  when 2
   @window_help.update("The default 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 = $fontface
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 = $fontface
   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 = $fontface
   self.contents.font.size = 20
   self.contents.draw_text(0, 0, 210, 32, "Choose the difficult Level... ")
  end

end
[/spoiler]

stats are like so; ["Name",  HP, SP, STATS, EXP/GOLD, ITEM,***]

"Name" = Name of difficulty
These are set in %s so in rookie u can see the HP of the monsters are at 50%
STATS = agility, strength, etc. (by percent)
EXP/GOLD = the expierience or gold amount from monsters percentage
ITEM = Item gain percentage
and the last one im not sure... Well I might have these out of order then :/

Karo Rushe

Can I ask who made this Script?

Blizzard

It was made by KGC.
My script wouldn't have taken half of those lines. =/ Want me still to make it or are you gonna use KGC's? I think Damage, Gold and Exp would be the only ones that make some real sense. Sure, Item drop is fine, too, but I usually get annoyed if every little aspect of a game gets harder if you're playing a harder mode. =/ It might be a matter of taste though.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

Quote from: Blizzard on March 23, 2007, 10:31:54 AM
It was made by KGC.
My script wouldn't have taken half of those lines. =/ Want me still to make it or are you gonna use KGC's? I think Damage, Gold and Exp would be the only ones that make some real sense. Sure, Item drop is fine, too, but I usually get annoyed if every little aspect of a game gets harder if you're playing a harder mode. =/ It might be a matter of taste though.
I Would like it to be made by Blizzard. I think your idea on Damage, Gold and Exp are more Reasonable.
Now that I think about it, I might get annoyed with a Boss That has a lot of Defence and suddenly The Harder it is, and it gains more Defence, the more annoying it becomes. :D

Blizzard

Alright, Damage, Gold and Exp. If I find the time, I can even do it today and post it already tomorrow. ;)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

Thanks.

If there's a way to also call a Scrupt to activate a different switch for each difficulty?

Blizzard

I was going put that in anyway.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

I like that, that way, I can add different things in Each difficulty Level.

Trenzer

I've been looking for a script like this for awhile now, can't wait for Blizzard's version though.
Beauty exists so that someone can tarnish it... Love exists to be lost...Innocence exists to be stolen... Souls exist to be corrupted...

Karo Rushe


Quote from: Trenzer on March 25, 2007, 02:22:48 AM
I've been looking for a script like this for awhile now, can't wait for Blizzard's version though.
:-\ I guess I wasn't the only one then.

Trenzer

Beauty exists so that someone can tarnish it... Love exists to be lost...Innocence exists to be stolen... Souls exist to be corrupted...

italianstal1ion

another one of my submitted scripts foiled by blizzard...

its a good thing though ;)

Blizzard

Ok, I added it in v4.5b of Tons of Add-ons, since it was under 200 lines. =P
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

 :P Now that was Fast.

Thanx Blizzard.

:)

Solved? Add [RESOLVED] to topic title
Watch out for: HaloOfTheSun

Blizzard

Yesterday when I came home I thought "Hm, I have to learn now... Meh, I'll make the script in 1~1.5 hours and then I'll learn. ^^"
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!