• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[Scripting Question] Boosting the exp gained of the first Pokemon in the party?

  • 72
    Posts
    6
    Years
    • Seen Jan 24, 2021
    Hello. I'm trying to make an event that boosts experience gained of the first Pokémon in the party. I thought that using a tag might work. So I called this event:


    Code:
    poke=pbGetPokemon(1)
    poke.ExpUp

    And made a tag to place and call:


    Code:
      def isExpBoosted?
        return @expflag if @expflag!=nil
      end
    
      def ExpUp
        @expflag=true
      end
    
      def RemoveExpUp
        @expflag=false
      end

    Finally, in PokeBattle_Battle, i placed this around Lucky Egg and Exp. Share.

    Code:
       boost=(thispoke.isExpBoosted?)
        
        if boost=true
          exp=(exp*4/2).floor
        end
        if boost=false
          exp=(exp*1/2).floor
        end

    I tried this but it does not work. Can someone point out what I did wrong? Or suggest a simpler way? Thanks for any help in advance.
     
    There is indeed a much simpler solution, but first, I want to address the errors in your code:
    Code:
    poke=pbGetPokemon(1)
    pbGetPokemon(1) checks the value of Game Variable 1 and returns the Pokemon located at that index value. So if Game Variable 1 is set to 1, for example, then it will return the Pokemon at index 1, which is actually the second Pokemon in the party.

    Code:
      def isExpBoosted?
        return @expflag if @expflag!=nil
      end
    
      def ExpUp
        @expflag=true
      end
    
      def RemoveExpUp
        @expflag=false
      end
    In general, if you're making new methods, you should have the method names start with a lowercase letter, like "expUp" and "removeExpUp".

    Code:
       boost=(thispoke.isExpBoosted?)
        
        if boost=true
          exp=(exp*4/2).floor
        end
        if boost=false
          exp=(exp*1/2).floor
        end
    The correct way of checking a value is by using a double equals sign "==" instead of just "=". So it technically would be "boost==true" and "boost==false" in the if-statements.

    Now, I mentioned that there is a simpler solution... you actually don't need the exp tag at all. All you need is this code bit placed around Lucky Egg/Exp Share:
    Code:
    if index==0
      exp *= 2
    else
      exp = (exp/2).floor
    end
     
    Last edited:
    Oh wow, that's amazing. It really is much simpler.And it makes sense why it wasn't working now. Thank you, NettoHikari.
     
    Back
    Top