- Joined
- Jun 2, 2019
- Messages
- 20
- Reaction score
- 1
- First Language
- English
- Primarily Uses
- RMVXA
I'm looking to enable/disable player's movement in a specific direction with a script call.
But they should still be able to turn in that direction and interact with things. Just not move.
So disabling the whole input, like this script here...
is not suitable.
Also, I'm planning to use this to circumvent autotile's lack of directional passability, so if you know of any solutions to that specifically, that would also be helpful.
Thanks.
But they should still be able to turn in that direction and interact with things. Just not move.
So disabling the whole input, like this script here...
Code:
#==============================================================================
# @> Disable Move to Direction ~ Karin's Soulkeeper, 2015
#------------------------------------------------------------------------------
# v1.0 - May 23 : Started & finished.
#------------------------------------------------------------------------------
# * Description:
# This script disables movement in a specified direction.
#------------------------------------------------------------------------------
# * To Use:
# Put this script below Materials and above Main.
#
# To enable/disable a direction, perform the script call:
# enable_move(:SYMBOL)
# disable_move(:SYMBOL)
# ~ Where :SYMBOL is any of the symbols specified in the module below.
#------------------------------------------------------------------------------
# * Compatibility:
# This script aliases Game_Player.move_by_input
#------------------------------------------------------------------------------
# * Terms:
# Free to use in any kind of project, with or without credit. I wouldn't
# really mind. Though I'd appreciate it! (^w^)/
# Just don't, you know, claim that you made this here script yourself,
# Because that's just mean (._.)
#==============================================================================
#CUSTOMIZATION OPTIONS
module KS
module Disabled_Dirs
#--------------------------------------------------------------------------
# Set the symbol names and their corresponding direction.
#--------------------------------------------------------------------------
# - No need to change, unless if you have Diagonal Movement, or something.
#--------------------------------------------------------------------------
INPUT = {
:DOWN => 2,
:LEFT => 4,
:RIGHT => 6,
:UP => 8
}# FFS, DO NOT REMOVE
# END OF CUSTOMIZATION OPTIONS
Disabled = []
end
end
#==============================================================================
# ** Modified Class: Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * New: Disable Direction
#--------------------------------------------------------------------------
def disable_move(dir)
dir = KS::Disabled_Dirs::INPUT[dir]
KS::Disabled_Dirs::Disabled.push(dir) unless KS::Disabled_Dirs::Disabled.include?(dir)
end
#--------------------------------------------------------------------------
# * New: Enable Direction
#--------------------------------------------------------------------------
def enable_move(dir)
dir = KS::Disabled_Dirs::INPUT[dir]
KS::Disabled_Dirs::Disabled.delete(dir) if KS::Disabled_Dirs::Disabled.include?(dir)
end
end
#==============================================================================
# ** Aliased Class: Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias: Processing of Movement via Input from Directional Buttons
#--------------------------------------------------------------------------
alias move_by_input_orig move_by_input
def move_by_input
return if KS::Disabled_Dirs::Disabled.include?(Input.dir4)
move_by_input_orig
end
end
Also, I'm planning to use this to circumvent autotile's lack of directional passability, so if you know of any solutions to that specifically, that would also be helpful.
Thanks.
Last edited:





