• 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!
  • 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] Heal Pokemon over time (Overworld)

  • 4
    Posts
    2
    Years
    • Seen Dec 2, 2022
    Hoping someone can help me here. I'm looking to replace Pokecenters with healing over time. Preferably it would be tied to steps taken if not time itself, and ideally would be restricted to Pokemon in a PC Box.

    I see the game primarily uses "Recover All" when healing at Pokecenters and not a script call.

    Any advice?
     
    Great idea!

    I found the relevant code that calculates Poison as well as Happiness on step.

    Happiness:
    Spoiler:



    Poison:
    Spoiler:


    I think it should be easy to just add a third option in this area for healing, but could still use some guidance on how to correctly incorporate the below underlined areas.

    # Heal Party Pokémon
    EventHandlers.add(:on_player_step_taken_can_transfer, :heal_party,
    proc { |handled|
    # handled is an array: [nil]. If [true], a transfer has happened because of
    # this event, so don't do anything that might cause another one
    next if handled[0]
    pkmn.hp += 1 if pkmn.hp < pkmn.totalhp
    end
    }

    1.) What does the :poison_party and :gain_happiness commands do, and do I need to create :heal_party somewhere?
    2.) Am I using totalhp correctly here?
     
    Your code appears to be correct. I would suggest a larger HP gain rate for higher-level Pokémon unless you want to take hundreds of steps to fully heal a Pokémon. Perhaps an HP gain by a ceiling quotient of totalhp by the maximum number of steps as shown here:
    Code:
    hpgain = (pkmn.totalhp / maxSteps).ceil
     
    Back
    Top