[RMXP] Dash Script

December 11, 2009

Script by: パラ犬

http://rpg.para.s3p.net/

This script enables your player to walk faster when holding a certain key whilst moving.

#==============================================================================
# ++ グラフィック変更ダッシュ ver. 1.11 ++
#  Script by パラ犬
#  http://rpg.para.s3p.net/
#——————————————————————————
# 「Graphics/Characters」フォルダに
# 「(先頭キャラの歩行グラフィック名)+_dash」という名前のファイルがある場合
# ダッシュ時のグラフィックとして使用します。(例:001-Fighter01_dash)
#==============================================================================

class Game_Player < Game_Character

SPEED_DASH = 4 # ダッシュ時の移動速度
SPEED_NORMAL = 3 # 通常の移動速度

# ダッシュに使うボタン(表記方法は、Input::(ボタン))
#(キーボードとの対応表はツクールのヘルプにあります)
KEY_DASH = Input::Y

# “_dash”グラフィックが存在しない場合ダッシュをするか( true:する / false:しない )
NO_FILE_DASH = true

# ダッシュ禁止イベントスイッチID
# (イベントコマンド「スイッチの操作」でこの番号のスイッチをONにしている間は
# ダッシュを機能を無効にします)
NO_DASH_SWITCH = 999

end

#==============================================================================
# ■ Game_Player
#==============================================================================

class Game_Player < Game_Character

#————————————————————————–
# ● フレーム更新
#————————————————————————–
alias dash_update update
def update
# 移動中、イベント実行中、移動ルート強制中、
# メッセージウィンドウ表示中のいずれでもない場合
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if !($game_switches[NO_DASH_SWITCH])
# キー判定
if Input.press?(KEY_DASH)
if (dash_graphic_exist?($game_party.actors[0]) or NO_FILE_DASH)
# ダッシュ中でなければダッシュ
if @move_speed != SPEED_DASH
@move_speed = SPEED_DASH
@dash_on = true
$game_player.refresh
end
end
elsif @dash_on == nil or @dash_on
@move_speed = SPEED_NORMAL
@dash_on = nil
$game_player.refresh
end
end
end
dash_update
end
#————————————————————————–
# ○ ダッシュグラフィックの有無をチェック
#————————————————————————–
def dash_graphic_exist?(actor)
# 読み込みテスト
begin
RPG::Cache.character(actor.character_name.to_s + “_dash”, actor.character_hue)
rescue
return false
end
return true
end
#————————————————————————–
# ● リフレッシュ
#————————————————————————–
alias dash_refresh refresh
def refresh
dash_refresh
# パーティ人数が 0 人でない場合
if $game_party.actors.size != 0
actor = $game_party.actors[0]
# キャラクターのファイル名と色相を設定
if @dash_on and dash_graphic_exist?(actor)
fileplus = “_dash”
else
fileplus = “”
end
@character_name = actor.character_name + fileplus
@character_hue = actor.character_hue
end
end
end

Place script before Main.

SPEED_DASH = 4 # ダッシュ時の移動速度

Changing this part of the script decides what speed your character does when pressing the dash button. 6 is really fast and 1 is really slow. I suggest 4 is a good speed.

SPEED_NORMAL = 3 # 通常の移動速度

Changing this part of the script decides what speed your character does when the dash button is not pressed. 3 is the average speed which the player walks in XP.

KEY_DASH = Input::Y

Changing this part of the script decides what button the dash button is in your game.

NO_DASH_SWITCH = 999

This is the number of the switch which you can use to enable and disable the dash button.

Enjoy. Credit パラ犬 if possible however the website is not currently online.