• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Nuzlocke Mode

~JV~

Dev of Pokémon Uranium
684
Posts
16
Years
  • 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 [email protected]
          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 [email protected]
          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
     
    Last edited:
    1,224
    Posts
    10
    Years
  • 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
     

    ~JV~

    Dev of Pokémon Uranium
    684
    Posts
    16
    Years
  • 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 :).
     

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen today
    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.
     
    Last edited:
    119
    Posts
    10
    Years
  • 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 :)
     
    Last edited:

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • 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
     
    2
    Posts
    9
    Years
    • Seen Mar 21, 2015
    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.
     

    ~JV~

    Dev of Pokémon Uranium
    684
    Posts
    16
    Years
  • 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.
     
    2
    Posts
    9
    Years
    • Seen Mar 21, 2015
    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.
     
    11
    Posts
    12
    Years
    • Seen Jun 1, 2018
    Okey, so I installed the script but im getting this error.
    attachment.php

    Any ideas?
     
    199
    Posts
    14
    Years
    • Seen Jul 6, 2022
    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:


    Okey, so I installed the script but im getting this error.
    attachment.php

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

    # =begin

    and

    # =end
     
    11
    Posts
    12
    Years
    • Seen Jun 1, 2018
    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!
     

    ~JV~

    Dev of Pokémon Uranium
    684
    Posts
    16
    Years
  • 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.
     

    Franzo

    Developing something...
    95
    Posts
    16
    Years
  • 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.
    Nuzlocke%20GameOver.png
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • 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)
     

    PiaCRT

    Orange Dev
    938
    Posts
    13
    Years
  • 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?
     
    Back
    Top