Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Reply
 
Thread Tools
  #1    
Old August 30th, 2013 (8:48 AM).
TACHAN TACHAN is offline
     
    Join Date: Jan 2010
    Gender: Female
    Posts: 198

    Hi!
    I want to do that something happens if I take one Celebi and five pokemon Water type in the team. (To open the entry to a cave.)

    I tried to do this, but it me did not work:

    Condition and effect--> $Trainer.ablePokemonCount<=1
    Condition and effect--> pbHasSpecies?(PBSpecies::CELEBI)
    Condition and effect--> $Trainer.ablePokemonCount<=2
    Condition and effect--> pbHasType?(PBTypes::WATER)
    Condition and effect--> $Trainer.ablePokemonCount<=3
    Condition and effect--> pbHasType?(PBTypes::WATER)
    Condition and effect--> $Trainer.ablePokemonCount<=4
    Condition and effect--> pbHasType?(PBTypes::WATER)
    Condition and effect--> $Trainer.ablePokemonCount<=5
    Condition and effect--> pbHasType?(PBTypes::WATER)
    Condition and effect--> $Trainer.ablePokemonCount<=6
    Condition and effect--> pbHasType?(PBTypes::WATER)

    Have I been wrong in something?

    Reply With Quote

    Relevant Advertising!

      #2    
    Old August 30th, 2013 (10:22 AM). Edited August 30th, 2013 by Nickalooose.
    Nickalooose Nickalooose is offline
    --------------------
       
      Join Date: Mar 2008
      Gender: Female
      Posts: 1,309

      I would use this instead... Paste this in to a new script section above Main.

      Code:
        def countType?(type)
          $game_variables[90]=0
          $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
        end
      Change 90 to another variable number or don't, whatever.

      Reply With Quote
        #3    
      Old August 30th, 2013 (10:37 AM).
      Umbra's Avatar
      Umbra Umbra is offline
      • Platinum Tier
       
      Join Date: Aug 2009
      Location: Nearby my feet.
      Age: 20
      Gender: Female
      Nature: Calm
      Posts: 1,745

      Quote:
      Originally Posted by Nickalooose View Post
      I would use this instead... Paste this in to a new script section above Main.
      Code:
        def countType?(type)
          $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
        end
      Change 90 to another variable number or don't, whatever.

      you have a small error:

      Code:
        def countType?(type)
          $game_variables[90]=0
          $game_variables[90]+=1 if $Trainer.party[0].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[1].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[2].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[3].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[4].hasType?(type)
          $game_variables[90]+=1 if $Trainer.party[5].hasType?(type)
        end

      without that extra line activating the function multiple COULD (not saying will as it could get reset elsewhere) get the variable to 6+ which would be a bad glitch

      Reply With Quote
        #4    
      Old August 30th, 2013 (10:51 AM).
      Nickalooose Nickalooose is offline
      --------------------
         
        Join Date: Mar 2008
        Gender: Female
        Posts: 1,309

        Forgot to mention that I use this for something similar and the Variable is changed in the event to something else lol. Thanks.

        Reply With Quote
          #5    
        Old August 30th, 2013 (4:13 PM).
        Maruno's Avatar
        Maruno Maruno is offline
        Lead Dev of Pokémon Essentials
           
          Join Date: Jan 2008
          Location: England
          Posts: 5,173

          Personally I'd put the call to the method in the parameter of a Conditional Branch, and have the method return true if all the conditions match and false otherwise. It saves mucking around with a variable.

          Also, the code provided above doesn't answer the question as stated, as it will neither count Celebi (which isn't Water type) nor will it ignore eggs. The method may as well be tailored specifically to this use.

          Code:
          def pbCanOpenCelebiCave
            return false if !pbHasSpecies?(:CELEBI)
            count=0
            for poke in $Trainer.pokemonParty
              next if isConst?(poke.species,PBSpecies,:CELEBI)
              count+=1 if poke.hasType?(:WATER)
            end
            return (count==5)
          end
          I believe that'll work without fail. It doesn't matter which position the Celebi is in, just as long as there's one in there. Eggs are ignored, and both pure-Water and half-Water Pokémon are counted. Fainted Pokémon can also be counted, which I'm guessing is acceptable since fainted Pokémon can do other things in the overworld anyway (i.e. use HMs).

          __________________

          Go to the Pokémon Essentials Wiki

          | Downloads | Tutorials | Fangames |
          | All Animations Project |

          Follow me on Twitter: @maruno42

          Reply With Quote
            #6    
          Old August 31st, 2013 (12:08 AM).
          Nickalooose Nickalooose is offline
          --------------------
             
            Join Date: Mar 2008
            Gender: Female
            Posts: 1,309

            That's nice code there Maruno, and just to let you know, the code I wrote is part of a bigger class, and does something in my game where variable 90 needs to be something, then is changed to something else, however, it pretty much does what he wanted :D so I shared... Which is why it doesn't check for Celebi.

            But the reason I am commenting was, I couldn't find on wiki or in the scripts (because I didn't know what I was searching for), how to search an entire party... Is the $Trainer.pokemonParty, what checks a whole party?

            Reply With Quote
              #7    
            Old August 31st, 2013 (3:26 AM).
            TACHAN TACHAN is offline
               
              Join Date: Jan 2010
              Gender: Female
              Posts: 198

              Quote:
              Originally Posted by Maruno View Post
              Personally I'd put the call to the method in the parameter of a Conditional Branch, and have the method return true if all the conditions match and false otherwise. It saves mucking around with a variable.

              Also, the code provided above doesn't answer the question as stated, as it will neither count Celebi (which isn't Water type) nor will it ignore eggs. The method may as well be tailored specifically to this use.

              Code:
              def pbCanOpenCelebiCave
                return false if !pbHasSpecies?(:CELEBI)
                count=0
                for poke in $Trainer.pokemonParty
                  next if isConst?(poke.species,PBSpecies,:CELEBI)
                  count+=1 if poke.hasType?(:WATER)
                end
                return (count==5)
              end
              I believe that'll work without fail. It doesn't matter which position the Celebi is in, just as long as there's one in there. Eggs are ignored, and both pure-Water and half-Water Pokémon are counted. Fainted Pokémon can also be counted, which I'm guessing is acceptable since fainted Pokémon can do other things in the overworld anyway (i.e. use HMs).

              Thank you very much. It works perfectly.

              Reply With Quote
                #8    
              Old August 31st, 2013 (8:44 AM).
              Maruno's Avatar
              Maruno Maruno is offline
              Lead Dev of Pokémon Essentials
                 
                Join Date: Jan 2008
                Location: England
                Posts: 5,173

                Quote:
                Originally Posted by Nickalooose View Post
                But the reason I am commenting was, I couldn't find on wiki or in the scripts (because I didn't know what I was searching for), how to search an entire party... Is the $Trainer.pokemonParty, what checks a whole party?
                $Trainer.pokemonParty is the same as $Trainer.party but without the eggs.
                $Trainer.ablePokemonParty is the same as $Trainer.pokemonParty but without the fainted Pokémon.

                You check through them by using a for poke in $Trainer.pokemonParty loop.

                I've added some information to the Party page.

                __________________

                Go to the Pokémon Essentials Wiki

                | Downloads | Tutorials | Fangames |
                | All Animations Project |

                Follow me on Twitter: @maruno42

                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

                Forum Jump


                All times are GMT -8. The time now is 6:01 AM.