Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Difficulty Options
#1
Difficulty Options
SephirothSpawn
Nov 17 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.


Nothing Huge, but I've seen about 100 options system, mainly modifing system stuff. But nothing for game difficulty, so I decided to do something for Game Difficulty.

Basically, I just modifies the monsters stats based on the difficulty.

Code:
#==============================================================================
# Difficulty Options
#--------------------------------------------------------------------------
# Created By SephirothSpawn (11.11.05)
# Last Updated: 11.11.05
#==============================================================================

#==============================================================================
# Module RPG
#==============================================================================
module RPG
#=========================================================================
# Class Enemy
#=========================================================================
class Enemy
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int
attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold
#--------------------------------------------------------------------------
# * Set Bases
#--------------------------------------------------------------------------
def set_bases
@b_maxhp, @b_maxsp = @maxhp, @maxsp
@b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int
@b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva
@b_exp, @b_gold = @exp, @gold
end
end
end

#==============================================================================
# Class Difficulty Options
#==============================================================================
class Difficulty_Options
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
normal_difficulty
end
#--------------------------------------------------------------------------
# * Very Easy Difficulty
#--------------------------------------------------------------------------
def very_easy_difficulty
@constant = 0.5
set_attributes
end
#--------------------------------------------------------------------------
# * Easy Difficulty
#--------------------------------------------------------------------------
def easy_difficulty
@constant = 0.75
set_attributes
end
#--------------------------------------------------------------------------
# * Normal Difficulty
#--------------------------------------------------------------------------
def normal_difficulty
@constant = 1
set_attributes
end
#--------------------------------------------------------------------------
# * Hard Difficulty
#--------------------------------------------------------------------------
def hard_difficulty
@constant = 1.5
set_attributes
end
#--------------------------------------------------------------------------
# * Very Hard Difficulty
#--------------------------------------------------------------------------
def very_hard_difficulty
@constant = 2
set_attributes
end
#--------------------------------------------------------------------------
# * Set Attributes
#--------------------------------------------------------------------------
def set_attributes
for i in 1...$data_enemies.size
$data_enemies[i].maxhp = $data_enemies[i].b_maxhp * @constant
$data_enemies[i].maxsp = $data_enemies[i].b_maxsp * @constant
$data_enemies[i].str = $data_enemies[i].b_str * @constant
$data_enemies[i].dex = $data_enemies[i].b_dex * @constant
$data_enemies[i].agi = $data_enemies[i].b_agi * @constant
$data_enemies[i].int = $data_enemies[i].b_int * @constant
$data_enemies[i].atk = $data_enemies[i].b_atk * @constant
$data_enemies[i].pdef = $data_enemies[i].b_pdef * @constant
$data_enemies[i].mdef = $data_enemies[i].b_mdef * @constant
$data_enemies[i].eva = $data_enemies[i].b_eva * @constant
$data_enemies[i].exp = $data_enemies[i].b_exp * @constant
$data_enemies[i].gold = $data_enemies[i].b_gold * @constant
end
end
end

#==============================================================================
# Class Scene Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias new_game command_new_game
#--------------------------------------------------------------------------
# * Adds Difficulty Game Variables
#--------------------------------------------------------------------------
def command_new_game
for i in 1...$data_enemies.size
$data_enemies[i].set_bases
end
$difficulty_options = Difficulty_Options.new
new_game
end
end

#==============================================================================
# Scene_Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Alias Save Data
#--------------------------------------------------------------------------
alias new_save write_save_data
#--------------------------------------------------------------------------
# * Write Save Data
#--------------------------------------------------------------------------
def write_save_data(file)
new_save(file)
Marshal.dump($difficulty_options, file)
end
end

#==============================================================================
# Scene_Load
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Alias Read Save Data
#--------------------------------------------------------------------------
alias new_load read_save_data
#--------------------------------------------------------------------------
# * Read Save Data
#--------------------------------------------------------------------------
def read_save_data(file)
new_load(file)
$difficulty_options = Marshal.load(file)
end
end


Just add that somewhere above Main.

To change the difficulty, just use a call script with this:

Code:
$difficulty_options.very_easy_difficulty
$difficulty_options.easy_difficulty
$difficulty_options.normal_difficulty
$difficulty_options.hard_difficulty
$difficulty_options.very_hard_difficulty

You can Modify the Enemies Stat Percentages, just look into class Difficulty_Options under each difficulty option.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Enemies Level UP and Game Difficulty Options Combined DrakoShade 0 2,112 03-27-2006, 01:00 PM
Last Post: DrakoShade
  The options system Sheol 0 1,962 09-26-2005, 01:00 PM
Last Post: Sheol



Users browsing this thread: