Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] Nuzlocke Mode

Notices
For all updates, view the main page.

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 January 24th, 2015 (08:59 AM). Edited June 19th, 2015 by ~JV~.
~JV~'s Avatar
~JV~ ~JV~ is offline
Dev of Pokémon Uranium
 
Join Date: Aug 2007
Location: Rio de Janeiro
Age: 21
Nature: Relaxed
Posts: 714
Send a message via Skype™ to ~JV~
Credits if used please. Enjoy! (Instructions in the script itself)

Code:
#===============================================================================
# * Nuzlocke Mode - by JV (Credits if used please)
#===============================================================================
#
# This script is for Pokémon Essentials. It adds support for the famous fan
# created Nuzlocke Mode, where Pokémon are considered dead when fainted and
# the player is only able to capture the first pokémon they spot in each map.
#
# This is script is at the same time an improvement and a simpler version of
# what I did on Pokémon Uranium, for which I'll use this new script as a base
# for the one in my game.
#
# Features included:
#   - Only one encounter per Map
#   - Optional Dubious Clause (same species encounter doesn't count)
#   - Support for connected maps (so you don't get 2 encounters in the same route)
#   - Permadeath (no healing or revive)
#
#
#==INSTRUCTIONS=================================================================
#
# To install this script it's simple, just put it above main. (yes, plug and play)
# Also: Replace lines 327, 340, 1153, 1172 of PokémonItemEffects replace:
#       "   if pokemon.hp>0"
# With:
#       "   if pokemon.hp>0 || $PokemonGlobal.nuzlocke==true" 
#
#==HOW TO USE===================================================================
#
# To use this script simply call in an event: "$PokemonGlobal.nuzlocke = true" 
#
# If you want to turn off the mode just do the same, but with false instead.
#
#==CONFIGURATION================================================================

# OPTION 1: Dubious Clause (same species encounter doesn't count)
DUBIOUSCLAUSE = true

# OPTION 2: Connected Maps (so you don't get 2 encounters in the same route)
# example: (It's an array of arrays, simple as that, just mimic the example)
=begin
NUZLOCKEMAPS = [
[5,21],
[2,7,12]
]
=end
#===============================================================================
class PokemonGlobalMetadata
  attr_accessor :nuzlocke
  attr_accessor :nuzlockeMaps
  
  alias nuzlocke_initialize initialize
  def initialize
    @nuzlocke=false
    @nuzlockeMaps=[]
    nuzlocke_initialize
  end
  
  def nuzlockeMapState(mapid)
    if !@nuzlockeMaps
      @nuzlockeMaps=[]
    end
    return 0 if @nuzlockeMaps.length==0
    for i in 0...@nuzlockeMaps.length
      if @nuzlockeMaps[i][0] == mapid
        state = @nuzlockeMaps[i][1]
        echo("(")
        echo(@nuzlockeMaps)
        echo("->")
        echo(state)
        echo(")\n")
        return state
        break
      end
    end
  end
  
  def checkDuplicates(mapid)
    return false if !@nuzlockeMaps
    for i in 0...@nuzlockeMaps.length
      if @nuzlockeMaps[i][0] == mapid
        return true
      end
    end
    return false
  end
end


class PokeBattle_Battle
  
  alias nuzlocke_ThrowPokeBall pbThrowPokeBall
  def pbThrowPokeBall(idxPokemon,ball,rareness=nil)
    if $PokemonGlobal.nuzlocke
      nuzlockeMultipleMaps
      if $PokemonGlobal.nuzlockeMapState($game_map.map_id) == 1
        pbDisplay(_INTL("But {1} already fought a wild pokemon on this area!",self.pbPlayer.name))
        return
      end
      if $PokemonGlobal.nuzlockeMapState($game_map.map_id) == 2
        pbDisplay(_INTL("But {1} already caught a pokemon on this area!",self.pbPlayer.name))
        return
      end
    end
    nuzlocke_ThrowPokeBall(idxPokemon,ball,rareness=nil)
  end
  
  alias nuzlocke_EndOfBattle pbEndOfBattle
  def pbEndOfBattle(canlose=false)
    nuzlocke_EndOfBattle
    if $PokemonGlobal.nuzlocke
      if @decision == 4
        $PokemonGlobal.nuzlockeMaps.push([$game_map.map_id,2])
      end
      if !@opponent && $PokemonGlobal.nuzlockeMapState($game_map.map_id) != 2
        $PokemonGlobal.nuzlockeMaps.push([$game_map.map_id,1]) if !DUBIOUSCLAUSE 
        $PokemonGlobal.nuzlockeMaps.push([$game_map.map_id,1]) if (DUBIOUSCLAUSE && !@battlers[1].owned)
      end
    end
  end
  
  def nuzlockeMultipleMaps
    return if !NUZLOCKEMAPS
    for i in 0...NUZLOCKEMAPS.length
      for j in 0...NUZLOCKEMAPS[i].length
        mapid = NUZLOCKEMAPS[i][j]
        if $PokemonGlobal.nuzlockeMapState(mapid) && $game_map.map_id != mapid && !$PokemonGlobal.checkDuplicates($game_map.map_id)
          if ($PokemonGlobal.nuzlockeMapState(mapid) != 0 && NUZLOCKEMAPS[i].include?($game_map.map_id))
            $PokemonGlobal.nuzlockeMaps.push([$game_map.map_id,$PokemonGlobal.nuzlockeMapState(mapid)]) 
          end
        end
      end
    end
  end
end

class PokeBattle_Pokemon  
  alias nuzlocke_heal heal
  def heal
    return if hp<=0 && $PokemonGlobal.nuzlocke
    return if egg?
    healHP
    healStatus
    healPP
  end
end  

alias nuzlocke_pbHealAll pbHealAll
def pbHealAll
  return if !$Trainer
  for i in $Trainer.party
    if $PokemonGlobal.nuzlocke
      if i.hp > 0
        i.heal
      end
    else
    i.heal
    end
  end
end
__________________
Reply With Quote
  #2    
Old January 24th, 2015 (09:40 AM).
mej71's Avatar
mej71 mej71 is offline
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Posts: 814
I know a lot of users will make use of this feature, nice work!

Also, it might be fun to add more optional clauses in, for instance a PP clause
Code:
PPCLAUSE = true

class PokeBattle_Pokemon
  alias nuzlocke_healPP healPP
  def healPP
    return if PPCLAUSE
  end
end
Reply With Quote
  #3    
Old January 24th, 2015 (03:46 PM).
~JV~'s Avatar
~JV~ ~JV~ is offline
Dev of Pokémon Uranium
 
Join Date: Aug 2007
Location: Rio de Janeiro
Age: 21
Nature: Relaxed
Posts: 714
Send a message via Skype™ to ~JV~
Quote originally posted by mej71:
I know a lot of users will make use of this feature, nice work!

Also, it might be fun to add more optional clauses in, for instance a PP clause
Code:
PPCLAUSE = true

class PokeBattle_Pokemon
  alias nuzlocke_healPP healPP
  def healPP
    return if PPCLAUSE
  end
end
Oh yeah, this is just a fundation for a Nuzlocke mode, what I had before had much more rules etc, but the code was really messy and was scattered around many Essentials scripts. It is really easy to modify/improve this .
__________________
Reply With Quote
  #4    
Old January 25th, 2015 (01:33 AM). Edited January 25th, 2015 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,461
Finally, a public Nuzlocke script! The condition for PokéCenter is well made! I suggest don't using "Replace lines 327, 340, 1153, 1172", but using a line as reference, or you need to update the script at almost every Essentials new version.

I prefer for using the map name as hash key, so this auto-fix maps with same name without needing of declaring the ids on an array, for example.
__________________
Reply With Quote
  #5    
Old February 19th, 2015 (11:20 AM).
Zeak6464's Avatar
Zeak6464 Zeak6464 is offline
The MMO bringer
 
Join Date: Mar 2013
Location: USA
Gender: Male
Nature: Calm
Posts: 338
Doesn't work for V15.... can still heal Fainted Pokemon at pokecenter
__________________
"Here one day gone the next!"
http://www.indiedb.com/games/pokemon-legends-of-kanto
Reply With Quote
  #6    
Old February 26th, 2015 (06:40 AM).
~JV~'s Avatar
~JV~ ~JV~ is offline
Dev of Pokémon Uranium
 
Join Date: Aug 2007
Location: Rio de Janeiro
Age: 21
Nature: Relaxed
Posts: 714
Send a message via Skype™ to ~JV~
Quote originally posted by Zeak6464:
Doesn't work for V15.... can still heal Fainted Pokemon at pokecenter
I made that script in a clean v15 copy, please note the "(Instructions in the script itself)" in the OP.
__________________
Reply With Quote
  #7    
Old February 26th, 2015 (07:41 AM). Edited February 26th, 2015 by kcgcrazy.
kcgcrazy kcgcrazy is offline
 
Join Date: Nov 2013
Location: Canada
Gender: Male
Posts: 112
Quote originally posted by ~JV~:
I made that script in a clean v15 copy, please note the "(Instructions in the script itself)" in the OP.
i have tried it with v15.1 and i am still able to heal fainted pokemon at a pokecenter. i followed all the steps mentioned.

EDIT : NVM it does work, i must of goofed up somewhere the first time i tried this. thanks for the great script
Reply With Quote
  #8    
Old February 26th, 2015 (10:34 AM).
Zeak6464's Avatar
Zeak6464 Zeak6464 is offline
The MMO bringer
 
Join Date: Mar 2013
Location: USA
Gender: Male
Nature: Calm
Posts: 338
Quote originally posted by kcgcrazy:
i have tried it with v15.1 and i am still able to heal fainted pokemon at a pokecenter. i followed all the steps mentioned.

EDIT : NVM it does work, i must of goofed up somewhere the first time i tried this. thanks for the great script
same here xD those little things we all miss xD
__________________
"Here one day gone the next!"
http://www.indiedb.com/games/pokemon-legends-of-kanto
Reply With Quote
  #9    
Old February 26th, 2015 (05:37 PM).
Bowlstir's Avatar
Bowlstir Bowlstir is offline
Media Arts and Game Development
 
Join Date: Apr 2008
Location: USA
Gender: Male
Nature: Adamant
Posts: 178
Great Stuff
______________
Cheers Mate
__________________


Reply With Quote
  #10    
Old March 1st, 2015 (12:35 PM).
shiney570 shiney570 is offline
 
Join Date: Aug 2014
Location: Germany
Gender: Male
Posts: 74
Wow, this is what i needed thanks!
Reply With Quote
  #11    
Old March 6th, 2015 (03:29 PM).
Bill78 Bill78 is offline
 
Join Date: Feb 2015
Gender: Female
Posts: 2
Could you tell me how to use the CONFIGURATION bit?
where do I put " DUBIOUSCLAUSE = true "?
I put it in a script in the same place as " $PokemonGlobal.nuzlocke = true " is that correct because its not working for me.
----This is the error---
Exception: nameerror
message:uninitialized constant pokebattle_battle::dubiousclause
nuzlocke:70:in:
pbendofbattle
pbstartbattle
pbwildbbattle
pbscenestandby
pbwildbattle
pbbattleanimation
pbwildbattle
pbbattleonsteptaken
pbsteptaken

----------
This error shows up right after a battle ( run or kill ).
I have tried lots of different things but nothing seems to fix it.
Please message back.
Reply With Quote
  #12    
Old March 6th, 2015 (07:35 PM).
~JV~'s Avatar
~JV~ ~JV~ is offline
Dev of Pokémon Uranium
 
Join Date: Aug 2007
Location: Rio de Janeiro
Age: 21
Nature: Relaxed
Posts: 714
Send a message via Skype™ to ~JV~
Quote originally posted by Bill78:
Could you tell me how to use the CONFIGURATION bit?
where do I put " DUBIOUSCLAUSE = true "?
I put it in a script in the same place as " $PokemonGlobal.nuzlocke = true " is that correct because its not working for me.
----This is the error---
Exception: nameerror
message:uninitialized constant pokebattle_battle::dubiousclause
nuzlocke:70:in:
pbendofbattle
pbstartbattle
pbwildbbattle
pbscenestandby
pbwildbattle
pbbattleanimation
pbwildbattle
pbbattleonsteptaken
pbsteptaken

----------
This error shows up right after a battle ( run or kill ).
I have tried lots of different things but nothing seems to fix it.
Please message back.
You don't need to put it anywhere, just leave as it is or change to false (in the script itself) if you want. Please, read the instructions carefully, they are really simple.
__________________
Reply With Quote
  #13    
Old March 7th, 2015 (03:33 PM).
Bill78 Bill78 is offline
 
