Plugin : Manage staircase speed

1 Replies • 534 Views

Eurons

Mappeur

Hello,
here is a plugin allowing you to manage the speed of your stairs.
Be careful, it doesn't manage comma values (you would have problems with the maplink) and unfortunately I haven't found a solution.

class Game_Character
  def move_speed
      return (@in_swamp == 1 ? 2 : 1) if @in_swamp
      move_speed = original_move_speed
      #marche ou courir
      if move_speed <= 3
        direction = @direction
        sys_tag = system_tag
        if (direction == 6 && (sys_tag == StairsR || $game_map.system_tag(@x - 1, @y) == StairsL)) ||
          (direction == 4 && (sys_tag == StairsL || $game_map.system_tag(@x + 1, @y) == StairsR))
          move_speed -= 1
        elsif (sys_tag == StairsU || sys_tag == StairsD)
          move_speed += 1
        end
      end
      return move_speed
  end

  def update_real_position
      distance = (2**move_speed).round.to_i
      @real_y = [@real_y + distance, @y * 128].min if @y * 128 > @real_y
      @real_x = [@real_x - distance, @x * 128].max if @x * 128 < @real_x
      @real_x = [@real_x + distance, @x * 128].min if @x * 128 > @real_x
      @real_y = [@real_y - distance, @y * 128].max if @y * 128 < @real_y
  end
end

Crédit :
Metaiko
Marc_Robin
Eurons

« Last Edit: 28 March 2022, 19:42:16 by Eurons »

Script Tuto Script PSDK Tuto Making

Eurons

Mappeur

Bonjour,

vous pouvez maintenant utilisez des chiffres à virgules, ce qui rend plus modulaire le plugin.

Hello,

you can now use comma-delimited numbers, which makes the plugin more modular.

There was an error while thanking
Thanking...