Version: 1.0Author: The Staff of RGSS2Dai PageTranslation: SuperMegaIntroductionThis is a translation of a fantastic script from
Dai Page. I AM NOT the creator of this script, so I don't deserve full credit. I only translated the script, in order to share it with the English community. The primary functions of the script are translated, but not everything is. If anyone would like everything to be translated, please let me know. Let me also mention I can only help with basic problems, and not ones that involve the script.
Features-Diagonal (8 Direction) movement!
-Jump while standing, and moving
-High jump while moving
-Equipment that causes the jumping to work if equipped
-Switch functionality that will turn off the jump ability if neccessary
-Optional auto dash
-Change the jump button to your liking!
-Easy to use, user friendly!
Script<div style="margin:20px; margin-top:5px"><div style="margin-bottom:2px">
[Show/Hide] The script...</div><div style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;">
CODE
=begin
#-------------------------------------------------------------------------------
Move Diagonally and Jump Smoothly
Original Japanese Version From: RGSS2 DAIpage
English Translation By: SuperMega
--------------------------------------------------------------------------------
Script Features and Directions:
Move Diagonally + Optimization:
Proceed in an direction and input the jump button while holding a
directional button to jump.
In addition, you can optimize the controls by making the input button close or
comfortable for the player while using the arrow keys
There is no feature to jump while moving in a diagonal direction.
The High Jump Ability:
The original jump distance of two cells (spaces) can be increased to 3 cells
with the use of high jump.
You can also create equipment that will be able to use jump. If you do not have
that equipment on, then the player won't be able to jump
If you do not want the player to be able to jump, you can deactivate it by a
script in the customization below.
If you want the player to be able to jump over something, make sure that the
player has enough space to do so.
Movement speed adjustment:
Change the default movement speed.
�€€NANAME_SPEED:
The jump speed. Default is 4. The higher the number is, the faster.
Dash features all the time:
A dash to the state at all times regardless of input.
�€€AUTO_DASH:
The player will dash on their own.
true = Enable false = Disabled
This Script has redefined:
�€€Game_Character
�€€Game_Player < Game_Character
�€€Changing this script may result in compatability errors, so do so at your own
risk...
=end
#==============================================================================
# Begin Customization
#==============================================================================
module DAI
# Set diagonal movement
NANAME = true #Allow Diagonal movement (8 direction)?
#Speed and Dash settings
SPEED = 4 #The player speed. Default is 4. 5 and 6 is the
#speed of light!
AUTO_DASH = false # Allow Auto Dash?
# Jump Settings
JUMP = true # Allow Jump? (2 cells)
HIJUMP = true # Allow High Jump (3 cells)
JUMP_INPUT = Input::X # Button used for jumping
JUMP_SE = RPG::SE.new("jump1", 60, 100) # SE for jumping (Name,Pitch,Vol.)
# Disable Jump Switch
JUMP_OP = 10 # Turn on this switch to disable jumping
# Equipment Settings
JUMP_ARMOR = 31 #ID of the Equipment using jump.
#If the number is 0, jump is always on.
HIJUMP_ARMOR = 32 # ID of the Equipment using high jump.
#If the number is 0, high jump will always be on
end
#==============================================================================
# End Customization
#==============================================================================
#==============================================================================
# �–� Game_Player
#------------------------------------------------------------------------------
# �€€�ƒ—�ƒ��‚��ƒ��ƒ��‚’�‰���†�
‚��ƒ��‚�で��™�€‚�‚��ƒ™�ƒ��ƒˆの
�‹•�ˆ���š�‚„�€��ƒ
ž�ƒƒ�ƒ—の�‚��‚��ƒ��ƒ��ƒ�などの
# ��Ÿ�ƒ��‚’�Œ�って��„ま��™�€‚��“
�‚��ƒ��‚�の�‚��ƒ��‚��‚��ƒ��‚
は $game_player で��‚�…���•�‚Œま��™�€‚
#==============================================================================
#--------------------------------------------------------------------------
# �—� �–���‘�ƒœ�‚��ƒ��…��Š›に�‚ˆ�‚‹
�‹•�‡���†��ˆ�†���š義��‰
#--------------------------------------------------------------------------
class Game_Player < Game_Character
def move_by_input
if @jump_Reservation && jump_movable? # �‚��ƒ��ƒ��ƒ—��ˆ��„中で�‚��ƒ��ƒ
�ƒ—��Œ可�ƒ���Ÿ
unless $game_map.interpreter.running? or jumping?
jump_down if @direction == 2
jump_left if @direction == 4
jump_right if @direction == 6
jump_up if @direction == 8
return
end
end
unless movable?
if Input.trigger?(DAI::JUMP_INPUT) && in_vehicle? == false &&
@jump_Reservation == false && dai_jump_possible?
@jump_Reservation = true # �‚��ƒ��ƒ��ƒ—��ˆ��„
return
else
return
end
end
if jumping? or $game_map.interpreter.running?
@jump_Reservation = false # �‚��ƒ��ƒ��ƒ—��ˆ��„解�™�
return
end
if DAI::NANAME
mood = Input.dir8
else
mood = Input.dir4
end
speed = DAI::SPEED
@move_speed = speed if $game_player.vehicle_type == -1 # ��’歩な�‚‰�€Ÿ度��‰�›�
if Input.trigger?(DAI::JUMP_INPUT) && dai_jump_possible? && in_vehicle? == false
case mood
when 0 then jump(0, 0)
DAI::JUMP_SE.play
@jump_Reservation = false
when 2 then jump_down
when 4 then jump_left
when 6 then jump_right
when 8 then jump_up
when 1 then jump_down if @direction == 2
jump_left if @direction == 4
when 3 then jump_down if @direction == 2
jump_right if @direction == 6
when 7 then jump_left if @direction == 4
jump_up if @direction == 8
when 9 then jump_right if @direction == 6
jump_up if @direction == 8
end
else
case mood
when 2 then move_down
when 4 then move_left
when 6 then move_right
when 8 then move_up
when 1 then move_lower_left
when 3 then move_lower_right
when 7 then move_upper_left
when 9 then move_upper_right
end
end
end
#--------------------------------------------------------------------------
# �—� ��ˆ��„�‚��ƒ��ƒ��ƒ—の�ˆ�御�ˆ���š
��ˆ追�Š���š義��‰
#--------------------------------------------------------------------------
def jump_movable?
return false if @move_route_forcing # 移�‹•�ƒ��ƒ��ƒˆ強�ˆ�中
return false if @vehicle_getting_on # ��—�‚‹�‹•��œの�€”中
return false if @vehicle_getting_off # �™��‚Š�‚‹�‹•��œの�€”中
return false if $game_message.visible # �ƒ��ƒƒ�‚��ƒ��‚�表示中
return false if in_airship? and not $game_map.airship.movable?
return true
end
end
#==============================================================================
# �–� Game_Character
#------------------------------------------------------------------------------
# �€€�‚��ƒ��ƒ��‚��‚��ƒ��‚’�‰�
�†�‚��ƒ��‚�で��™�€‚��“の�‚��ƒ
�‚�は Game_Player �‚��ƒ��‚�と Game_Event
# �‚��ƒ��‚�の�‚��ƒ��ƒ‘�ƒ��‚��ƒ�
‚�と��—て使�”���•�‚Œま��™�€‚
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# �—� 移�‹•�™‚の�›��–���ˆ�†���š義��‰
#--------------------------------------------------------------------------
def update_move
distance = (2 ** @move_speed) # 移�‹•�€Ÿ度��‹�‚‰移�‹•距�›�に��‰�
�›
if DAI::AUTO_DASH
distance *= 2 # �‚��ƒ��ƒˆ�ƒ€�ƒƒ�‚��ƒ�ONな�‚‰常に�
�に
else
distance *= 2 if dash? # �‚��ƒ��ƒˆ�ƒ€�ƒƒ�‚��ƒ�OFF�™‚�€��
ƒ€�ƒƒ�‚��ƒ��Š��…‹な�‚‰�€�に
end
if @x * 256 != @real_x and @y * 256 != @real_y # �–œ�‚�移�‹•�™‚は�€Ÿ度調�•�
distance = (distance / 1.4).to_i
end
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
#--------------------------------------------------------------------------
# �—� �‚��ƒ��ƒ��ƒ—可�ƒ��ˆ���š��ˆ追�Š�
�š義��‰
#--------------------------------------------------------------------------
def dai_jump_possible?
return false unless DAI::JUMP
return false if $game_switches[DAI::JUMP_OP]
return true if DAI::JUMP_ARMOR == 0
b = []
for i in 0...$game_party.members.size # �ƒ‘�ƒ��ƒ†�‚��ƒ��†…に�Œ‡��š��…
‚™��Œ��‚�‚‹��‹��œ索
actor = $game_party.members[i]
b.push(actor.armors.include?($data_armors[DAI::JUMP_ARMOR]))
end
if b.include?(true)
return true
else
c =[]
for i in 0...$game_party.members.size # �ƒ‘�ƒ��ƒ†�‚��ƒ��†…に�Œ‡��š��…
‚™��Œ��‚�‚‹��‹��œ索
actor = $game_party.members[i]
c.push(actor.armors.include?($data_armors[DAI::HIJUMP_ARMOR]))
end
if c.include?(true)
return true
else
return false
end
end
end
#--------------------------------------------------------------------------
# �—� �ƒ��‚��‚��ƒ��ƒ��ƒ—可�ƒ��ˆ���š�
�ˆ追�Š���š義��‰
#--------------------------------------------------------------------------
def dai_hi_jump_possible?
return false unless dai_jump_possible?
return false unless DAI::HIJUMP
return true if DAI::HIJUMP_ARMOR == 0
b = []
for i in 0...$game_party.members.size # �ƒ‘�ƒ��ƒ†�‚��ƒ��†…に�Œ‡��š��…
‚™��Œ��‚�‚‹��‹��œ索
actor = $game_party.members[i]
b.push(actor.armors.include?($data_armors[DAI::HIJUMP_ARMOR]))
end
if b.include?(true)
return true
else
return false
end
end
#--------------------------------------------------------------------------
# �—� 左��‹に移�‹•��ˆ1��‰追�Š���š義
#--------------------------------------------------------------------------
def move_lower_left # �–���‘�‚��ƒ���Œ左��‹に�…��Š›�
•�‚Œて��„�‚‹場��ˆの�‡���†
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
pa = passable?(@x, @y +1) # ��‹��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x -1, @y) # 左��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x -1, @y +1) # 左��‹��Œ�€š��Œ可�ƒ���‹��Ÿ
if pa && pb && pc # ��Š��˜��‰�–���‘��Œ�€š��Œ可�ƒ�
�‚‰左��‹に移�‹•
@x = $game_map.round_x(@x -1)
@real_x = (@x +1) * 256
@y = $game_map.round_y(@y +1)
@real_y = (@y -1) * 256
increase_steps # �–œ�‚�移�‹•�™‚の歩�•��‚’�Š���—
else
if @direction == 2 # ��‹�‚’��‘��„て��„�‚‹場��ˆ
if pb; move_left # 左��Œ�€š��Œ可�ƒ�な�‚‰左に移�‹•
else
move_down if pa # ��‹��Œ�€š��Œ可�ƒ�な�‚‰左に移�‹•
end
elsif @direction == 4 # 左�‚’��‘��„て��„�‚‹場��ˆ
if pa; move_down # ��‹��Œ�€š��Œ可�ƒ�な�‚‰��‹に移�‹•
else
move_left if pb # 左��Œ�€š��Œ可�ƒ�な�‚‰左に移�‹•
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# �—� 右��‹に移�‹•��ˆ3��‰追�Š���š義
#--------------------------------------------------------------------------
def move_lower_right # �–���‘�‚��ƒ���Œ右��‹に�…��Š›�
•�‚Œて��„�‚‹場��ˆの�‡���†
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
pa = passable?(@x, @y +1) # ��‹��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x +1, @y) # 右��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x +1, @y +1) # 右��‹��Œ�€š��Œ可�ƒ���‹��Ÿ
if pa && pb && pc # ��Š��˜��‰�–���‘��Œ�€š��Œ可�ƒ�
�‚‰右��‹に移�‹•
@x = $game_map.round_x(@x +1)
@real_x = (@x -1) * 256
@y = $game_map.round_y(@y +1)
@real_y = (@y -1) * 256
increase_steps # �–œ�‚�移�‹•�™‚の歩�•��‚’�Š���—
else
if @direction == 2 # ��‹�‚’��‘��„て��„�‚‹場��ˆ
if pb; move_right # 右��Œ�€š��Œ可�ƒ�な�‚‰右に移�‹•
else
move_down if pa # ��‹��Œ�€š��Œ可�ƒ�な�‚‰��‹に移�‹•
end
elsif @direction == 6 # 右�‚’��‘��„て��„�‚‹場��ˆ
if pa; move_down # ��‹��Œ�€š��Œ可�ƒ�な�‚‰��‹に移�‹•
else
move_right if pb # 右��Œ�€š��Œ可�ƒ�な�‚‰右に移�‹•
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# �—� 左��Šに移�‹•��ˆ7��‰追�Š���š義
#--------------------------------------------------------------------------
def move_upper_left # �–���‘�‚��ƒ���Œ左��Šに�…��Š›��
•�‚Œて��„�‚‹場��ˆの�‡���†
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
pa = passable?(@x, @y -1) # ��Š��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x -1, @y) # 左��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x -1, @y -1) # 左��Š��Œ�€š��Œ可�ƒ���‹��Ÿ
if pa && pb && pc # ��Š��˜��‰�–���‘��Œ�€š��Œ可�ƒ�
�‚‰左��Šに移�‹•
@x = $game_map.round_x(@x -1)
@real_x = (@x +1) * 256
@y = $game_map.round_y(@y -1)
@real_y = (@y +1) * 256
increase_steps # �–œ�‚�移�‹•�™‚の歩�•��‚’�Š���—
else
if @direction == 8 # ��Š�‚’��‘��„て��„�‚‹場��ˆ
if pb; move_left # 左��Œ�€š��Œ可�ƒ�な�‚‰左に移�‹•
else
move_up if pa # ��Š��Œ�€š��Œ可�ƒ�な�‚‰��Šに移�‹•
end
elsif @direction == 4 # 左�‚’��‘��„て��„�‚‹場��ˆ
if pa; move_up # ��Š��Œ�€š��Œ可�ƒ�な�‚‰��Šに移�‹•
else
move_left if pb # 左��Œ�€š��Œ可�ƒ�な�‚‰左に移�‹•
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# �—� 右��Šに移�‹•��ˆ9��‰追�Š���š義
#--------------------------------------------------------------------------
def move_upper_right # �–���‘�‚��ƒ���Œ右��Šに�…��Š›��
•�‚Œて��„�‚‹場��ˆの�‡���†
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
pa = passable?(@x, @y -1) # ��Š��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x+1, @y) # 右��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x+1, @y -1) # 右��Š��Œ�€š��Œ可�ƒ���‹��Ÿ
if pa && pb && pc # ��Š��˜��‰�–���‘��Œ�€š��Œ可�ƒ�
�‚‰右��Šに移�‹•
@x = $game_map.round_x(@x + 1)
@real_x = (@x - 1) * 256
@y = $game_map.round_y(@y - 1)
@real_y = (@y + 1) * 256
increase_steps # �–œ�‚�移�‹•�™‚の歩�•��‚’�Š���—
else
if @direction == 8 # ��Š�‚’��‘��„て��„�‚‹場��ˆ
if pb; move_right # 右��Œ�€š��Œ可�ƒ�な�‚‰右に移�‹•
else
move_up if pa # ��Š��Œ�€š��Œ可�ƒ�な�‚‰��Šに移�‹•
end
elsif @direction == 6 # 右�‚’��‘��„て��„�‚‹場��ˆ
if pa; move_up # ��Š��Œ�€š��Œ可�ƒ�な�‚‰��Šに移�‹•
else
move_right if pb # 右��Œ�€š��Œ可�ƒ�な�‚‰右に移�‹•
end
end
end
if not moving?
@move_failed = true
@direction = Input.dir4
end
end
#--------------------------------------------------------------------------
# �—� ��‹へ�‚��ƒ��ƒ��ƒ—��ˆ追�Š���š義�
‰
#--------------------------------------------------------------------------
def jump_down
pa = passable?(@x, @y +1) # 1 �ƒž�‚���‹��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x, @y +2) # 2 �ƒž�‚���‹��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x, @y +3) # 3 �ƒž�‚���‹��Œ�€š��Œ可�ƒ���‹��Ÿ
DAI::JUMP_SE.play # SEの��”奏
@jump_Reservation = false # �‚��ƒ��ƒ��ƒ—��ˆ��„解�™�
if dai_hi_jump_possible? && pc # �‚��ƒ��ƒ��ƒ—可�ƒ�な�œ€�‚‚遠��„位
へ�‚��ƒ��ƒ��ƒ—
jump(0, +3)
return
end
if pb
jump(0, +2)
return
end
if pa
jump(0, +1)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# �—� 左へ�‚��ƒ��ƒ��ƒ—��ˆ追�Š���š義��‰
#--------------------------------------------------------------------------
def jump_left
pa = passable?(@x -1, @y) # 1 �ƒž�‚�左��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x -2, @y) # 2 �ƒž�‚�左��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x -3, @y) # 3 �ƒž�‚�左��Œ�€š��Œ可�ƒ���‹��Ÿ
DAI::JUMP_SE.play # SEの��”奏
@jump_Reservation = false # �‚��ƒ��ƒ��ƒ—��ˆ��„解�™�
if dai_hi_jump_possible? && pc # �‚��ƒ��ƒ��ƒ—可�ƒ�な�œ€�‚‚遠��„位
へ�‚��ƒ��ƒ��ƒ—
jump(-3, 0)
return
end
if pb
jump(-2, 0)
return
end
if pa
jump(-1, 0)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# �—� 右へ�‚��ƒ��ƒ��ƒ—��ˆ追�Š���š義��‰
#--------------------------------------------------------------------------
def jump_right
pa = passable?(@x +1, @y) # 1 �ƒž�‚�右��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x +2, @y) # 2 �ƒž�‚�右��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x +3, @y) # 3 �ƒž�‚�右��Œ�€š��Œ可�ƒ���‹��Ÿ
DAI::JUMP_SE.play # SEの��”奏
@jump_Reservation = false # �‚��ƒ��ƒ��ƒ—��ˆ��„解�™�
if dai_hi_jump_possible? && pc # �‚��ƒ��ƒ��ƒ—可�ƒ�な�œ€�‚‚遠��„位
へ�‚��ƒ��ƒ��ƒ—
jump(+3, 0)
return
end
if pb
jump(+2, 0)
return
end
if pa
jump(+1, 0)
return
else
jump(0, 0)
end
end
#--------------------------------------------------------------------------
# �—� ��Šへ�‚��ƒ��ƒ��ƒ—��ˆ追�Š���š義��
‰
#--------------------------------------------------------------------------
def jump_up
pa = passable?(@x, @y -1) # 1 �ƒž�‚���Š��Œ�€š��Œ可�ƒ���‹��Ÿ
pb = passable?(@x, @y -2) # 2 �ƒž�‚���Š��Œ�€š��Œ可�ƒ���‹��Ÿ
pc = passable?(@x, @y -3) # 3 �ƒž�‚���Š��Œ�€š��Œ可�ƒ���‹��Ÿ
DAI::JUMP_SE.play # SEの��”奏
@jump_Reservation = false # �‚��ƒ��ƒ��ƒ—��ˆ��„解�™�
if dai_hi_jump_possible? && pc # �‚��ƒ��ƒ��ƒ—可�ƒ�な�œ€�‚‚遠��„位
へ�‚��ƒ��ƒ��ƒ—
jump(0, -3)
return
end
if pb
jump(0, -2)
return
end
if pa
jump(0, -1)
return
else
jump(0, 0)
end
end
end
</div></div></div>
CompatibilityUntested with other scripts. Should work fine, with the exception of other jumping scripts and eight direction scripts.
ScreenshotI think you know what it looks like when someone jumps...It's too hard to capture it.
DEMOI highly recommend playing the demo to get a good idea of how it can work. Besides, it's probably one of the best demos you'll ever play!
DemoInstallationPractically Plug 'n Play, with the exception of customization that you might want to look at.
FAQQ.Help!!! This script is giving me an error!
A.Sadly, I can't help with that. I merely translated this script, and have a weak scripting ability. You may want to contact the script makers, to see what you can do to get it to work properly. If there's something you don't understand about the script, then those kind of questions are ones I can answer.
CreditsRGSS2DaiPage Staff-The script
SuperMega-Translation
(Please credit both! Don't leave RGSS2Daipage Staff out of your credits! You know they did a great job!)