• 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.

[Question] (Scripting) How can I add a "Happiness" requirement to Mega Evolution (V18.1)

21
Posts
3
Years
    • Seen Sep 19, 2022
    I'm looking to add a requirement to my game where, in order for a Pokemon to Mega Evolve, it needs the Mega Stone, Mega Ring, AND to have a happiness level of >220 (like Pokemon that evolve via happiness). I wanted to keep players from just catching a Pokemon and being able to Mega Evolve it right away.

    I'm very new to programming, so I was wondering if anyone would know how I could accomplish this?
     

    StCooler

    Mayst thou thy peace discover.
    9,301
    Posts
    4
    Years
    • Seen May 5, 2024
    I'm looking to add a requirement to my game where, in order for a Pokemon to Mega Evolve, it needs the Mega Stone, Mega Ring, AND to have a happiness level of >220 (like Pokemon that evolve via happiness). I wanted to keep players from just catching a Pokemon and being able to Mega Evolve it right away.

    I'm very new to programming, so I was wondering if anyone would know how I could accomplish this?

    Sorry for the late response, I saw your post while randomly browsing this part of the forum.
    If you haven't found the answer to the question yet, I suggest to check out the function:
    Code:
    def pbCanMegaEvolve?(idxBattler)
    Find the line:
    Code:
    return false if !pbHasMegaRing?(idxBattler)
    and add your happiness condition just below that:
    Code:
    return false if @battlers[idxBattler].happiness < 220
    It should do.
     
    21
    Posts
    3
    Years
    • Seen Sep 19, 2022
    Sorry for the late response, I saw your post while randomly browsing this part of the forum.
    If you haven't found the answer to the question yet, I suggest to check out the function:
    Code:
    def pbCanMegaEvolve?(idxBattler)
    Find the line:
    Code:
    return false if !pbHasMegaRing?(idxBattler)
    and add your happiness condition just below that:
    Code:
    return false if @battlers[idxBattler].happiness < 220
    It should do.

    Holy smokes, it works like a charm!!! Thank you so much! <3
     
    Back
    Top