花了点时间做了这样的脚本……因为小短篇里面需要……
  此脚本的功能就是能够按键加速,加速时扣CT,CT没了仍按着奔跑键的话,就会进入疲劳奔跑状态,
默认是:奔跑速度>疲劳奔跑速度>行走速度,不过你也可以自定义,因为这个脚本比较自由,很多东西
都可以调整……这个脚本里面还设定了当奔跑时改变行走图的设定。
  图我就不放了,各位自行试一下就知道了。
  脚本:-    #==========================================================================#  #-------------------------脚本名称:带CT的奔跑系统-------------------------# #-----------------------------作者:纸飞机哟-------------------------------##==========================================================================# #==系统相关设定== # 标有【*不可调】的请勿改动  # -控制开关  Speed_id = 2                # 开启速度影响的开关  Speed_fastspeed_id = 3      # 开启奔跑系统的开关  Speed_update = 4            # 开启刷新奔跑速度的开关  Speed_s = 5                 # 开启CT的开关    # -奔跑耐力  Speed_ct_va = 2             # 奔跑耐力的变量  Speed_ct_best = 3           # 奔跑耐力上限的变量  Speed_ct_out = 6            # 当疲累时开启的开关  $Speed_ct_m = 0             # CT的模式【1:加CT 2:减CT】*不可调  $Speed_ct_t = 100           # CT刷新的等待时间    # -奔跑速度  Speed_fastsname = "-跑步"   # 奔跑时行走图添加的名称  $Speed_move = 3             # 正常移动速度  $Speed_bestmove = 4.5       # 全速奔跑的速度  $Speed_i = Input::A         # 按这个按键加速  Speed_movep = 1/4           # 跑累时的速度【全速*减化比例+正常】  $Speed_a = 1                # 现在的行走状态【1:行走 2:奔跑 3:疲惫】*不可调  $Speed_s2 = 1               # 现在的行走状态2 *不可调   #================class Game_Player  #--------------------------------------------------------------------------  # ● 更新  #--------------------------------------------------------------------------  alias old_update update  def update # def            if $game_switches[Speed_id] == true # 如果开启速度影响                  if $game_switches[Speed_fastspeed_id] == true # 如果奔跑系统开启    unless $game_system.map_interpreter.running? or      @move_route_forcing or $game_temp.message_window_showing # 如果不在事件中        $game_switches[Speed_ct_out] = true if $game_variables[Speed_ct_va]  0        if $game_player.moving? # 如果移动中       if  Input.press?($Speed_i) # 如果按下Z键        unless Input.press?(Input::UP) and Input.press?(Input::DOWN) or              Input.press?(Input::LEFT) and Input.press?(Input::RIGHT) # 如果不同时按下相反键          speed_v_update          if @move_speed != $Speed_bestmove # 如果速度≠奔跑速度           if $game_switches[Speed_ct_out] == true # 如果疲劳            $Speed_a = 3          else            $Speed_a = 2              end # 如果疲劳            speed_character_update           end # 如果速度≠奔跑速度         else # 如果按下Z键           if @move_speed != $Speed_move # 如果速度≠正常速度             $Speed_a = 1            speed_character_update          end # 如果速度≠正常速度        end  # 如果按下Z键      else        #if @move_speed != $Speed_move # 如果速度≠正常速度             $Speed_a = 1            speed_character_update        #    end      end # 如果移动中     end    end # 如果不在事件中    old_update      unless moving? # 如果不在移动中         speed_v_update          if @move_speed != $Speed_move # 如果速度≠正常速度           $Speed_a = 1            speed_character_update           end # 如果速度≠正常速度         end # 如果不在移动中         speed_cttime if $game_switches[Speed_s] == true          end # 如果开启事件影响         end        end # defdef speed_character_update # def 行走图、速度刷新   if  $Speed_a == 2     if $Speed_a2 != 2      @move_speed = $Speed_bestmove if $Speed_a == 2 and @move_speed != $Speed_bestmove    @character_name_run = @character_name     @character_name = @character_name + "-跑步"      $Speed_a2 = 2    end  elsif   $Speed_a == 1     if $Speed_a2 != 1      @move_speed = $Speed_move if $Speed_a == 1 and @move_speed != $Speed_move    @character_name = @character_name_run unless @character_name_run == nil    $Speed_a2 = 1  end  elsif $Speed_a == 3    if $Speed_a2 != 3      @move_speed = $Speed_bestmove*Speed_movep+$Speed_move if $Speed_a == 3 and @move_speed != $Speed_bestmove*Speed_movep+$Speed_move    $Speed_a2 = 3    end   end  end # def 行走图、速度刷新    def speed_v_update # def 速度变量检测    $Speed_move = 3 if $Speed_move == nil or $Speed_move == 0    $Speed_bestmove = 4.5 if $Speed_bestmove == nil or $Speed_bestmove == 0  end # def 速度变量检测      def speed_cttime # def CT刷新    @count = 0 if @count == nil    @count += 1    if @count > $Speed_ct_t      $game_variables[Speed_ct_va] -= 2 if $Speed_a == 2      $game_variables[Speed_ct_va] += 1 if $Speed_a == 1       p $Speed_a if $game_variables[Speed_ct_va] == 0      $game_variables[Speed_ct_va] = 0 if $game_variables[Speed_ct_va] < 0      $game_variables[Speed_ct_va] = $game_variables[Speed_ct_best] if $game_variables[Speed_ct_va] > $game_variables[Speed_ct_best]      @count = 0    end  end # def CT刷新end 复制代码
 
  复制代码             本帖来自P1论坛作者纸飞机哟,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=211932  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。   |