Project1

标题: 【求助】如何在按键加速和跳跃脚本加入开关控制! [打印本页]

作者: sizheyu    时间: 2010-1-24 17:25
标题: 【求助】如何在按键加速和跳跃脚本加入开关控制!
本帖最后由 sizheyu 于 2010-1-26 20:35 编辑

我在制作一款小R剧!想加入按键加速脚本和跳跃脚本!但又不想在一开始的时候使用(得到某物品后才能使用加速和跳跃)!所以想加入开关控制!但自己还是个刚入门的小菜鸟!所以发帖求助!
(PS:本人不懂得太多关于脚本的版权问题,以下脚本都出自66PRG,如有涉及关于版权等方面的,请版主删除 )

以下是按键加速脚本:


==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保去此信息
#==============================================================================

# ▼▲▼ XRXS25. ダッシュ機能 ver.2 ▼▲▼
# by 桜雅 在土 (根本、再改訂)
# Tetra-Z (改訂原案)
#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module XRXS_Dash
#
# 按下加速键之后的速度増加量
#
PLUSPEED = 1
#
# 行走加速的按键
#
BUTTON = Input::C
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias xrxs25_update update
def update
# 例外補正
if @move_speed_arcadia == nil
@move_speed_arcadia = @move_speed
end
# 移動中、イベント実行中、移動ルート強制中、
# メッセージウィンドウ表示中、
# ダッシュボタン挿下中、のいずれでもない場合
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# 速度の変更
if Input.press?(XRXS_Dash::BUTTON)
@move_speed = @move_speed_arcadia + XRXS_Dash::PLUSPEED
else
@move_speed = @move_speed_arcadia
end
end
# 呼び戻す
xrxs25_update
end
#--------------------------------------------------------------------------
# ○ 移動タイプ : カスタム [オーバーライド]
#--------------------------------------------------------------------------
def move_type_custom
# 例外補正
if @move_speed_arcadia == nil
@move_speed_arcadia = @move_speed
end
# 標準速度に戻す
@move_speed = @move_speed_arcadia
# 呼び戻す
super
# 速度の保管
@move_speed_arcadia = @move_speed
end
end
#==============================================================================




以下是人物跳跃脚本:


在Game_Player中找到:
if Input.trigger?(Input::C)
# 同位置および正面のイベント起動断定
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
在这段下面,添加脚本段落1即可(这段下面还有3个end,段落插在3个end之前)。如果使用了行走加速
脚本,则在添加段落1后继续添加脚本段落2(还是在3个end之前),否以实现跑步的时候跳跃得更远。
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保去此信息
#==============================================================================

脚本段落1:
#========================================================================================
====
# Advanced Jump Edit By: Title Loan Man
#==============================================================================
unless $game_system.map_interpreter.running?
if Input.press?(Input::RIGHT) and Input.press?(Input::A)
if passable?(@x, @y, 4) and $game_map.terrain_tag($game_player.x+1, $game_player.y)
!= 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(2,0)
end
end
if Input.press?(Input::LEFT) and Input.press?(Input::A)
if passable?(@x, @y, 6) and $game_map.terrain_tag($game_player.x-1, $game_player.y)
!= 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(-2,0)
end
end
if Input.press?(Input::DOWN) and Input.press?(Input::A)
if passable?(@x, @y, 8) and $game_map.terrain_tag($game_player.x, $game_player.y+1)
!= 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(0,2)
end
end
if Input.press?(Input::UP) and Input.press?(Input::A)
if passable?(@x, @y, 2) and $game_map.terrain_tag($game_player.x, $game_player.y-1)
!= 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(0,-2)
end
end
if Input.trigger?(Input::A)
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(0,0)
end
end



脚本段落2:
#========================================================================================
====
# Advanced Jump Edit By: Title Loan Man
#==============================================================================
unless $game_system.map_interpreter.running?
if Input.press?(Input::RIGHT) and Input.press?(Input::A) and Input.press?(Input::C)
if passable?(@x, @y, 4)
if $game_map.terrain_tag($game_player.x+1, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x+2, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x+3, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x+4, $game_player.y) != 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(5,0)
end
end
end
end
end
end
if Input.press?(Input::LEFT) and Input.press?(Input::A) and Input.press?(Input::C)
if passable?(@x, @y, 6)
if $game_map.terrain_tag($game_player.x-1, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x-2, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x-3, $game_player.y) != 6
if $game_map.terrain_tag($game_player.x-4, $game_player.y) != 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(-5,0)
end
end
end
end
end
end
if Input.press?(Input::DOWN) and Input.press?(Input::A) and Input.press?(Input::C)
if passable?(@x, @y, 8)
if $game_map.terrain_tag($game_player.x, $game_player.y+1) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y+2) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y+3) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y+4) != 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(0,5)
end
end
end
end
end
end
if Input.press?(Input::UP) and Input.press?(Input::A) and Input.press?(Input::C)
if passable?(@x, @y, 2)
if $game_map.terrain_tag($game_player.x, $game_player.y-1) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y-2) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y-3) != 6
if $game_map.terrain_tag($game_player.x, $game_player.y-4) != 6
Audio.se_play ("Audio/SE/016-Jump02", 90, 100)
jump(0,-5)
end
end
end
end
end
end
end


#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保去此信息
#==============================================================================


以下是两个脚本的文本打包:

点击进入下载-脚本.rar


初次发求助贴!也不知道格式规格!
最后希望各位大大能帮助新人!谢谢!(最好能把完整修改后的脚本以文本的形式呈上,那太感谢了!【遭爆K,要求过分了】

请啊~
作者: zh99998    时间: 2010-1-26 13:44
1.贴脚本请用code标签
2.给你个思路,可以把定义PLUSPEED的那行去掉,所有PLUSPEED换成一个变量($game_variables)
初始赋值0,拿到某道具后赋值为1
作者: sizheyu    时间: 2010-1-26 20:30
  已经解决,谢谢沙发!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1