• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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.

[17.2] Friend Care System (like a multiple day care)

  • 11
    Posts
    10
    Years
    About
    This is a system developed by me, similar to Day Care but with some guidelines. This is like a Multiple Day Care System. The original Day Care of Pokémon Essentials is limited, meaning you can only have one Day Care in your game, and this Day Care can only receive two Pokémon. The Friend Care is designed to be an alternative to Day Care.

    With Friend Care you can leave your Pokémon and follow your journey, they will receive EXP exactly as if they were in a Day Care, and you can go back to pick them up any time you want.

    This plugin was developed and tested only on Pokémon Essentials 17.2.

    Differences
    The main differences between Day Care and Friend Care:
    - Friend Care can receive as many Pokémon as you want;
    - Friend Care does not need payment to return the Pokémon;
    - Friend Care does not generate eggs;
    - You can have as many Friend Cares as you want;

    Why Friend Care?
    You must have watched the Pokémon TV anime where the protagonist, Ash Ketchum, always leaves his Pokémon with random people during the story so they "train" the Pokémon for him. My idea was to make a similar system in my game, where an NPC could have some Pokémon of yours to watch as you go on your journey, then you could go back and get that Pokémon back whenever you want.

    As Ash always leaves his Pokémon with friends, I thought the Friend Care name would be perfect.

    How to install
    First open your game project, and open the script editor. Use the list on the left side of the editor to search for the PScreen_Save script.

    Inside this script, find the following line:
    Code:
    Marshal.dump($PokemonStorage,f)

    Below it, paste the following code:
    Code:
    Marshal.dump($SlotCount,f)
    Marshal.dump($FriendCare,f)

    Okay, now coming back from the list on the left side of the editor, look for the PScreen_Load script, usually it's just above PScreen_Save.

    Inside this script, find the following line into pbStartLoadScreen session:
    Code:
    savefile = RTP.getSaveFileName("Game.rxdata")

    Above it, paste the following code:
    Code:
    $SlotCount = 0 if !$SlotCount
    $FriendCare = [] if !$FriendCare

    Still within the same file, find the following line:
    Code:
    magicNumberMatches = false

    Above it, paste the following code:
    Code:
    $SlotCount = Marshal.load(f)
    $FriendCare = Marshal.load(f)

    Now let's go to the last modification of this script. Still within the same file, find the following line:
    Code:
    $PokemonTemp.begunNewGame = true

    Above it, paste the following code:
    Code:
    $SlotCount = 0
    $FriendCare = []

    All these steps up here are required for your game to save the Pokémon left on Friend Care when you close the game.

    Now let's install the Friend Care code, this is the simplest step of the tutorial, just look in the side list of the script editor for the PokeBattle_Trainer file, create a new file just above it and put the name of it from MS_FriendCare.

    Copy all the code in this file and paste inside the MS_FriendCare:
    Code:
    #===============================================================================
    #  FriendCare System (MS) version 1.0.0
    #    by realAfonso
    # ----------------
    #  This is a system developed by me, similar to DayCare but with 
    #  some guidelines. The original DayCare of Pokémon Essentials 
    #  is limited, meaning you can only have one DayCare in your 
    #  game, and this DayCare can only receive two Pokémon. 
    #  The FriendCare is designed to be an alternative to DayCare.
    #-------------------------------------------------------------------------------
    #  The main differences between DayCare and FriendCare:
    #  - FriendCare can receive as many Pokémon as you want;
    #  - FriendCare does not need payment to return the Pokémon;
    #  - FriendCare does not generate eggs;
    #  - You can have as many FriendCares as you want;
    #===============================================================================
    
    #-------------------------------------------------------------------------------
    #  Important Gobal Variables
    #-------------------------------------------------------------------------------
    $FriendCare = [] if !$FriendCare
    $FCPokemon = nil if !$FCPokemon
    $SlotCount = 0 if !$SlotCount
    
    #-------------------------------------------------------------------------------
    #  Return the number of Slots in all FriendCares
    #-------------------------------------------------------------------------------
    def muFriendCareSlots()
      ret=0
      for slot in $FriendCare
        ret+=1
      end
      return ret
    end
    
    #-------------------------------------------------------------------------------
    #  Return the number of Deposited Pokémons in a FriendCare
    #-------------------------------------------------------------------------------
    def muFriendCareDeposited(friend)
      ret=0
      for slot in $FriendCare
        ret+=1 if slot != nil && slot.friend == friend
      end
      return ret
    end
    
    #-------------------------------------------------------------------------------
    #  Deposit a Pokémon in a slot of FriendCare Variable
    #-------------------------------------------------------------------------------
    def muFriendCareDeposit(index,friend)
      $FCPokemon = MultipleFriendCare.new
      $FCPokemon.pokemon=$Trainer.party[index]
      $FCPokemon.level=$Trainer.party[index].level
      $FCPokemon.friend=friend
      $FCPokemon.slot=$SlotCount
      $FCPokemon.pokemon.heal
      $Trainer.party[index]=nil
      $Trainer.party.compact!
      $FriendCare[$SlotCount] = $FCPokemon
      $SlotCount+=1
    end
    
    #-------------------------------------------------------------------------------
    #  Withdraw a Pokémon from a slot of FriendCare Variable
    #-------------------------------------------------------------------------------
    def muFriendCareWithdraw(slot)
      if !$FriendCare[slot]
        raise _INTL("There's no Pokémon here...")
      elsif $Trainer.party.length>=6
        raise _INTL("Can't store the Pokémon...")
      else
        $Trainer.party[$Trainer.party.length]=$FriendCare[slot].pokemon
        $FriendCare.delete_at(slot)
      end  
    end
    
    #-------------------------------------------------------------------------------
    #  Show chooses to the trainer
    #-------------------------------------------------------------------------------
    def muFriendCareChoose(text,friend)
      choices=[]
      results=[]
      count=0
      for slot in $FriendCare
        if(slot != nil && slot.friend == friend)
          pokemon=slot.pokemon
          if pokemon.isMale?
            choices.push(_ISPRINTF("{1:s} (♂, Lv{2:d})",pokemon.name,pokemon.level))
          elsif pokemon.isFemale?
            choices.push(_ISPRINTF("{1:s} (♀, Lv{2:d})",pokemon.name,pokemon.level))
          else
            choices.push(_ISPRINTF("{1:s} (Lv{2:d})",pokemon.name,pokemon.level))
          end
          results[count]=slot.slot
          count+=1
        end
      end
      choices.push(_INTL("CANCEL"))
      command=Kernel.pbMessage(text,choices,choices.length)
      muFriendCareWithdraw(results[command]) if command != count
      return true if command != count
      return false if command == count
    end
    
    #-------------------------------------------------------------------------------
    #  Add EXP to the Pokémons in FriendCares
    #-------------------------------------------------------------------------------
    Events.onStepTaken+=proc {|sender,e|
       next if !$Trainer
       for slot in $FriendCare
         if(slot != nil)
           pkmn=slot.pokemon
           next if !pkmn
           maxexp=PBExperience.pbGetMaxExperience(pkmn.growthrate)
           if pkmn.exp<maxexp
             oldlevel=pkmn.level
             pkmn.exp+=1
             if pkmn.level!=oldlevel
               pkmn.calcStats
               movelist=pkmn.getMoveList
               for i in movelist
                 pkmn.pbLearnMove(i[1]) if i[0]==pkmn.level # Learned a new move----
               end
             end
           end
         end
       end
    }

    Above this script, in the scripts list, create a new file with the name MS_Utilities, here we will put several utility codes that are used by my scripts.

    Within MS_Utilities, paste the following code:
    Code:
    #===============================================================================
    #  Utilities for Manolo's Scripts (MS) version 1.1.0
    #    by realAfonso
    # ----------------
    #  Various utilities used within my plugins. 
    #===============================================================================
    
    #-------------------------------------------------------------------------------
    #  Multiple FriendCare Class
    #-------------------------------------------------------------------------------
    class MultipleFriendCare
      attr_accessor :pokemon
      attr_accessor :level
      attr_accessor :friend
      attr_accessor :slot
    
      def initialize
        @pokemon      = nil
        @level        = 0
        @friend       = nil
        @unity        = nil
      end
      
      def pokemon=(pokemon)
        @pokemon = pokemon
      end
      
      def level=(level)
        @level = level
      end
      
      def friend=(friend)
        @friend = friend
      end
      
      def slot=(slot)
        @slot = slot
      end
    end
    
    #-------------------------------------------------------------------------------
    #  Print a message on screen
    #-------------------------------------------------------------------------------
    def muEcho(text="")
      Kernel.pbMessage(_INTL("{1}",text))
    end
    
    #-------------------------------------------------------------------------------
    #  Print a variable on screen
    #-------------------------------------------------------------------------------
    
    def muEchoVar(variable,text="")
      Kernel.pbMessage(_INTL("{1}{2}",text,variable))
    end
    
    #-------------------------------------------------------------------------------
    #  pbChooseNonEggPokemon variation 
    #  that filters the result by type
    #-------------------------------------------------------------------------------
    def muChoosePokemonType(variableNumber,nameVarNumber,type,name_var=0,specie_var=0,type_var=0)
      muChoosePokemon(variableNumber,nameVarNumber,proc {|poke|
         !poke.egg? && poke.hasType?(type)
      },false,name_var,specie_var,type_var)
    end
    
    #-------------------------------------------------------------------------------
    #  pbChoosePokemon variation 
    #  save type and specie in a variable 
    #-------------------------------------------------------------------------------
    def muChoosePokemon(variableNumber,nameVarNumber,ableProc=nil,allowIneligible=false,name_var=0,specie_var=0,type_var=0)
      chosen = 0
      pbFadeOutIn(99999){
        scene = PokemonParty_Scene.new
        screen = PokemonPartyScreen.new(scene,$Trainer.party)
        if ableProc
          chosen=screen.pbChooseAblePokemon(ableProc,allowIneligible)      
        else
          screen.pbStartScene(_INTL("Choose a Pokémon."),false)
          chosen = screen.pbChoosePokemon
          screen.pbEndScene
        end
      }
      pbSet(variableNumber,chosen)
      if chosen>=0
        pbSet(nameVarNumber,$Trainer.party[chosen].name)
        pbSet(name_var,$Trainer.party[chosen].name) if name_var > 0
        pbSet(specie_var,$Trainer.party[chosen].speciesName) if specie_var > 0
        pbSet(type_var,$Trainer.party[chosen].type1) if type_var > 0
      else
        pbSet(nameVarNumber,"")
      end
    end
    
    #-------------------------------------------------------------------------------
    #  Return true if specie in a variable is same of the text 
    #-------------------------------------------------------------------------------
    def muSelectedSpecies(variable,specie)
      if $game_variables[variable] == specie
        return true
      else
        return false
      end
    end

    Ready, the installation was successful!

    How to use?
    You can use Friend Care in several different ways, I'll leave a suggestion here, it's a map I created with an event ready to be used, I put two NPCs, one of them speaks English, the other speaks Portuguese, but it's exactly the same event.

    Just download the attached file. Events are commented on to explain what each party does.

    ------------

    Please, if you will use my code, just give me the credits. I hope I have helped you, and if you have any questions you can leave it in the comments that I will answer.

    See you!
     

    Attachments

    • Map082.zip
      3 KB · Views: 11
    Is it possible to prevent the pokemon from gaining EXP?

    Hmmm, try to just remove/delete/comment out this code:
    Code:
    #-------------------------------------------------------------------------------
    #  Add EXP to the Pokémons in FriendCares
    #-------------------------------------------------------------------------------
    Events.onStepTaken+=proc {|sender,e|
       next if !$Trainer
       for slot in $FriendCare
         if(slot != nil)
           pkmn=slot.pokemon
           next if !pkmn
           maxexp=PBExperience.pbGetMaxExperience(pkmn.growthrate)
           if pkmn.exp<maxexp
             oldlevel=pkmn.level
             pkmn.exp+=1
             if pkmn.level!=oldlevel
               pkmn.calcStats
               movelist=pkmn.getMoveList
               for i in movelist
                 pkmn.pbLearnMove(i[1]) if i[0]==pkmn.level # Learned a new move----
               end
             end
           end
         end
       end
    }
     
    ¿Cómo funciona el tema de los movimientos que aprenda el Pokémon? ¿Es como la guardería que va olvidando automáticamente los más antiguos?
     
    A very interesting script. I have followed all the steps but it generates a conflict with the Achievement Script.

    I manage to implement it and save the game, but when I reload the game and take a single step it generates an error.
     
    Back
    Top