03-14-2008, 01:00 PM
(This post was last modified: 05-19-2017, 04:14 AM by DerVVulfman.)
Difficulity Level System
by Ferredingu
Posted by Ekhart
Mar 14, 2008
THIS SCRIPT OS NOT MINE! IT'S ORIGINALLY MADE BY FERREDINGU
This script allows you to create difilcuity levels (like in Baldur's Gate).
Instructions:
Script:
DLS
Scene_Title
Credits to:
Ferredingu (he made that script, i've just translated it into english)
by Ferredingu
Posted by Ekhart
Mar 14, 2008
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
THIS SCRIPT OS NOT MINE! IT'S ORIGINALLY MADE BY FERREDINGU
This script allows you to create difilcuity levels (like in Baldur's Gate).
Instructions:
Instructions
Script:
DLS
Code:
##########################################################
######### Difficulity Level Script #######################
######### by Ferredingu (Partavis) #######################
######### 1st January 2008 r #######################
######### ver. 1.0 #######################
##########################################################
#
#
# !!!WARNING!!!
# Before using script, copy "Data" folder from your project.
# Script is being still testing and it is possible to break this
# very important files
#
# Instruction
# 1. Open "Data" folder in your project.
# 2. Copy "Items", "Weapons", "Armors", "Enemies", "Skills" files.
# 3. Paste them in the same folder ("Data"), but don't replace them.
# 4. Your OS should name them as copies ("Copy of Items" etc)
# change name of files by deleting "Copy of " and addind
# "PB" word, ("ItemsBP")
# 5. Copy "Scene_Title" from this porject (or just copy things that are added here)
# 6. Copy this script ("DLS") to your one (paste above main)
#
# Creating new levels
# 1. Copy all variables that are below (all things between two - you have to
# change as you wish. They are in %s, so 100 means normal level, 50- 2x weaker)
# skills = [-SP Cost-,-Power-,-ATK F-,-EVA F-,-STR F-,-DEX F-,-AGI F-,-INT F-,-Hit rate-,-PDEF F-,-MDEF F-,-Variance-]
# items = [-Price-,-Param Inc-,-Rcvr HP%-,-Rcvr HP-,-Rcvr SP%-,-Rcvr SP-,-Rcvr SP-,-PDEF-F-,-MDEF-F-,-Veriance-]
# weapons = [-Price-,-ATK-,-PDEF-,-MDEF-,-STR+-,-DEX+-,-AGI+-,-INT+-]
# armors = [-Price-,-ATK-,-PDEF-,-MDEF-,-STR+-,-DEX+-,-AGI+-,-INT+-]
# enemies = [-MaxHP-,-MaxSP-,-STR-,-DEX-,-AGI-,-INT-,-ATK-,-PDEF-,-MDEF-,-EVA-,-EXP-,-Gold-]
# st-no- = [ "-name-",skills, items, weapons, armors, enemies ]
# 2. Paste it under "def main"
# 3. Add do @st variable your own difficulity level (st-no-).
#
# Calling script:
# $scene = Scene_SST.new
#
# If you're changing your level, no matter that you start new game or load it,
# level will be exatcly this one you've set.
#
# Script is changing stats of Items, Weapons, Armors, Skills and Enemies
#
# Script SHOULD be compatible with any Battle Systems that get data from RMXP's
# Database
class Scene_SST
def initialize(sk=0)
@sk = sk
$data_skillsBP = load_data("Data/Skills.rxdata")
$data_itemsBP = load_data("Data/Items.rxdata")
$data_weaponsBP = load_data("Data/Weapons.rxdata")
$data_armorsBP = load_data("Data/Armors.rxdata")
$data_enemiesBP = load_data("Data/Enemies.rxdata")
#********************************************
$data_skills = load_data("Data/SkillsBP.rxdata")
$data_items = load_data("Data/ItemsBP.rxdata")
$data_weapons = load_data("Data/WeaponsBP.rxdata")
$data_armors = load_data("Data/ArmorsBP.rxdata")
$data_enemies = load_data("Data/EnemiesBP.rxdata")
#********************************************
end
def main
#============================================================
skills = [50,150,150,150,150,150,150,150,150,150,150,150]
items = [50,150,150,150,150,150,150,150,150,150]
weapons = [50,150,150,150,150,150,150,150]
armors = [50,150,150,150,150,150,150,150]
enemies = [50,50,50,50,50,50,50,50,50,50,150,150]
st1= [ "Very Easyy",skills, items, weapons, armors, enemies ]
#============================================================
skills = [100,100,100,100,100,100,100,100,100,100,100,100]
items = [100,100,100,100,100,100,100,100,100,100]
weapons = [100,100,100,100,100,100,100,100]
armors = [100,100,100,100,100,100,100,100]
enemies = [100,100,100,100,100,100,100,100,100,100,100,100]
st2= [ "Normal",skills, items, weapons, armors, enemies ]
#=============================================================
skills = [150,50,50,50,50,50,50,50,50,50,50,50]
items = [150,50,50,50,50,50,50,50,50,50]
weapons = [150,50,50,50,50,50,50,50]
armors = [150,50,50,50,50,50,50,50]
enemies = [150,150,150,150,150,150,150,150,150,150,50,50]
st3= [ "Very Hard",skills, items, weapons, armors, enemies ]
#==============================================================
@st = [st1, st2, st3] #here you're adding/changing Difficulity Levels
komendy = []
for i in 0...@st.size
komendy << @st[i][0]
end
@command_window = Window_Command.new(160, komendy)
@command_window.index = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
end
def update
@command_window.update
if @command_window.active
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new if @sk == 0
$scene = Scene_Title.new if @sk == 1
return
end
for i in 0...@st.size
if Input.trigger?(Input::C)
case @command_window.index
when i
#skills
for w in 1...$data_skills.size
$data_skills[w].sp_cost = @st[i][1][0] * $data_skillsBP[w].sp_cost / 100
$data_skills[w].power = @st[i][1][1] * $data_skillsBP[w].power / 100
$data_skills[w].atk_f = @st[i][1][2] * $data_skillsBP[w].atk_f / 100
$data_skills[w].eva_f = @st[i][1][3] * $data_skillsBP[w].eva_f / 100
$data_skills[w].str_f = @st[i][1][4] * $data_skillsBP[w].str_f / 100
$data_skills[w].dex_f = @st[i][1][5] * $data_skillsBP[w].dex_f / 100
$data_skills[w].agi_f = @st[i][1][6] * $data_skillsBP[w].agi_f / 100
$data_skills[w].int_f = @st[i][1][7] * $data_skillsBP[w].int_f / 100
$data_skills[w].hit = @st[i][1][8] * $data_skillsBP[w].hit / 100
$data_skills[w].pdef_f = @st[i][1][9] * $data_skillsBP[w].pdef_f / 100
$data_skills[w].mdef_f = @st[i][1][10] * $data_skillsBP[w].mdef_f / 100
$data_skills[w].variance = @st[i][1][11] * $data_skillsBP[w].sp_cost / 100
end
#items
for w in 1...$data_items.size
$data_items[w].price = @st[i][2][0] * $data_itemsBP[w].price / 100
$data_items[w].parameter_points = @st[i][2][1] * $data_itemsBP[w].parameter_points / 100
$data_items[w].recover_hp_rate = @st[i][2][2] * $data_itemsBP[w].recover_hp_rate / 100
$data_items[w].recover_hp = @st[i][2][3] * $data_itemsBP[w].recover_hp / 100
$data_items[w].recover_sp_rate = @st[i][2][4] * $data_itemsBP[w].recover_sp_rate / 100
$data_items[w].recover_sp = @st[i][2][5] * $data_itemsBP[w].recover_sp / 100
$data_items[w].hit = @st[i][2][6] * $data_itemsBP[w].hit / 100
$data_items[w].pdef_f = @st[i][2][7] * $data_itemsBP[w].pdef_f / 100
$data_items[w].mdef_f = @st[i][2][8] * $data_itemsBP[w].mdef_f / 100
$data_items[w].variance = @st[i][2][9] * $data_itemsBP[w].variance / 100
end
#weapons
for w in 1...$data_weapons.size
$data_weapons[w].price = @st[i][3][0] * $data_weaponsBP[w].price / 100
$data_weapons[w].atk = @st[i][3][1] * $data_weaponsBP[w].atk / 100
$data_weapons[w].pdef = @st[i][3][2] * $data_weaponsBP[w].pdef / 100
$data_weapons[w].mdef = @st[i][3][3] * $data_weaponsBP[w].mdef / 100
$data_weapons[w].str_plus = @st[i][3][4] * $data_weaponsBP[w].str_plus / 100
$data_weapons[w].dex_plus = @st[i][3][5] * $data_weaponsBP[w].dex_plus / 100
$data_weapons[w].agi_plus = @st[i][3][6] * $data_weaponsBP[w].agi_plus / 100
$data_weapons[w].int_plus = @st[i][3][7] * $data_weaponsBP[w].int_plus / 100
end
#armors
for w in 1...$data_armors.size
$data_armors[w].price = @st[i][4][0] * $data_armorsBP[w].price / 100
$data_armors[w].pdef = @st[i][4][1] * $data_armorsBP[w].pdef / 100
$data_armors[w].mdef = @st[i][4][2] * $data_armorsBP[w].mdef / 100
$data_armors[w].eva = @st[i][4][3] * $data_armorsBP[w].eva / 100
$data_armors[w].str_plus = @st[i][4][4] * $data_armorsBP[w].str_plus / 100
$data_armors[w].dex_plus = @st[i][4][5] * $data_armorsBP[w].dex_plus / 100
$data_armors[w].agi_plus = @st[i][4][6] * $data_armorsBP[w].agi_plus / 100
$data_armors[w].int_plus = @st[i][4][7] * $data_armorsBP[w].int_plus / 100
end
#enemies
for w in 1...$data_enemies.size
$data_enemies[w].maxhp = @st[i][5][0] * $data_enemiesBP[w].maxhp / 100
$data_enemies[w].maxsp = @st[i][5][1] * $data_enemiesBP[w].maxsp / 100
$data_enemies[w].str = @st[i][5][2] * $data_enemiesBP[w].str / 100
$data_enemies[w].dex = @st[i][5][3] * $data_enemiesBP[w].dex / 100
$data_enemies[w].agi = @st[i][5][4] * $data_enemiesBP[w].agi / 100
$data_enemies[w].int = @st[i][5][5] * $data_enemiesBP[w].int / 100
$data_enemies[w].atk = @st[i][5][6] * $data_enemiesBP[w].atk / 100
$data_enemies[w].pdef = @st[i][5][7] * $data_enemiesBP[w].pdef / 100
$data_enemies[w].mdef = @st[i][5][8] * $data_enemiesBP[w].mdef / 100
$data_enemies[w].eva = @st[i][5][9] * $data_enemiesBP[w].eva / 100
$data_enemies[w].exp = @st[i][5][10] * $data_enemiesBP[w].exp / 100
$data_enemies[w].gold = @st[i][5][11] * $data_enemiesBP[w].gold / 100
end
#********************************************
file = File.open("Data/EnemiesBP.rxdata","wb")
Marshal.dump($data_enemies, file)
file.close
file = File.open("Data/SkillsBP.rxdata","wb")
Marshal.dump($data_skills, file)
file.close
file = File.open("Data/ItemsBP.rxdata","wb")
Marshal.dump($data_items, file)
file.close
file = File.open("Data/WeaponsBP.rxdata","wb")
Marshal.dump($data_weapons, file)
file.close
file = File.open("Data/ArmorsBP.rxdata","wb")
Marshal.dump($data_armors, file)
file.close
#********************************************
$data_skills = load_data("Data/SkillsBP.rxdata")
$data_items = load_data("Data/ItemsBP.rxdata")
$data_weapons = load_data("Data/WeaponsBP.rxdata")
$data_armors = load_data("Data/ArmorsBP.rxdata")
$data_enemies = load_data("Data/EnemiesBP.rxdata")
#********************************************
$scene = Scene_Map.new if @sk == 0
$scene = Scene_Title.new if @sk == 1
end
end
end
end
end
end
Scene_Title
Code:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
#********************************************
$data_skillsBP = load_data("Data/Skills.rxdata")
$data_itemsBP = load_data("Data/Items.rxdata")
$data_weaponsBP = load_data("Data/Weapons.rxdata")
$data_armorsBP = load_data("Data/Armors.rxdata")
$data_enemiesBP = load_data("Data/Enemies.rxdata")
#********************************************
#********************************************
$data_skills = load_data("Data/SkillsBP.rxdata")
$data_items = load_data("Data/ItemsBP.rxdata")
$data_weapons = load_data("Data/WeaponsBP.rxdata")
$data_armors = load_data("Data/ArmorsBP.rxdata")
$data_enemies = load_data("Data/EnemiesBP.rxdata")
#********************************************
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Difficulity"
s4 = "Shutdown"
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2
command_trudnosc
when 3 # Shutdown
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
def command_trudnosc
$game_system.se_play($data_system.decision_se)
$scene = Scene_SST.new(1)
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end
Credits to:
Ferredingu (he made that script, i've just translated it into english)