It would be cool if a script could be made that allows the Developer to turn off the 8-directional movement script via switch or whatnot and also be able to re-enable it.
I Don't think its SDK compatible, but here is the script itself:
Thank you,
Draken
I Don't think its SDK compatible, but here is the script itself:
Code:
#==============================================================================
# â– Game_Player
#------------------------------------------------------------------------------
#  プレイヤーを扱ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚イベントã®èµ·å‹•åˆ¤å®šã‚„ã€ãƒžãƒƒãƒ—ã®ã‚¹ã‚¯ãƒãƒ¼ãƒ«ãªã©ã®
# 機能をæŒã£ã¦ã„ã¾ã™ã€‚ã“ã®ã‚¯ãƒ©ã‚¹ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã¯ $game_player ã§å‚ç…§ã•ã‚Œã¾ã™ã€‚
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ◠定数
#--------------------------------------------------------------------------
CENTER_X = (320 - 16) * 4 # ç”»é¢ä¸å¤®ã® X 座標 * 4
CENTER_Y = (240 - 16) * 4 # ç”»é¢ä¸å¤®ã® Y 座標 * 4
#--------------------------------------------------------------------------
# ◠通行å¯èƒ½åˆ¤å®š
# x : X 座標
# y : Y 座標
# d : æ–¹å‘ (0,2,4,6,8) ※ 0 = 全方å‘通行ä¸å¯ã®å ´åˆã‚’判定 (ジャンプ用)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# æ–°ã—ã„座標を求ã‚ã‚‹
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# 座標ãŒãƒžãƒƒãƒ—外ã®å ´åˆ
unless $game_map.valid?(new_x, new_y)
# 通行ä¸å¯
return false
end
# デãƒãƒƒã‚°ãƒ¢ãƒ¼ãƒ‰ãŒ ON ã‹ã¤ CTRL ã‚ーãŒæŠ¼ã•ã‚Œã¦ã„ã‚‹å ´åˆ
if $DEBUG and Input.press?(Input::CTRL)
# 通行å¯
return true
end
super
end
#--------------------------------------------------------------------------
# â— ç”»é¢ä¸å¤®ã«æ¥ã‚‹ã‚ˆã†ã«ãƒžãƒƒãƒ—ã®è¡¨ç¤ºä½ç½®ã‚’è¨å®š
#--------------------------------------------------------------------------
def center(x, y)
max_x = ($game_map.width - 20) * 128
max_y = ($game_map.height - 15) * 128
$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
end
#--------------------------------------------------------------------------
# ◠指定ä½ç½®ã«ç§»å‹•
# x : X 座標
# y : Y 座標
#--------------------------------------------------------------------------
def moveto(x, y)
super
# センタリング
center(x, y)
# エンカウント カウントを作æˆ
make_encounter_count
end
#--------------------------------------------------------------------------
# â— æ©æ•°å¢—åŠ
#--------------------------------------------------------------------------
def increase_steps
super
# 移動ルート強制ä¸ã§ã¯ãªã„å ´åˆ
unless @move_route_forcing
# æ©æ•°å¢—åŠ
$game_party.increase_steps
# æ©æ•°ãŒå¶æ•°ã®å ´åˆ
if $game_party.steps % 2 == 0
# スリップダメージãƒã‚§ãƒƒã‚¯
$game_party.check_map_slip_damage
end
end
end
#--------------------------------------------------------------------------
# ◠エンカウント カウントå–å¾—
#--------------------------------------------------------------------------
def encounter_count
return @encounter_count
end
#--------------------------------------------------------------------------
# ◠エンカウント カウント作æˆ
#--------------------------------------------------------------------------
def make_encounter_count
# サイコãƒã‚’ 2 個振るイメージ
if $game_map.map_id != 0
n = $game_map.encounter_step
@encounter_count = rand(n) + rand(n) + 1
end
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
# パーティ人数㌠0 人ã®å ´åˆ
if $game_party.actors.size == 0
# ã‚ャラクターã®ãƒ•ã‚¡ã‚¤ãƒ«åã¨è‰²ç›¸ã‚’クリア
@character_name = ""
@character_hue = 0
# メソッド終了
return
end
# å…ˆé ã®ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’å–å¾—
actor = $game_party.actors[0]
# ã‚ャラクターã®ãƒ•ã‚¡ã‚¤ãƒ«åã¨è‰²ç›¸ã‚’è¨å®š
@character_name = actor.character_name
@character_hue = actor.character_hue
# ä¸é€æ˜Žåº¦ã¨åˆæˆæ–¹æ³•ã‚’åˆæœŸåŒ–
@opacity = 255
@blend_type = 0
end
#--------------------------------------------------------------------------
# â— åŒä½ç½®ã®ã‚¤ãƒ™ãƒ³ãƒˆèµ·å‹•åˆ¤å®š
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
# イベント実行ä¸ã®å ´åˆ
if $game_system.map_interpreter.running?
return result
end
# 全イベントã®ãƒ«ãƒ¼ãƒ—
for event in $game_map.events.values
# イベントã®åº§æ¨™ã¨ãƒˆãƒªã‚¬ãƒ¼ãŒä¸€è‡´ã—ãŸå ´åˆ
if event.x == @x and event.y == @y and triggers.include?(event.trigger)
# ジャンプä¸ä»¥å¤–ã§ã€èµ·å‹•åˆ¤å®šãŒåŒä½ç½®ã®ã‚¤ãƒ™ãƒ³ãƒˆãªã‚‰
if not event.jumping? and event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# â— æ£é¢ã®ã‚¤ãƒ™ãƒ³ãƒˆèµ·å‹•åˆ¤å®š
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
# イベント実行ä¸ã®å ´åˆ
if $game_system.map_interpreter.running?
return result
end
# æ£é¢ã®åº§æ¨™ã‚’計算
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# 全イベントã®ãƒ«ãƒ¼ãƒ—
for event in $game_map.events.values
# イベントã®åº§æ¨™ã¨ãƒˆãƒªã‚¬ãƒ¼ãŒä¸€è‡´ã—ãŸå ´åˆ
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# ジャンプä¸ä»¥å¤–ã§ã€èµ·å‹•åˆ¤å®šãŒæ£é¢ã®ã‚¤ãƒ™ãƒ³ãƒˆãªã‚‰
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
# 該当ã™ã‚‹ã‚¤ãƒ™ãƒ³ãƒˆãŒè¦‹ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆ
if result == false
# æ£é¢ã®ã‚¿ã‚¤ãƒ«ãŒã‚«ã‚¦ãƒ³ã‚¿ãƒ¼ãªã‚‰
if $game_map.counter?(new_x, new_y)
# 1 タイル奥ã®åº§æ¨™ã‚’計算
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# 全イベントã®ãƒ«ãƒ¼ãƒ—
for event in $game_map.events.values
# イベントã®åº§æ¨™ã¨ãƒˆãƒªã‚¬ãƒ¼ãŒä¸€è‡´ã—ãŸå ´åˆ
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# ジャンプä¸ä»¥å¤–ã§ã€èµ·å‹•åˆ¤å®šãŒæ£é¢ã®ã‚¤ãƒ™ãƒ³ãƒˆãªã‚‰
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
end
end
return result
end
#--------------------------------------------------------------------------
# ◠接触イベントã®èµ·å‹•åˆ¤å®š
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
# イベント実行ä¸ã®å ´åˆ
if $game_system.map_interpreter.running?
return result
end
# 全イベントã®ãƒ«ãƒ¼ãƒ—
for event in $game_map.events.values
# イベントã®åº§æ¨™ã¨ãƒˆãƒªã‚¬ãƒ¼ãŒä¸€è‡´ã—ãŸå ´åˆ
if event.x == x and event.y == y and [1,2].include?(event.trigger)
# ジャンプä¸ä»¥å¤–ã§ã€èµ·å‹•åˆ¤å®šãŒæ£é¢ã®ã‚¤ãƒ™ãƒ³ãƒˆãªã‚‰
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
# ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã«ç§»å‹•ä¸ã‹ã©ã†ã‹ã‚’記憶
last_moving = moving?
# 移動ä¸ã€ã‚¤ãƒ™ãƒ³ãƒˆå®Ÿè¡Œä¸ã€ç§»å‹•ãƒ«ãƒ¼ãƒˆå¼·åˆ¶ä¸ã€
# メッセージウィンドウ表示ä¸ã®ã„ãšã‚Œã§ã‚‚ãªã„å ´åˆ
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# æ–¹å‘ボタンãŒæŠ¼ã•ã‚Œã¦ã„ã‚Œã°ã€ãã®æ–¹å‘ã¸ãƒ—レイヤーを移動
#made by Rpg Rpg Revolutin
case Input.dir8
when 1
move_lower_left
when 2
move_down
when 3
move_lower_right
when 4
move_left
when 6
move_right
when 7
move_upper_left
when 8
move_up
when 9
move_upper_right
end
end
# ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã«åº§æ¨™ã‚’記憶
last_real_x = @real_x
last_real_y = @real_y
super
# ã‚ャラクターãŒä¸‹ã«ç§»å‹•ã—ã€ã‹ã¤ç”»é¢ä¸Šã®ä½ç½®ãŒä¸å¤®ã‚ˆã‚Šä¸‹ã®å ´åˆ
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# マップを下ã«ã‚¹ã‚¯ãƒãƒ¼ãƒ«
$game_map.scroll_down(@real_y - last_real_y)
end
# ã‚ャラクターãŒå·¦ã«ç§»å‹•ã—ã€ã‹ã¤ç”»é¢ä¸Šã®ä½ç½®ãŒä¸å¤®ã‚ˆã‚Šå·¦ã®å ´åˆ
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# マップを左ã«ã‚¹ã‚¯ãƒãƒ¼ãƒ«
$game_map.scroll_left(last_real_x - @real_x)
end
# ã‚ャラクターãŒå³ã«ç§»å‹•ã—ã€ã‹ã¤ç”»é¢ä¸Šã®ä½ç½®ãŒä¸å¤®ã‚ˆã‚Šå³ã®å ´åˆ
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# マップをå³ã«ã‚¹ã‚¯ãƒãƒ¼ãƒ«
$game_map.scroll_right(@real_x - last_real_x)
end
# ã‚ャラクターãŒä¸Šã«ç§»å‹•ã—ã€ã‹ã¤ç”»é¢ä¸Šã®ä½ç½®ãŒä¸å¤®ã‚ˆã‚Šä¸Šã®å ´åˆ
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# マップを上ã«ã‚¹ã‚¯ãƒãƒ¼ãƒ«
$game_map.scroll_up(last_real_y - @real_y)
end
# 移動ä¸ã§ã¯ãªã„å ´åˆ
unless moving?
# å‰å›žãƒ—レイヤーãŒç§»å‹•ä¸ã ã£ãŸå ´åˆ
if last_moving
# åŒä½ç½®ã®ã‚¤ãƒ™ãƒ³ãƒˆã¨ã®æŽ¥è§¦ã«ã‚ˆã‚‹ã‚¤ãƒ™ãƒ³ãƒˆèµ·å‹•åˆ¤å®š
result = check_event_trigger_here([1,2])
# èµ·å‹•ã—ãŸã‚¤ãƒ™ãƒ³ãƒˆãŒãªã„å ´åˆ
if result == false
# デãƒãƒƒã‚°ãƒ¢ãƒ¼ãƒ‰ãŒ ON ã‹ã¤ CTRL ã‚ーãŒæŠ¼ã•ã‚Œã¦ã„ã‚‹å ´åˆã‚’除ã
unless $DEBUG and Input.press?(Input::CTRL)
# エンカウント カウントダウン
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# åŒä½ç½®ãŠã‚ˆã³æ£é¢ã®ã‚¤ãƒ™ãƒ³ãƒˆèµ·å‹•åˆ¤å®š
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
Thank you,
Draken