- 150
- Posts
- 9
- Years
- Seen Jul 13, 2023
Rock Climb with Overworld Animation
Current Version: 1.1
Current Version: 1.1
![[PokeCommunity.com] Rock Climb with Overworld Animation [PokeCommunity.com] Rock Climb with Overworld Animation](https://i.imgur.com/XaYQTaf.gif)
-------
Implements Rock Climbing and adds an animated effect for using the Rock Climb HM in the overworld.
*This script was loosely based on an old Rock Climb resource.
*This comes with stock graphics for Red and Leaf. If you want to use different characters, you will need to make the animations yourself.
NOTE: This was made for PE versions 16 and 17. If you use a more recent version, (broken link removed).
See the notes at the top of the script for installation and usage instructions!
Download:
https://www.dropbox.com/s/mttrj2zmpnkktt2/Rock Climb Animation v1.1.7z?dl=0
Old Versions:
Changelog:
Spoiler:
v1.1:
- The script now includes a standalone already-set-up Rock Climbing HM compatible with both PE v16 and v17+.
v1.0
- Initial release.
Script:
Spoiler:
NOTE: You need to download the resource pack above, too. This script is included in that pack, I am merely putting it here as a quickly accessible reference.
Code:
#==============================================================================#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#==============================================================================#
# Rock Climb with Animation #
# v1.1 #
# By Ulithium_Dragon #
# #
#==============================================================================#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#==============================================================================#
# Implements Rock Climbing and plays a custom animation #
# when using the Rock Climb HM in the overworld. #
# #
#------------------------------------------------------------------------------#
# :::::This script is compatible with both PE v16 and v17+::::: #
#==============================================================================#
# #
#------------------------------------------------------------------------------#
# **Place this script somewhere above Main and below PField_FieldMoves. #
# (PField_HiddenMoves for if you're using a version of Essentials below v17.) #
# #
#------------------------------------------------------------------------------#
# **Place the Rock Climb graphics on the tilesheets you want to use them with. #
# (You will have to do this yourself with an image editing program like GIMP.) #
# #
# **Make sure to change the terrain tags on the tiles you place to the ones #
# defined below under "ROCKCLIMB_TERRAINTAG" and "ROCKCREST_TERRAINTAG"! #
# #
#==============================================================================#
=begin
#------------------------------------------------------------------------------#
# *NOTE: If you want to have Rock Climb as an HM, you will need to add a new #
# item to your "items.txt" PSB file... #
# #
#-----------# #
#| Example: | #
#-----------# #
550,HM09,HM09,HM09s,4,0,"A charging attack that may also leave the foe confused. It can also be used to scale rocky walls.",4,0,0,ROCKCLIMB
# #
#------------------------------------------------------------------------------#
# ...and add a new section to the "tm.txt" PSB file. #
# #
#-----------# #
#| Example: | #
#-----------# #
[ROCKCLIMB]
VENUSAUR,BLASTOISE,SANDSHREW,SANDSLASH,NIDOQUEEN,NIDOKING,GOLDUCK,MANKEY,PRIMEAPE,ARCANINE,POLIWRATH,MACHOP,MACHOKE,MACHAMP,GEODUDE,GRAVELER,GOLEM,ONIX,CUBONE,MAROWAK,HITMONLEE,HITMONCHAN,LICKITUNG,RHYHORN,RHYDON,CHANSEY,KANGASKHAN,ELECTABUZZ,MAGMAR,PINSIR,TAUROS,OMASTAR,KABUTOPS,SNORLAX,MEWTWO,MEW,MEGANIUM,TYPHLOSION,FERALIGATR,AMPHAROS,STEELIX,GRANBULL,URSARING,BLISSEY,RAIKOU,ENTEI,SUICUNE,TYRANITAR,SCEPTILE,BLAZIKEN,SWAMPERT,LUDICOLO,VIGOROTH,SLAKING,EXPLOUD,MAKUHITA,HARIYAMA,AGGRON,ZANGOOSE,REGIROCK,REGICE,REGISTEEL,GROUDON,TURTWIG,GROTLE,TORTERRA,CHIMCHAR,MONFERNO,INFERNAPE,EMPOLEON,BIBAREL,CRANIDOS,RAMPARDOS,GIBLE,GABITE,GARCHOMP,MUNCHLAX,LUCARIO,DRAPION,CROAGUNK,TOXICROAK,ABOMASNOW,LICKILICKY,RHYPERIOR,ELECTIVIRE,MAGMORTAR,MAMOSWINE,HEATRAN,REGIGIGAS,GIRATINA,DARKRAI,ARCEUS
# #
=end #
#------------------------------------------------------------------------------#
# OPTIONS #
#==============================================================================#
# There are Terrain Tag slots that need to be reserved for the rock tiles. #
ROCKCLIMB_TERRAINTAG = 17 #Default: 17
ROCKCREST_TERRAINTAG = 18 #Default: 18
# The badge needed to use Rock Climb in the field. #
BADGEFORROCKCLIMB = 1 #Default: 8
# Descending does not have a custom animation, and was not something that #
# Rock Climb ever did. If you want to use descending, set this to "true". #
ENABLE_DESCENDING = false #Default: false
#==============================================================================#
#//////////////////////////////////////////////////////////////////////////////#
#==============================================================================#
#==========#
module PBTerrain
RockClimb = ROCKCLIMB_TERRAINTAG #For normal Rock Climb tiles.
RockCrest = ROCKCREST_TERRAINTAG #For the topmost Rock Climb tile.
def PBTerrain.isPassableRockTag?(tag)
return tag==PBTerrain::RockCrest
end
def PBTerrain.isRockTag?(tag)
return tag==PBTerrain::RockCrest||
tag==PBTerrain::RockClimb
end
end
#-----#
#==========#
class PokemonGlobalMetadata
attr_accessor :rockclimbing
@rockclimbing = false
end
#-----#
#==========#
def Kernel.pbAscendRock(event=nil)
$ud_hideWindowskin = true #Hide the window box when playing the animation.
event=$game_player if !event
if !event || event.direction!=8 #Can't ascend if not facing up!
$ud_hideWindowskin = false
return
end
oldthrough=event.through
oldmovespeed=event.move_speed
terrain=Kernel.pbFacingTerrainTag
if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest
$ud_hideWindowskin = false
return
end
event.through=true
event.move_speed=2
Kernel.pbCancelVehicles
$PokemonEncounters.clearStepCount
$PokemonGlobal.rockclimbing=true
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
#$rc_spritedispose = false
$game_player.opacity = 0
$rc_framewait = 2
$rc_spriteframe = 1
movementcounter = 0
while $rc_spriteframe < 14
Kernel.pbRockClimbAscendFrames
$rc_spriteframe += 1
end
$rc_framewait = 1
loop do
$rc_spriteframe = 25 if $rc_spriteframe > 28
if movementcounter == 7
event.move_up
movementcounter = 0
end
Kernel.pbRockClimbAscendFrames
terrain=pbGetTerrainTag(event)
if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest || $PokemonGlobal.rockclimbing=false
$rc_spriteframe = 29
break
end
movementcounter += 1
$rc_spriteframe += 1
end
$rc_framewait = 2
while $rc_spriteframe <= 51
Kernel.pbRockClimbAscendFrames
$rc_spriteframe += 1
end
#$rc_framewait = 4
$rc_spriteframe = 51
$game_player.opacity = 255
Kernel.pbRockClimbAscendFrames
event.through=oldthrough
event.move_speed=oldmovespeed
$game_map.autoplayAsCue
$game_player.increase_steps
$ud_hideWindowskin = false #Unhide the window box after the animation.
end
#-----#
#==========#
def Kernel.pbDescendRock(event=nil)
event=$game_player if !event
return if !event
return if event.direction!=2 # Can't descend if not facing down
oldthrough=event.through
oldmovespeed=event.move_speed
terrain=Kernel.pbFacingTerrainTag
return if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest
event.through=true
event.move_speed=2
Kernel.pbCancelVehicles
$PokemonEncounters.clearStepCount
$PokemonGlobal.rockclimbing=true
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
loop do
event.move_down
terrain=pbGetTerrainTag(event)
break if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest
if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest || $PokemonGlobal.rockclimbing=false
# Kernel.pbJumpToward(1,false,true)
break
end
end
event.through=oldthrough
event.move_speed=oldmovespeed
$game_map.autoplayAsCue
$game_player.increase_steps
end
#-----#
#==========#
def Kernel.pbRockClimb
if $DEBUG ||
(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKCLIMB : $Trainer.badges[BADGEFORROCKCLIMB])
movefinder=Kernel.pbCheckMove(:ROCKCLIMB)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("The wall is very rocky... Would you like to use Rock Climb?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used Rock Climb.",speciesname))
pbHiddenMoveAnimation(movefinder)
# Only allow descending if enabled.
if ENABLE_DESCENDING
case $game_player.direction
when 2
pbDescendRock
when 8
pbAscendRock
end
else
pbAscendRock
end
return true
end
else
Kernel.pbMessage(_INTL("A wall of rock is in front of you."))
end
else
Kernel.pbMessage(_INTL("A wall of rock is in front of you."))
end
return false
end
#-----#
#==========#
def Kernel.pbRockClimbAscendFrames
viewport=Viewport.new(0,0,Graphics.height,Graphics.width)
viewport.z==99999
sprite = Sprite.new(viewport)
if $Trainer.gender==1
bitmapFileName = sprintf("Graphics/Pictures/Animations/Rock Climb/Rockclimb_Leaf_"+$rc_spriteframe.to_s)
elsif $Trainer.gender==0
bitmapFileName = sprintf("Graphics/Pictures/Animations/Rock Climb/Rockclimb_Red_"+$rc_spriteframe.to_s)
end
bitmap=pbResolveBitmap(bitmapFileName)
bitmapFileName=BitmapCache.load_bitmap(bitmap)
spritewindow = PictureWindow.new(bitmap)
spritewindow.x=((Graphics.width+9)/2)-(spritewindow.width/2)
spritewindow.y=((Graphics.height+118)/2)-(spritewindow.height/2)
pbWait($rc_framewait)
spritewindow.dispose
end
#-----#
#==========#
Events.onAction+=proc{|sender,e|
terrain=Kernel.pbFacingTerrainTag
if terrain==PBTerrain::RockClimb
Kernel.pbRockClimb
return
end
if terrain==PBTerrain::RockCrest
# Only allow descending if enabled.
if ENABLE_DESCENDING
Kernel.pbRockClimb
else
Kernel.pbMessage(_INTL("A wall of rock is in front of you."))
end
return
end
}
HiddenMoveHandlers::CanUseMove.add(:ROCKCLIMB,proc{|move,pkmn|
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORROCKCLIMB : $Trainer.badges[BADGEFORROCKCLIMB])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
terrain=Kernel.pbFacingTerrainTag
if terrain!=PBTerrain::RockClimb
Kernel.pbMessage(_INTL("Can't use that here."))
return false
end
return true
})
HiddenMoveHandlers::UseMove.add(:ROCKCLIMB,proc{|move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
Kernel.pbMessage(_INTL("{1} used {2}.",pokemon.name,PBMoves.getName(move)))
end
Kernel.pbAscendRock
return true
})
#-----#
#==============================================================================#
# Utilities #
#==============================================================================#
#==========#
# Since PE v17 changed some of the functions this script utilizes, I use
# the "Sprite_SurfBase" added in v17 as way to check the version.
def pbCheckEssentialsVer
if defined?(Sprite_SurfBase) #For PE v17+
$essentialsVer = true
else #For PE v16-
$essentialsVer = false
end
end
#-----#
#==========#
# *Overwrites these functions locally to add the Rock Climb section.
def Kernel.pbUpdateVehicle
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
if meta
if $PokemonGlobal.diving
$game_player.character_name=pbGetPlayerCharset(meta,5) # Diving graphic
elsif $PokemonGlobal.surfing
$game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
elsif $PokemonGlobal.rockclimbing
$game_player.character_name=pbGetPlayerCharset(meta,3) # Rock Climb graphic
elsif $PokemonGlobal.bicycle
$game_player.character_name=pbGetPlayerCharset(meta,2) # Bicycle graphic
else
$game_player.character_name=pbGetPlayerCharset(meta,1) # Regular graphic
end
end
end
#-----#
#==========#
class Game_Player
attr_accessor :opacity
end
#-----#
#==========#
# *Overwrites these functions locally to add the Rock Climb section.
class Game_Map
def playerPassable?(x, y, d, self_event = nil)
bit = (1 << (d / 2 - 1)) & 0x0f
pbCheckEssentialsVer
if $essentialsVer #For PE v17+
for i in [2, 1, 0]
tile_id = data[x, y, i]
# Ignore bridge tiles if not on a bridge
next if $PokemonGlobal && $PokemonGlobal.bridge==0 &&
tile_id && PBTerrain.isBridge?(@terrain_tags[tile_id])
if tile_id == nil
return false
# Make water tiles passable if player is surfing
elsif $PokemonGlobal.surfing &&
PBTerrain.isPassableWater?(@terrain_tags[tile_id])
return true
# Make Rock Climb tiles passable if player is Rock Climbing
elsif $PokemonGlobal.rockclimbing &&
PBTerrain.isRockTag?(@terrain_tags[tile_id])
return true
# Prevent cycling in really tall grass/on ice
elsif $PokemonGlobal.bicycle &&
PBTerrain.onlyWalk?(@terrain_tags[tile_id])
return false
# Depend on passability of bridge tile if on bridge
elsif $PokemonGlobal && $PokemonGlobal.bridge>0 &&
PBTerrain.isBridge?(@terrain_tags[tile_id])
if @passages[tile_id] & bit != 0 ||
@passages[tile_id] & 0x0f == 0x0f
return false
else
return true
end
# Regular passability checks
elsif @terrain_tags[tile_id]!=PBTerrain::Neutral
if @passages[tile_id] & bit != 0 ||
@passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
end
else #For PE v16-
for i in [2, 1, 0]
tile_id = data[x, y, i]
# Ignore bridge tiles if not on a bridge
next if $PokemonGlobal && $PokemonGlobal.bridge==0 &&
tile_id && PBTerrain.isBridge?(@terrain_tags[tile_id])
if tile_id == nil
return false
# Make water tiles passable if player is surfing
elsif $PokemonGlobal.surfing &&
PBTerrain.isPassableWater?(@terrain_tags[tile_id])
return true
# Make Rock Climb tiles passable if player is Rock Climbing
elsif $PokemonGlobal.rockclimbing &&
PBTerrain.isRockTag?(@terrain_tags[tile_id])
return true
# Prevent cycling in really tall grass/on ice
elsif $PokemonGlobal.bicycle &&
PBTerrain.onlyWalk?(@terrain_tags[tile_id])
return false
# Depend on passability of bridge tile if on bridge
elsif $PokemonGlobal && $PokemonGlobal.bridge>0 &&
PBTerrain.isBridge?(@terrain_tags[tile_id])
if @passages[tile_id] & bit != 0 ||
@passages[tile_id] & 0x0f == 0x0f
return false
else
return true
end
# Regular passability checks
else #if @terrain_tags[tile_id]!=PBTerrain::Neutral
if @passages[tile_id] & bit != 0 ||
@passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
end
end
return true
end
end
#-----#
#==========#
# *Overwrites these functions locally to add the Rock Climb check.
class Game_Player
def character_name
if !@defaultCharacterName
@defaultCharacterName=""
end
if @defaultCharacterName!=""
return @defaultCharacterName
end
if !moving? && !@move_route_forcing && $PokemonGlobal
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
if $PokemonGlobal.playerID>=0 && meta &&
!$PokemonGlobal.bicycle && !$PokemonGlobal.diving &&
!$PokemonGlobal.surfing && !$PokemonGlobal.rockclimbing
if meta[4] && meta[4]!="" && Input.dir4!=0 && passable?(@x,@y,Input.dir4) && pbCanRun?
# Display running character sprite
@character_name=pbGetPlayerCharset(meta,4)
else
# Display normal character sprite
@character_name=pbGetPlayerCharset(meta,1)
end
end
end
return @character_name
end
end
#-----#
#==========#
# *Overwrites the base function to removes the windowbox bg for this script.
class SpriteWindow_Base < SpriteWindow
def __setWindowskin(skin)
if !$ud_hideWindowskin
if skin && (skin.width==192 && skin.height==128) || # RPGXP Windowskin
(skin.width==128 && skin.height==128) # RPGVX Windowskin
self.skinformat=0
else
self.skinformat=1
end
self.windowskin=skin
end
end
end
#-----#
#==============================================================================#
#//////////////////////////////////////////////////////////////////////////////#
#==============================================================================#
Last edited: