- 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
to the handler that checks whether the player can use Surf, like so...
...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
or
to no avail.
Any guidance would be appreciated. Thanks!
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]
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
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]
Ruby:
if $game_switches[60]
return false
end
Any guidance would be appreciated. Thanks!