'Jump implementation' script v1.0
(I decided it's a fair name)
What's this?
This is something I haven't seen yet around, (probably I just missed all the relevant search results) this enables a jump function for your game.
Details
Script
Other
This script shall not affect the built-in jump function of Game_Character. The script modifies the move_by_input function, and does not even call the jump function, checks passability in place, so if you make your character jump by defining a move route, it still may jump out of the map, or onto inpassable tiles!
If you're familiar with scripts, you can reverse the switch check, so you can jump, if it is OFF.
Other other
I'm really interested in your opinions, because it is my first RM script ever, and I'm still in search of directions. Also please tell me, if such a script already can be found on this board. :tongue:
And the general sorry for bad english. Demo coming soon, if you wish. Thanks!
Ducktor
(I decided it's a fair name)
What's this?
This is something I haven't seen yet around, (probably I just missed all the relevant search results) this enables a jump function for your game.
Details
- Jumps 2 tiles long (if can't, jumps only 1 tile)
- Doesn't allow to jump over characters (events with priority 'Same as Characters')
- Compatible with Trickster's caterpillar script modified by Diedrupo (sorry, I've found it on another site, so I can't give you a link)
- You can define a switch which must be turned ON to let you jump (default Switch 001).
- Jumps by pressing the controller's X button (by default A on you keyboard).
- Now you can't jump with a vehicle.
- You can define a sound to play when jumping
- Two control behaviour: jump continuously when pressing X or jump once when pressed (something beta)
- Now the character jumps zero tile if can't jump anywhere.
- Now the poisoned characters get damage equal to the jump length.
- While jumping, a stepping part of the walk animation is shown to look better.
Script
Code:
#==============================================================================
# ** Game_Player jump modifications
#------------------------------------------------------------------------------
# Blabla this script enables you to jump with the X controller button (def. A)
#==============================================================================
class Game_Player
JUMPSWITCH = 1 # This switch indicates the possibility of jumping
CATERPILLAR = false # Set this true, if you're using the caterpillar script
JUMPSOUND = "Audio\\SE\\Jump2" # You can define a sound played when jumping
# Leave empty to play nothing
BUTTON_BEHAVIOUR = 2 # 1 for countinous jump when pressed, 2 for jump once
# per button press
@jumpbutton = false
alias_method :ducktor_jump_movable?, :movable?
def movable?
return false if jumping?
ducktor_jump_movable?
end
alias_method :ducktor_jump_move_by_input, :move_by_input
def move_by_input
ducktor_jump_move_by_input
if Input.press?(Input::X) and (not $game_switches[JUMPSWITCH]) and movable? and (not in_vehicle?)
return if @jumpbutton and (BUTTON_BEHAVIOUR == 2)
case @direction
when 2
if passable?(@x,@y+2)
unless collide_with_characters?(@x,@y+1)
$game_party.update_move(5, 0, 2) if CATERPILLAR
@y += 2
distance = 2
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
elsif passable?(@x,@y+1)
$game_party.update_move(5, 0, 1) if CATERPILLAR
@y += 1
distance = 1
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
when 4
if passable?(@x-2,@y)
unless collide_with_characters?(@x-1,@y)
$game_party.update_move(5, -2, 0) if CATERPILLAR
@x -= 2
distance = 2
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
elsif passable?(@x-1,@y)
$game_party.update_move(5, -1, 0) if CATERPILLAR
@x -= 1
distance = 1
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
when 6
if passable?(@x+2,@y)
unless collide_with_characters?(@x+1,@y)
$game_party.update_move(5, 2, 0) if CATERPILLAR
@x += 2
distance = 2
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
elsif passable?(@x+1,@y)
$game_party.update_move(5, 1, 0) if CATERPILLAR
@x += 1
distance = 1
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
when 8
if passable?(@x,@y-2)
unless collide_with_characters?(@x,@y-1)
$game_party.update_move(5, 0, -2) if CATERPILLAR
@y -= 2
distance = 2
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
elsif passable?(@x,@y-1)
$game_party.update_move(5, 0, -1) if CATERPILLAR
@y -= 1
distance = 1
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
$game_party.on_player_walk
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
else
distance = 0
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
end
end
end
@jumpbutton = jumping? ? Input.press?(Input::X) : false
end
end
class Game_Character
alias_method :ducktor_jump_update_jump, :update_jump
#--------------------------------------------------------------------------
# * Update While Jumping
#--------------------------------------------------------------------------
def update_jump
ducktor_jump_update_jump
@anime_count = 20
end
end
Other
This script shall not affect the built-in jump function of Game_Character. The script modifies the move_by_input function, and does not even call the jump function, checks passability in place, so if you make your character jump by defining a move route, it still may jump out of the map, or onto inpassable tiles!
If you're familiar with scripts, you can reverse the switch check, so you can jump, if it is OFF.
Other other
I'm really interested in your opinions, because it is my first RM script ever, and I'm still in search of directions. Also please tell me, if such a script already can be found on this board. :tongue:
And the general sorry for bad english. Demo coming soon, if you wish. Thanks!
Ducktor