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

Pokemon Happiness

zingzags

PokemonGDX creator
536
Posts
15
Years
  • How exactly does happiness work in essentials?
    Also do any of you know the name of the graph thats in d/p/pt summary screen?
     

    FL

    Pokémon Island Creator
    2,453
    Posts
    13
    Years
    • Seen May 10, 2024
    Wrong.

    To fix change every happiness moddification (search for ".happiness") in script to Happiness.modify(pokemon, gaintype) where the gaintype is one of the nine variables in script like Happiness::LEVELUP and Happiness::VITAMIN. You also need to call scene.pbRefresh after calling the "modify" at battle use of ENERGYPOWDER, ENERGYROOY and HEALPOWDER. In REVIVALHERB code I can't manage to make this work, in this code I can't call a module on it for some reason without messing with scene. I need to put the code manually in this section.
    Code:
    module Happiness
     LEVELUP=1
     STEPS256=2
     VITAMIN=3
     BERRY=4
     FAINT=5
     ENERGYPOWDER=6
     ENERGYROOT=7
     HEALPOWDER=8
     REVIVALHERB=9
     
     def self.modify(pokemon, gaintype)
      happinessgain=0
      if (gaintype==Happiness::LEVELUP || gaintype==Happiness::VITAMIN)
       if pokemon.happiness>199
         happinessgain=2
       elsif pokemon.happiness>99
         happinessgain=3
       else
         happinessgain=5
       end
      elsif (gaintype==Happiness::BERRY)
       if pokemon.happiness>199
         happinessgain=2
       elsif pokemon.happiness>99
         happinessgain=5
       else
         happinessgain=10
       end
      elsif (gaintype==Happiness::STEPS256)
       happinessgain=1
      elsif (gaintype==Happiness::FAINT)
       happinessgain=-1
      elsif (gaintype==Happiness::ENERGYPOWDER || gaintype==Happiness::HEALPOWDER)
       if pokemon.happiness>199
         happinessgain=-10
       else
         happinessgain=-5
       end
      elsif (gaintype==Happiness::ENERGYROOY)
       if pokemon.happiness>199
         happinessgain=-15
       else
         happinessgain=-10
       end
      elsif (gaintype==Happiness::REVIVALHERB)
       if pokemon.happiness>199
         happinessgain=-20
       else
         happinessgain=-15
       end
      end
    
      if isConst?(pokemon.item,PBItems,:SOOTHEBELL) && happinessgain>1
        pokemon.happiness+=((3*happinessgain)/2)
      else
        pokemon.happiness+=happinessgain
      end
      pokemon.happiness=255 if pokemon.happiness>255
      pokemon.happiness=0 if pokemon.happiness<0
     end
    end

    What graph? The Poffin (Contest status) ones?
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • I never modified anything, I was asking how exactly it work, but thanks. And yes the poffin attributes.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Searching for the word "happiness" in the scripts will give you all the examples of how happiness works, so you can see for yourself.
     
    Back
    Top