The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: crow5derlock on February 14, 2013, 01:52:37 PM

Title: Jumping Script [RMVXA]
Post by: crow5derlock on February 14, 2013, 01:52:37 PM
Hello, So i found a simple jumping Script here (http://www.rpgmakervxace.net/topic/6371-player-jump-via-button-press/#entry53224) and i made an edit to it, but that's not really the point.

What I need is a restriction in the script that prevents the player from jumping over more than on impassable tile, a restriction so that the player cannot jump over the sides of cliffs that are not on the same level as the character, the level being defined by a region specified by a script call.

Thank you for your time.


Code: [Select]
# Allows jumping by input...
# ** module INPUT

module JUMP
  module Settings
  DashJumpSize = 3
  JumpSize = 2
  Key = :Z # the game key that can be pressed to jump. Not necessarily the
  # same as the keyboard key
  end # End - Settings
end # End - JUMP

# ** Game_Player

class Game_Player < Game_Character

  # alias method move_by_input
  alias jump_settings_move_by_input_alias_method_49271 move_by_input
  def move_by_input
jump_settings_move_by_input_alias_method_49271
try_jump if Input.trigger?(JUMP::Settings::Key)
  end # End - move_by_input

  def try_jump

#print "inside try_jump \n"

jump_x, jump_y = 0,0
case @direction
when 2
  jump_y = get_jump_size
    $game_temp.reserve_common_event(event_id=1)
when 4
  jump_x = -get_jump_size
    $game_temp.reserve_common_event(event_id=1)
when 6
  jump_x = get_jump_size
    $game_temp.reserve_common_event(event_id=1)
when 8
  jump_y = -get_jump_size
    $game_temp.reserve_common_event(event_id=1)
end
jump(jump_x, jump_y) if map_passable?(jump_x+@x, jump_y+@y, @direction)
  end # End - try_jump

  def get_jump_size
val = dash? ? JUMP::Settings::DashJumpSize : JUMP::Settings::JumpSize
#print "jump size = #{val}\n"
#val
  end

end # End - Game_Player

Edit: My apologies I forgot to state what maker this is for. It is For RMVX Ace.
Title: Re: Jumping Script [RMVXA]
Post by: modern algebra on February 14, 2013, 11:05:22 PM
I think I will do this for you, but I am going to write a new script for it. That script doesn't allow for followers, so I want to write a script that accomodates the caterpillar.

I'm not sure on a timeline.
Title: Re: Jumping Script [RMVXA]
Post by: crow5derlock on February 15, 2013, 12:09:39 AM
Ok, Thank you MA, I appreciate it, as i'm sure many others will too.