Scripts, Tutorials & Tools 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 September 26th, 2018 (6:01 PM). Edited September 26th, 2018 by WolfPP.
WolfPP's Avatar
WolfPP WolfPP is online now
     
    Join Date: Aug 2018
    Location: Brazil
    Gender: Male
    Nature: Jolly
    Posts: 164
    My god, so nice! I will put into my game. Ty ty!

    So, i dont get it how put 'Incubation'. Sorry to ask but can you teach more about that?

    My line 178:
    Spoiler:
    Code:
    def pbHatch(pokemon)
      speciesname = PBSpecies.getName(pokemon.species)
      pokemon.name           = speciesname
      pokemon.trainerID      = $Trainer.id
      pokemon.ot             = $Trainer.name
      pokemon.happiness      = 120
      pokemon.timeEggHatched = pbGetTimeNow
      pokemon.obtainMode     = 1   # hatched from egg
      pokemon.hatchedMap     = $game_map.map_id
      $Trainer.seen[pokemon.species]  = true
      $Trainer.owned[pokemon.species] = true
      pbSeenForm(pokemon)
      pokemon.pbRecordFirstMoves
      if !pbHatchAnimation(pokemon)
        Kernel.pbMessage(_INTL("Huh?\1"))
        Kernel.pbMessage(_INTL("...\1"))
        Kernel.pbMessage(_INTL("... .... .....\1"))
        Kernel.pbMessage(_INTL("{1} hatched from the Egg!",speciesname))
        if Kernel.pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname))
          species=PBSpecies.getName(pokemon.species)
          nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),
             0,PokeBattle_Pokemon::NAMELIMIT,"",pokemon)
          pokemon.name=nickname if nickname!=""
        end #line 201
      end
    end

    Im usin v17.2 and EBS.

    Ty ty!


    EDIT:

    And i get this error:

    Spoiler:
    Code:
    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17.2]
    
    Exception: NoMethodError
    
    Message: undefined method `[]' for nil:NilClass
    
    PScreen_Pokegear:188:in `pbStartScreen'
    
    PScreen_Pokegear:154:in `loop'
    
    PScreen_Pokegear:194:in `pbStartScreen'
    
    Neo Pause Menu:405
    
    Neo Pause Menu:404:in `pbFadeOutIn'
    
    Neo Pause Menu:404
    
    Neo Pause Menu:401:in `call'
    
    Neo Pause Menu:48:in `runAction'
    
    Neo Pause Menu:319:in `pbStartPokemonMenu'
    
    Neo Pause Menu:303:in `loop'


    I see than your start screen is different to the others

    This is mine (the last add to pokegear, custom:
    Code:
          elsif cmdWallClockTimer>=0 && cmd==cmdWallClockTimer
            pbPlayDecisionSE
            pbFadeOutIn(99999){
              scene = WallClockScene.new
              screen = WallClockScreen.new(scene)
              screen.pbStartScreen($Trainer.gender==0)
            }
          end
        end
        @scene.pbEndScene
      end
    end
    How could be?

    Thanks!
    Reply With Quote
      #2    
    Old September 28th, 2018 (7:04 AM). Edited September 28th, 2018 by samukomini.
    samukomini samukomini is offline
       
      Join Date: Sep 2018
      Location: Spain
      Gender: Male
      Nature: Calm
      Posts: 9
      Quote:
      Originally Posted by WolfPP View Post
      My god, so nice! I will put into my game. Ty ty!

      So, i dont get it how put 'Incubation'. Sorry to ask but can you teach more about that?

      My line 178:
      Spoiler:
      Code:
      def pbHatch(pokemon)
        speciesname = PBSpecies.getName(pokemon.species)
        pokemon.name           = speciesname
        pokemon.trainerID      = $Trainer.id
        pokemon.ot             = $Trainer.name
        pokemon.happiness      = 120
        pokemon.timeEggHatched = pbGetTimeNow
        pokemon.obtainMode     = 1   # hatched from egg
        pokemon.hatchedMap     = $game_map.map_id
        $Trainer.seen[pokemon.species]  = true
        $Trainer.owned[pokemon.species] = true
        pbSeenForm(pokemon)
        pokemon.pbRecordFirstMoves
        if !pbHatchAnimation(pokemon)
          Kernel.pbMessage(_INTL("Huh?\1"))
          Kernel.pbMessage(_INTL("...\1"))
          Kernel.pbMessage(_INTL("... .... .....\1"))
          Kernel.pbMessage(_INTL("{1} hatched from the Egg!",speciesname))
          if Kernel.pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname))
            species=PBSpecies.getName(pokemon.species)
            nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),
               0,PokeBattle_Pokemon::NAMELIMIT,"",pokemon)
            pokemon.name=nickname if nickname!=""
          end #line 201
        end
      end

      Im usin v17.2 and EBS.

      Ty ty!


      EDIT:

      And i get this error:

      Spoiler:
      Code:
      ---------------------------
      Pokemon Essentials
      ---------------------------
      [Pokémon Essentials version 17.2]
      
      Exception: NoMethodError
      
      Message: undefined method `[]' for nil:NilClass
      
      PScreen_Pokegear:188:in `pbStartScreen'
      
      PScreen_Pokegear:154:in `loop'
      
      PScreen_Pokegear:194:in `pbStartScreen'
      
      Neo Pause Menu:405
      
      Neo Pause Menu:404:in `pbFadeOutIn'
      
      Neo Pause Menu:404
      
      Neo Pause Menu:401:in `call'
      
      Neo Pause Menu:48:in `runAction'
      
      Neo Pause Menu:319:in `pbStartPokemonMenu'
      
      Neo Pause Menu:303:in `loop'


      I see than your start screen is different to the others

      This is mine (the last add to pokegear, custom:
      Code:
            elsif cmdWallClockTimer>=0 && cmd==cmdWallClockTimer
              pbPlayDecisionSE
              pbFadeOutIn(99999){
                scene = WallClockScene.new
                screen = WallClockScreen.new(scene)
                screen.pbStartScreen($Trainer.gender==0)
              }
            end
          end
          @scene.pbEndScene
        end
      end
      How could be?

      Thanks!
      Oh, I see, I'm sorry, my version was 16, this is why the starting script is so different. I will update this script, so by the moment, you only need to adapt it to the v17. So, in the PScreen_Pokegear, in the def pbStartScreen add what I told to set the Pokégear but removing the '@' of cmdOPower and instead the update_command (which doesn't exist in v17), put this after the several conditional branches:
      Spoiler:
      Code:
      if cmdOPower>=0 && cmd==cmdOPower #!#OPOWERS
              pbPlayDecisionSE()
              Scene_OPowers.new.start
            end

      Then replace the script I'd given by this:
      Spoiler:
      Code:
      #=======================================
      #     O-Powers. Created by Samukomini
      #     Credit wanted but not required.
      #=======================================
      
      module OPowers
        ATTACK    = 0
        DEFENSE   = 1
        CATCH     = 2
        HP_HEAL   = 3
        PP_HEAL   = 4
        REWARD    = 5
        CRITICAL  = 6
        HAPPINESS = 7
        DISCOUNT  = 8
        ENCOUNTER = 9
        REPEL     = 10
        INCUBATION = 11
        EXP_GAIN  = 12
        IV        = 13
        
        def self.names
          return ["Attack","Defense","Capture","HP Restore","PP Restore",
                  "Reward","Critical","Happiness","Discount","Encounter",
                  "Repel","Incubation","Experience Points","Individual Values"]
        end
      
        def self.descriptions
          return [
            "Boost the attack of your leading Pokémon in the next battle.",
            "Boost the attack of your leading Pokémon in the next battle.",
            "Raise the probability of catching a Pokémon.",
            "Restore your team health.",
            "Restore your team moves PPs.",
            "Raise the money you steal the trainers you win.",
            "Raise the critical hit ratio in battle.",
            "Boost the happiness your Pokémon win.",
            "Cut the prices on products in Pokémon Mart.",
            "Raise the probability of encountering a wild Pokémon.",
            "Reduce the probability of encountering a wild Pokémon.",
            "Speed up your egg hatching.",
            "Boost the experience points earned by your Pokémon.",
            "Wild Pokémon will boost their Individual Values."
          ]
        end
      
        def self.costs(level) # Over 100
          case level
          when 1
            return [10,10,20,10,20,15,15,15,20,10,15,20,25,25]
          when 2
            return [20,20,30,20,30,30,25,25,40,20,30,30,35,35]
          when 3
            return [30,30,40,30,40,45,40,35,60,30,40,40,50,50]
          end
          raise ArgumentError.new("Undefined cost for level: #{level}")
        end
      
        def self.instant?(power)
          return [ATTACK,DEFENSE,HP_HEAL,PP_HEAL].include?(getID(self,power))
        end
                
        def self.length; self.constants.length; end
      
        def self.getByName(name)
          for i in 0...length
            return i if names[i] == name
          end
          return -1
        end
      end
      
      class PokemonGlobalMetadata
        attr_reader   :oplevels
        attr_accessor :opower_data
        attr_reader   :openergy
        
        alias old_initialize initialize
        
        def initialize
          old_initialize
          @oplevels = []
          @opower_data = Array.new(OPowers.length) { nil }
          @openergy = 100
        end
      
        def opLevelUp(op,level=nil)
          if @oplevels.empty?
            @oplevels = Array.new(OPowers.length) {0}
          end
          op = getID(OPowers,op)
          if level
            @oplevels[op] = level
          else
            @oplevels[op] += 1
          end
        end
      
        def openergy=(val)
          @openergy = val
          @openergy = 0 if @openergy < 0
          @openergy = 100 if @openergy > 100
        end
      end
      
      class Scene_Map
        alias op_update update
      
        def update
          op_update
          update_opower
        end
      
        def update_opower
          for i in 0...$PokemonGlobal.opower_data.length
            data = $PokemonGlobal.opower_data[i]
            next if OPowers.instant?(i) || !data
            if Time.now.to_i > data[1].to_i + data[2] # Time expired
              Kernel.pbMessage(_INTL("The effect of  {1} O-Power finished.",OPowers.names[i]))
              $PokemonGlobal.opower_data[i] = nil
            end
          end
        end
      end
      
      ## Launch a power. Return if it has been succesfully launched.
      def pbLaunchOPower(opower,level,consume=true,time=3,showmessage=true,effects=true)
        opower = getID(OPowers,opower)
        if consume || ($DEBUG && Input.press?(Input::CTRL))
          if OPowers.costs(level)[opower] > $PokemonGlobal.openergy # Not enough energy
            Kernel.pbMessage("There isn't enough energy to launch this power.") if showmessage
            return false
          end
          $PokemonGlobal.openergy -= OPowers.costs(level)[opower]
        end
        if effects
          pbSEPlay("o_power")
          pbFadeOutIn2(255,255,255) {yield if block_given?}
        end
        Kernel.pbMessage(_INTL("You have activated {1} O-Power - Level {2}.",
            OPowers.names[opower],level.to_s)) if showmessage
        $PokemonGlobal.opower_data[opower] = [level,Time.now,(time*60).floor] # Time not needed for instant O-Powers
        ## Repel replaces Encounter and vice versa
        if isConst?(opower,OPowers,:ENCOUNTER)
          $PokemonGlobal.opower_data[OPowers::REPEL] = nil
        elsif isConst?(opower,OPowers,:REPEL)
          $PokemonGlobal.opower_data[OPowers::ENCOUNTER] = nil
        end
        if OPowers.instant?(opower)
          if isConst?(opower,OPowers,:HP_HEAL)
            case level
            when 1; prop = 1.0/3.0
            when 2; prop = 0.5
            when 3; prop = 2.0/3.0
            else; prop = 1
            end
            for i in $Trainer.party
              pbItemRestoreHP(i,(i.totalhp*prop).round)
            end
            $PokemonGlobal.opower_data[opower] = nil
          elsif isConst?(opower,OPowers,:PP_HEAL)
            case level
            when 1; restore = 5
            when 2; restore = 10
            when 3; restore = 15
            else; restore = 40
            end
            for i in $Trainer.party
              for j in 0...i.moves.length
                pbRestorePP(i,j,restore)
              end
            end
            $PokemonGlobal.opower_data[opower] = nil
          end
        end
      end
      
      Events.onStepTaken += proc {
        if $PokemonGlobal.happinessSteps==0
          # Done each 128 steps. See this Event in PField_Field section.
          $PokemonGlobal.openergy += 5
          # O Power energy would be full restored in 6400 steps
        end
      }
      
      Events.onWildPokemonCreate += proc {|s,e|
        pokemon = e[0]
        o = $PokemonGlobal.opower_data[OPowers::IV]
        if o
          case o[0]
          when 1; mod = rand(2) + 1
          when 2; mod = rand(3) + 2
          when 3; mod = rand(4) + 3
          else; mod = 6
          end
          ivs = randomAry(mod,pokemon.iv.length) # Random indexes of modifying ivs
          for i in ivs
            pokemon.iv[i] = 31
          end
          pokemon.calcStats
        end
      }
      
      class Scene_OPowers
        def start
          # => Prepare
          @sprites = {}
          @levels = $PokemonGlobal.oplevels.clone
          # Indexes of the own O Powers (non-leveled 0)
          @ownops = Array.new(OPowers.length) { |i| next i }
          for i in 0...@levels.length
            if @levels[i] == 0
              @ownops[i] = nil
            end
          end
          @levels.delete(0); @ownops.compact!
          # => # SPRITES
          @viewport=Viewport.new(0,0,Graphics.width,Graphics.height); @viewport.z=99999
          @sprites[:list] = Window_CommandPokemon.newEmpty(169,46,330,276,@viewport)#
          #@sprites[:list].windowskin = nil
          @sprites[:list].index = 0
          @sprites[:list].z = 255
          @sprites[:list].windowskin = nil
          ##
          @sprites[:header] = Window_UnformattedTextPokemon.newWithSize(
            _INTL("Poderes O"),0,0,216,28,@viewport)
          @sprites[:header].baseColor = Color.new(248,248,248) ##TODO
          @sprites[:header].shadowColor = Color.new(0,0,0)
          ##
          @sprites[:info] = Window_AdvancedTextPokemon.newWithSize("",
             0,240,158,128,@viewport)
          ##
          barpower = ($PokemonGlobal.openergy * 0.01 * 318).floor
          @sprites[:bar] = IconSprite.new(178,336,@viewport)
          @sprites[:bar].setBitmap("Graphics/Pictures/O Power/bar")
          @sprites[:bar].src_rect = Rect.new(0,0,barpower,32)
          @sprites[:bar].z = 255
          ##
          @sprites[:textwindow] = Window_UnformattedTextPokemon.new("")
          @sprites[:textwindow].x = 0
          @sprites[:textwindow].y = 116
          @sprites[:textwindow].width = 158
          @sprites[:textwindow].height = 252
          @sprites[:textwindow].viewport = @viewport
          @sprites[:textwindow].windowskin = nil
          ## LISTA ##
          commands = []
          for i in 0...@ownops.length
            commands.push(_INTL("{1} - Lvl {2}",OPowers.names[@ownops[i]],@levels[i]))
          end
          commands.push("Exit")
          addBackgroundPlane(@sprites,:bg,"O Power/bg",@viewport)
          @sprites[:list].commands = commands
          Graphics.transition
          #pbFadeInAndShow(@sprites)
          #pbActivateWindow(@sprites,:list) {
            loop do # Update loop
              Graphics.update
              Input.update
              update
              update_text
              pbUpdateSpriteHash(@sprites)
              break if @break
            end
          #}
          Graphics.freeze
          # Disposes the windows
          pbDisposeSpriteHash(@sprites)
          @viewport.dispose
        end
      
        def update
          if Input.trigger?(Input::B) # Back
            pbPlayCancelSE()
            @break = true
            return
          elsif Input.trigger?(Input::C)
            index = @sprites[:list].index
            if index == @ownops.length # Index of exit (last command)
              pbPlayCancelSE()
              @break = true
              return
            end
            selected = @ownops[index] # O Power id selected
            if $PokemonGlobal.oplevels[selected] == 1
              if Kernel.pbConfirmMessage(_INTL("Activate {1} O-Power?",@sprites[:list].commands[index]))
                pbLaunchOPower(selected,1)
              end
            else
              commands = []
              for i in 1..$PokemonGlobal.oplevels[selected]
                commands.push(_INTL("Level {1} ({2}%)",i.to_s,OPowers.costs(i)[selected].to_s))
              end
              commands.push("Exit")
              cmd = Kernel.pbMessage(_INTL("Choose a level."),commands,commands.length)
              if cmd < commands.length-1 # Not back command
                if Kernel.pbConfirmMessage(_INTL("Activate {1} O-Power - level {2}?",
                  OPowers.names[selected],cmd+1))
                  # Se lanza el poder O
                  pbLaunchOPower(selected,cmd+1) {update_bar}
                end
              end
              #$scene = Scene_ConfirmOPower.new(selected)
            end
          end
        end
      
        def update_text
          selected = getID(OPowers,@ownops[@sprites[:list].index]) # O Power id selected
          if !selected
            # Back tag
            @sprites[:textwindow].text = _INTL("Back to the main menu.")
          else
            # O Power descriptions
            @sprites[:textwindow].text = OPowers.descriptions[selected] # Put descriptions
          end
        end
      
        def update_bar
          barpower = ($PokemonGlobal.openergy * 0.01 * 318).floor
          @sprites[:bar].src_rect.set(0,0,barpower,32)
        end
      
      end
      
      def pbFadeOutIn2(red,green,blue)
        col = Color.new(red,green,blue)
        viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
        viewport.z = 99999
        for j in 0..17
          col.set(red,green,blue,j*15)
          viewport.color = col
          Graphics.update
          Input.update
        end
        pbPushFade
        begin
          yield if block_given?
        ensure
          pbPopFade
          for j in 0..17
            col.set(red,green,blue,(17-j)*15)
            viewport.color=col
            Graphics.update
            Input.update
          end
          viewport.dispose
        end
      end


      By the way, the problem that you had trying to set the Incubation power is because of the version too. You just need to do what I specified in the last section's proc (line 205).

      I'm sorry for this all, I'm going to change the script and update the thread. This is the temporal solution, please tell me if you notice another error. Thanks for using the script!! :D
      Reply With Quote
        #3    
      Old September 28th, 2018 (7:57 AM).
      WolfPP's Avatar
      WolfPP WolfPP is online now
         
        Join Date: Aug 2018
        Location: Brazil
        Gender: Male
        Nature: Jolly
        Posts: 164
        Hmmm, give me that issue:

        Code:
        ---------------------------
        Pokemon Essentials
        ---------------------------
        [Pokémon Essentials version 17.2]
        
        [Pokétch v1.1]
        
        Exception: NoMethodError
        
        Message: undefined method `start' for #<Scene_OPowers:0xd0e73a0>
        
        PScreen_Pokegear:193:in `pbStartScreen'
        
        PScreen_Pokegear:192:in `pbFadeOutIn'
        
        PScreen_Pokegear:192:in `pbStartScreen'
        
        PScreen_Pokegear:155:in `loop'
        
        PScreen_Pokegear:196:in `pbStartScreen'
        
        Neo Pause Menu:405
        
        Neo Pause Menu:404:in `pbFadeOutIn'
        
        Neo Pause Menu:404
        
        Neo Pause Menu:401:in `call'
        
        Neo Pause Menu:48:in `runAction'
        i think its your startscreen. You havent a pbStartScreen. And idk how to make one (to sad).
        Look:
        Code:
              elsif cmdJukebox>=0 && cmd==cmdJukebox
                pbPlayDecisionSE
                pbFadeOutIn(99999){
                  scene = PokemonJukebox_Scene.new
                  screen = PokemonJukeboxScreen.new(scene)
                  screen.pbStartScreen
                }
        And "i" thank you lol :D
        Reply With Quote
          #4    
        Old September 28th, 2018 (8:13 AM).
        samukomini samukomini is offline
           
          Join Date: Sep 2018
          Location: Spain
          Gender: Male
          Nature: Calm
          Posts: 9
          Ok, I'm stupid, I forgot to change the most important thing. I have edited the previous post with a 'start' method, try again copying that script. If it still doesn't work, you can PM me.
          Reply With Quote
            #5    
          Old September 28th, 2018 (9:54 AM). Edited September 28th, 2018 by WolfPP.
          WolfPP's Avatar
          WolfPP WolfPP is online now
             
            Join Date: Aug 2018
            Location: Brazil
            Gender: Male
            Nature: Jolly
            Posts: 164
            Quote:
            Originally Posted by samukomini View Post
            Ok, I'm stupid, I forgot to change the most important thing. I have edited the previous post with a 'start' method, try again copying that script. If it still doesn't work, you can PM me.
            Ok. I did :D

            EDIT:

            DONE!

            How?

            in ' def pbStartScreen' add:
            Code:
            cmdOPower         = -1
            above '@scene.pbStartScene(commands)' add:
            Code:
             commands[cmdOPower = commands.length] = ["opower",_INTL("O Powers")] if !$PokemonGlobal.oplevels.empty? #!#OP
            Then, below this:
            Code:
                loop do
                  cmd = @scene.pbScene
                  if cmd<0
                    pbPlayCancelSE
                    break
            add this:
            Code:
                  elsif cmdOPower>=0 && cmd==cmdOPower
                    pbPlayDecisionSE
                    pbFadeOutIn(99999){
                      Scene_OPowers.new.start
                    }
            Ty ty! <3

            EDIT2: Now when i try to exit to overworld, i dont get it cuz keep the O Power screen.
            Reply With Quote
              #6    
            Old September 28th, 2018 (3:00 PM).
            samukomini samukomini is offline
               
              Join Date: Sep 2018
              Location: Spain
              Gender: Male
              Nature: Calm
              Posts: 9
              Okay, the thread is now updated to v17. I've tried it and it seems to work okay.
              Reply With Quote
              Reply

              Quick Reply

              Join the conversation!

              Create an account to post a reply in this thread, participate in other discussions, and more!

              Create a PokéCommunity Account
              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 11:27 AM.