• 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 Conquest 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] Disabling Specific Field Moves in a Certain Map

  • 2
    Posts
    234
    Days
    • Seen Mar 10, 2025
    Hello! This is my first time posting here and it's for guidance on a scripting problem I'm having in Pokemon Essentials v21.1.

    My goal is for there to be maps with higher difficulty encounters, trainers, and puzzles - maps which I'm tentatively calling "Wilds" in my game. I want the difficulty to be something players opt into, so getting out shouldn't be easy. I'd like to disable moves like Fly, Dig, and Teleport within these maps. With my beginner understanding of Essentials, I figure the most straightforward way for me to do this is make a switch (which I've called "InWilds" and set as switch 0060), have that switch automatically turn on when a player enters the map in question, and turn it off when the player leaves. The scripts in the section Overworld_FieldMoves could then check if that switch is on, and if it is, disallow use of those field moves.

    For ease of testing, I've been working with Surf.

    This sounds to me like adding
    Ruby:
    return false if $game_switches[60]
    to the handler that checks whether the player can use Surf, like so...
    Ruby:
    HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
        return false if $game_switches[60]
        next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
        # and so on with the normal script
    ...would do the trick, but it doesn't. I can still Surf, even with the switch on, and even outside of debug mode.

    I've searched high and low for how to do this properly. I found these resources, but I haven't been able to make any of their advice work.
    Essentials wiki: https://essentialsengine.miraheze.org/wiki/Using_moves_outside_battle
    Temporarily disable HM use?: https://www.pokecommunity.com/threads/temporarily-disable-hm-use.402228/
    Disable Moves Outside Battle: https://www.pokecommunity.com/threads/disable-moves-outside-battle.400538/
    ^^ This is what I'm trying to do, but I don't want to necro that thread.

    I've tried different syntax like
    Ruby:
    next false if $game_switches[60]
    or
    Ruby:
    if $game_switches[60]
    return false
    end
    to no avail.

    Any guidance would be appreciated. Thanks!
     
    Thanks for replying!
    I have tried that, unfortunately. I've tried all of the following, and none have disabled use of Surf or had any visible effect. I am saving and compiling each time, and opening the game outside of debug mode.
    [PokeCommunity.com] Disabling Specific Field Moves in a Certain Map
    [PokeCommunity.com] Disabling Specific Field Moves in a Certain Map
    [PokeCommunity.com] Disabling Specific Field Moves in a Certain Map
    [PokeCommunity.com] Disabling Specific Field Moves in a Certain Map
    Notably, that last screenshot throws an "unexpected end" error when I try to compile. I take that to mean that "return false if..." doesn't need an "end."
     
    Back
    Top