< >
Hello, guest! Please log in or register.

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials Essentials script Difficult Modes


Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply Post Reply
Thread Tools
Old May 2nd, 2013 (2:19 PM). Edited June 25th, 2014 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
Join Date: Sep 2010
Gender: Male
Posts: 1,581
# * Difficult Modes - by FL (Credits will be apreciated)
# This script is for Pokémon Essentials. It allows a easy way to make difficult
# modes like the ones on Key System in BW2.
# You can set difficult levels that change the opponent parties to others that
# you can define and/or multiplier the levels of the pokémon and/or change
# the money earned after the battles. This script doesn't affect wild pokémon,
# but affects partner trainers.
# To this script works, put it above main.
# In PokeBattle_Battle script section, before line (use Ctrl+F to find it)
# 'oldmoney=self.pbPlayer.money' add line
# 'maxlevel = DifficultModes.applyMoneyProcedure(maxlevel)'.
# In PokemonTrainers script section, change line
# 'def pbLoadTrainer(trainerid,trainername,partyid=0)' to
# 'def pbLoadTrainerDifficult(trainerid,trainername,partyid=0,procedure=nil)'. 
# Change line 'level=poke[1]' to
# 'level = DifficultModes.applyLevelProcedure(poke[1],procedure)'.
# You can see instructions for how to use in the 'def self.currentMode'.
# There two default difficulties already defined in this method,
# Easy Mode and Hard Mode, just follow the models.
module DifficultModes
  # Variable number that control the difficult.
  # To use a different variable, change this. 0 deactivates this script
  def self.currentMode
    easyMode = Difficult.new
    # partyid (six parameter) number for trainer than can have other party.
    # Trainers loaded this way ignores the levelProcedure.
    # IN THIS EXAMPLE: If you start a battle versus YOUNGSTER Ben team 1,
    # the game searches for the YOUNGSTER Ben team 101 (100+1),
    # if the game founds it loads instead of the team 1.
    easyMode.idJump = 100
    # A formula to change all trainers pokémon level. 
    # This affects money earned in battle.
    # IN THIS EXAMPLE: Every opponent pokémon that aren't found by idJump value
    # have the level*0.8 (round down). A pokémon level 6 will be level 4.
    easyMode.levelProcedure = proc{|level|
      next level*0.8
    # A formula to change all trainers pokémon money.
    # This is the last formula to apply.
    # IN THIS EXAMPLE: Multiplier the money given by the opponent by 1.3 (round
    # down), so if the final money earned is 99, the money will be 128.
    easyMode.moneyProcedure = proc{|money|
      next money*1.3
    # You can delete any of these three attributes if you didn't want them.
    # The Hash index is the value than when are in the VARIABLE number value,
    # the difficult will be ON.
    # IN THIS EXAMPLE: Only when variable 90 value is 1 than this changes
    # will occurs 
    difficultHash[1] = easyMode
    hardMode = Difficult.new
    hardMode.idJump = 200
    hardMode.levelProcedure = proc{|level|
      next level*1.2 + 1
    hardMode.moneyProcedure = proc{|money|
      next money*0.8
    difficultHash[2] = hardMode
    return DifficultModes::VARIABLE>0 ? 
      difficultHash[pbGet(DifficultModes::VARIABLE)] : nil
  def self.applyLevelProcedure(level,procedure)
    return procedure ? 
      [[procedure.call(level).floor,MAXIMUMLEVEL].min,1].max : level
  def self.applyMoneyProcedure(money)
    difficultSelected = self.currentMode
    return difficultSelected && difficultSelected.moneyProcedure ? 
      [difficultSelected.moneyProcedure.call(money).floor,0].max : money
  def self.loadTrainer(trainerid,trainername,partyid=0)
    trainer = nil
    procedure = nil
    difficultSelected = self.currentMode
    if difficultSelected
        partyid + difficultSelected.idJump) if difficultSelected.idJump>0
      procedure = difficultSelected.levelProcedure
    return trainer ? trainer : pbLoadTrainerDifficult(
  class Difficult
    attr_accessor :idJump
    attr_accessor :levelProcedure
    attr_accessor :moneyProcedure
    def initialize
      @idJump = 0
      @levelProcedure = nil
      @moneyProcedure = nil

def pbLoadTrainer(trainerid,trainername,partyid=0)
  return DifficultModes.loadTrainer(trainerid,trainername,partyid)
Reply With Quote

Relevant Advertising!

Old May 2nd, 2013 (7:10 PM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
Join Date: Dec 2011
Gender: Male
Posts: 647
Very cool. I will test this when I get a chance
Reply With Quote
Old May 7th, 2013 (4:16 AM).
Dylanrockin's Avatar
Dylanrockin Dylanrockin is offline
That guy
Join Date: May 2011
Age: 20
Gender: Male
Nature: Timid
Posts: 277
I got an error when I loaded up the game, I got this error: Script 'DifficultyModes' line 75 SyntaxError occurred. I'm not sure what I did, but all I did was renamed hardmode to Maniamode, I'm not sure that I was supposed to do that.
Reply With Quote
Old May 7th, 2013 (7:26 AM).
tylerab01's Avatar
tylerab01 tylerab01 is offline
Pokemon AquaHarmony
Join Date: Apr 2009
Location: France
Gender: Male
Nature: Bold
Posts: 165
You will have to change all DifficulyModes in each script to Mainamode.

The reason you are getting an error is because the script is pointing towards DifficultyModes and since the resource is not there you are getting an error. So if you are going to change a little part of the script you will have to check and change all of the components.

Hope that helps...

Reply With Quote
Old May 9th, 2013 (4:09 AM).
TACHAN TACHAN is offline
Join Date: Jan 2010
Gender: Female
Posts: 197
*I deactivated the second attribute because I do not want to have low levels.

Normal/Easy Mode: Rapidash lv59
Hard Mode: Rapidash lv73

*It without any trainer adds to the PBS with the team 101

Is not level change too much?
Reply With Quote
Old May 11th, 2013 (11:29 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
Join Date: Sep 2010
Gender: Male
Posts: 1,581
Originally Posted by TACHAN View Post
*I deactivated the second attribute because I do not want to have low levels.

Normal/Easy Mode: Rapidash lv59
Hard Mode: Rapidash lv73

*It without any trainer adds to the PBS with the team 101

Is not level change too much?
I guess that is ok, remember that your pokémon earn extra EXP for the others trainers. Regardless, you can freely change the formula. Change line 'next level*1.2 + 1' to 'next level*1.15 + 1' or even 'next level*1.1 + 1' to lower the gain from hard mode.
Reply With Quote
Reply Post Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

  All times are GMT -8. The time now is 1:14 PM.

Contact Us Archive Privacy Statement Terms of Service Top