• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!

Disabling Specific Field Moves in a Certain Map?

Dorktoid

Rookie
Member
Joined
Sep 8, 2024
Posts
2
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:
Expand Collapse Copy
return false if $game_switches[60]
to the handler that checks whether the player can use Surf, like so:
Ruby:
Expand Collapse Copy
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've searched high and low for how to do this properly. I found several resources:
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/
Notably, that third link is exactly what I want to do, but I don't want to necro that thread.

I've tried the following script edits, but none have worked.
Ruby:
Expand Collapse Copy
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
    return false if $game_switches[60]
    next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
Ruby:
Expand Collapse Copy
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
    if $game_switches[60] then return false
    next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
Ruby:
Expand Collapse Copy
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
    if $game_switches[60]
        return false
    end
    next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
Any guidance would be appreciated. Thanks!
 
Last edited:

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
683
Have you tried editing the line that checks if the player has the badge needed to use surf outside of battle?
You could try something like this: next false if $game_switches[60] || !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg).
 

Dorktoid

Rookie
Member
Joined
Sep 8, 2024
Posts
2
I hadn't tried that, no! Thanks for the suggestion.
...Regrettably, that also didn't prevent me from using Surf, even with switch 60 turned on and outside of debug mode.

On the subject of the Surf badge, I'm starting to think it may be more applicable to temporarily remove badges within these specific maps, rather than use a switch. The most frustrating thing about this is that I can't see why the switch isn't working, just that it isn't.
 
Back
Top