The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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
 
Thread Tools
  #1    
Old May 2nd, 2013, 02:19 PM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Code:
#===============================================================================
# * 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
  VARIABLE=90 
  
  def self.currentMode
    difficultHash={}
    
    
    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
  end 
  
  def self.applyLevelProcedure(level,procedure)
    return procedure ? 
      [[procedure.call(level).floor,MAXIMUMLEVEL].min,1].max : level
  end
  
  def self.applyMoneyProcedure(money)
    difficultSelected = self.currentMode
    return difficultSelected && difficultSelected.moneyProcedure ? 
      [difficultSelected.moneyProcedure.call(money).floor,0].max : money
  end
  
  def self.loadTrainer(trainerid,trainername,partyid=0)
    trainer = nil
    procedure = nil
    difficultSelected = self.currentMode
    if difficultSelected
      trainer=pbLoadTrainerDifficult(trainerid,trainername,
        partyid + difficultSelected.idJump) if difficultSelected.idJump>0
      procedure = difficultSelected.levelProcedure
    end
    return trainer ? trainer : pbLoadTrainerDifficult(
      trainerid,trainername,partyid,procedure)
  end
    
  private
  class Difficult
    attr_accessor :idJump
    attr_accessor :levelProcedure
    attr_accessor :moneyProcedure
    
    def initialize
      @idJump = 0
      @levelProcedure = nil
      @moneyProcedure = nil
    end  
  end  
end

def pbLoadTrainer(trainerid,trainername,partyid=0)
  return DifficultModes.loadTrainer(trainerid,trainername,partyid)
end
__________________

Last edited by FL; June 25th, 2014 at 05:22 PM.
Reply With Quote
  #2    
Old May 2nd, 2013, 07:10 PM
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Very cool. I will test this when I get a chance
__________________
Reply With Quote
  #3    
Old May 7th, 2013, 04:16 AM
Dylanrockin's Avatar
Dylanrockin
Mysterious Trainer
 
Join Date: May 2011
Gender: Male
Nature: Timid
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.
__________________
Visit my YouTube Channel: http://www.youtube.com/user/Pokemonmaster212
My Pokemon Symphonic Horizon RPG Maker XP Game: http://www.pokecommunity.com/showthr...66#post8016366
Reply With Quote
  #4    
Old May 7th, 2013, 07:26 AM
tylerab01's Avatar
tylerab01
Pokemon AquaHarmony
 
Join Date: Apr 2009
Location: France
Gender: Male
Nature: Bold
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
  #5    
Old May 9th, 2013, 04:09 AM
TACHAN
 
Join Date: Jan 2010
Gender: Female
*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
  #6    
Old May 11th, 2013, 11:29 AM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Quote:
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
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:25 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.