• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] Making Pokemon disobey based on happiness

  • 2
    Posts
    3
    Years
    • Seen May 29, 2022
    Hello! I'm giving a shot at scripting and I've been struggling to find a way to change the disobey function to also work based on the pokemon's Happiness!

    Can someone please give me a hand?

    Thanks in advance!
     
    Unfortunately, seeing the way it works in v18 and v19, you will need to make a new (but similar) function.
    Can you elaborate on the behaviour you would like?
     
    I was thinking in a way to make interacting with your Pokémon a more relevant mechanic. So by using berries or special interactions you'd grow its affection and by neglecting it for too long it would cause the Pokémon to disobey you.

    Since Happiness exists already, I thought it would be easier to just modify it. Do you have any suggestions on how to achieve something similar to this?
     
    Last edited:
    Go to the scripts and search (CTRL + SHIFT + F) for:
    Code:
    def pbObedienceCheck?(choice)

    Paste the bold part in
    (return pbDisobey(choice, badgeLevel) if @pokemon.happiness < 120)
    Code:
      def pbObedienceCheck?(choice)
        return true if usingMultiTurnAttack?
        return true if choice[0]!=:UseMove
        return true if [email protected]
        return true if [email protected]?(@index)
        disobedient = false
        # Pokémon may be disobedient; calculate if it is
        badgeLevel = 10 * (@battle.pbPlayer.badge_count + 1)
        badgeLevel = GameData::GrowthRate.max_level if @battle.pbPlayer.badge_count >= 8
        if @pokemon.foreign?(@battle.pbPlayer) && @level>badgeLevel
          a = ((@level+badgeLevel)*@battle.pbRandom(256)/256).floor
          disobedient |= (a>=badgeLevel)
        end
        [B]return pbDisobey(choice, badgeLevel) if @pokemon.happiness < 120[/B]
        disobedient |= !pbHyperModeObedience(choice[2])
        return true if !disobedient
        # Pokémon is disobedient; make it do something else
        return pbDisobey(choice,badgeLevel)
      end

    Notice that @pokemon.happiness is set to < 120 - that means that your Pokemon will disobey if its happiness is less than 120.
     
    I did it in my own fangame.

    [PokeCommunity.com] Making Pokemon disobey based on happiness


    That said, implementing this is complicated on a Pokémon vanilla game. Not in terms of coding, but in terms of balancing and implementation. My own implementation is complex (it uses a second value in parallel to friendship: the dread) and there have been dozens of pages of game design written about it. (I would have liked to put the link, but it is only in French for the moment).

    The first obstacle is the basic friendship: 70 in the vast majority of cases. Therefore, where to put the threshold of disobedience?
    The second obstacle is punitiveness. It will be very annoying for the player if (almost) every new captured Pokémon disobeys him (the fault of the 70 of friendship at the beginning). Therefore, it is important to make sure that (with some exceptions) a freshly captured Pokémon does not disobey.
    The third obstacle is the very conception of friendship: Game Freak wants its games to be accessible to the youngest age, so we must not frustrate the players! Thus, the friendship almost never drops, only increase. Fainting results in a negligible penalty and the only other method is bitter herbs that require an explicit action from the player.
    Finally, it will be necessary to adjust the probability of disobedience to avoid threshold effects.

    So we need to correct and rebalance the possible variations of friendship, as well as the starting friendship for all Pokémons.
     
    Back
    Top