Join Date: Feb 2015
Gender: Female
Posts: 2
Still not working and i have followed the instructions carefully.
In PokemonItemEffects you say to Replace lines 327, 340, 1153, 1172.
Lines in MY PokemonItemEffects:
327: end
340: pokemon.statusCount=0
1153:ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL,
1172: scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
As I have edited my scripts.
---------------------
Could you tell me the line above and below if pokemon.hp>0 so that I can find the right one.
The lines in am replacing ATM are
352:
Above-===ItemHandlers::UseOnPokemon.add(:REVIVE,proc{|item,pokemon,scene Below===scene.pbDisplay(_INTL("It won't have any effect."))
365:
Above===ItemHandlers::UseOnPokemon.add(:MAXREVIVE,proc{|item,pokemon,scene| Below===scene.pbDisplay(_INTL("It won't have any effect."))
1179:
Above===ItemHandlers::BattleUseOnPokemon.add(:REVIVE,proc{|item,pokemon,battler,scene|Below===scene.pbDisplay(_INTL("It won't have any effect."))
1198:
Above===ItemHandlers::BattleUseOnPokemon.add(:MAXREVIVE,proc{|item,pokemon,battler,scene|Below===scene.pbDisplay(_INTL("It won't have any effect."))
---------------------
Sorry, I have being trying to make a nuzlocke mode for a while now (and failing) but now I've found your one. Thanks.
Reply With Quote
  #14    
Old April 7th, 2015 (02:27 PM).
Cuflock's Avatar
Cuflock Cuflock is offline
 
Join Date: Mar 2012
Posts: 11
Okey, so I installed the script but im getting this error.

Any ideas?
Attached Thumbnails
essentials problem.png‎  
Reply With Quote
  #15    
Old April 8th, 2015 (07:15 AM).
TACHAN TACHAN is offline
 
Join Date: Jan 2010
Gender: Female
Posts: 170
Ooh! Thanks for this great script!!!
But this script have a problem, if your Pokemon fainted, you appear in the pokemon center, and this happens:
Spoiler:


Then in battle this happens:
Spoiler:


Quote originally posted by Cuflock:
Okey, so I installed the script but im getting this error.

Any ideas?
You can try to put one # in the line 40 and 45:

# =begin

and

# =end
Reply With Quote
  #16    
Old April 12th, 2015 (03:03 PM).
Cuflock's Avatar
Cuflock Cuflock is offline
 
Join Date: Mar 2012
Posts: 11
Quote originally posted by TACHAN:
Ooh! Thanks for this great script!!!
But this script have a problem, if your Pokemon fainted, you appear in the pokemon center, and this happens:
Spoiler:


Then in battle this happens:
Spoiler:



You can try to put one # in the line 40 and 45:

# =begin

and

# =end
It worked, thanks man!
Reply With Quote
  #17    
Old June 6th, 2015 (06:02 AM).
~JV~'s Avatar
~JV~ ~JV~ is offline
Dev of Pokémon Uranium
 
Join Date: Aug 2007
Location: Rio de Janeiro
Age: 21
Nature: Relaxed
Posts: 714
Send a message via Skype™ to ~JV~
Updated the script so dead pokémon doesn't get healed when deposited into the PC, just copy and paste the script over the old one in case you were using it.
__________________
Reply With Quote
  #18    
Old June 6th, 2015 (09:16 AM).
Franzo's Avatar
Franzo Franzo is offline
Developing something...
 
Join Date: Mar 2008
Location: England
Gender: Male
Nature: Modest
Posts: 49
Script works great! Been looking for a nuzlocke, good job.
I also wanted to show an example of what you could do when the player loses a battle and the nuzlocke is over.
Reply With Quote
  #19    
Old June 6th, 2015 (09:40 AM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
@LukaSJ0
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 892
Quote originally posted by Franzo:
Script works great! Been looking for a nuzlocke, good job.
I also wanted to show an example of what you could do when the player loses a battle and the nuzlocke is over.
If you want to be extreme, you could also make the game delete the savefile if the player loses the nuzlocke.
Code:
savefile = RTP.getSaveFileName("Game.rxdata")
File.delete(savefile) if safeExists?(savefile)
__________________
Reply With Quote
  #20    
Old June 18th, 2015 (05:09 PM).
Pia Carrot's Avatar
Pia Carrot Pia Carrot is offline
Gen II Hacker | PHO Enthusiast
 
Join Date: Aug 2010
Age: 19
Gender: Male
Nature: Adamant
Posts: 575
I'm using Essentials v13. I'm having issues, specifically with healHP, healStatus, and healPP. It spits out an error saying they are undefined, so I can only assume that was something added between 13 and 15. Not sure how bad this will affect the nuzlocke, or is there a different code I can use for v13?
__________________




Reply With Quote
  #21    
Old June 24th, 2015 (02:29 AM).
Sharazel's Avatar
Sharazel Sharazel is offline
 
Join Date: May 2015
Gender: Male
Posts: 36
I have a problem. I get more than one encounter on a map. How do I
enable that only one encounter appears at each map? oO
Reply With Quote
  #22    
Old June 24th, 2015 (08:58 AM).
Franzo's Avatar
Franzo Franzo is offline
Developing something...
 
Join Date: Mar 2008
Location: England
Gender: Male
Nature: Modest
Posts: 49
Quote originally posted by Sharazel:
I have a problem. I get more than one encounter on a map. How do I
enable that only one encounter appears at each map? oO
Make sure on line 21 you take out the comments.
__________________
Pokémon Delta Emerald
Reply With Quote
  #23    
Old June 24th, 2015 (09:26 AM).
Sharazel's Avatar
Sharazel Sharazel is offline
 
Join Date: May 2015
Gender: Male
Posts: 36
Already did that but still doesnt work oO
Reply With Quote
Reply
Quick Reply

Sponsored Links

You may also like.. (Beta)
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 UTC -8. The time now is 01:25 AM.