Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials tutorial] Rock Climb

Notices
For all updates, view the main page.

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.



Reply
 
Thread Tools
  #1    
Old March 31st, 2011 (04:59 PM). Edited March 31st, 2011 by zingzags.
zingzags's Avatar
zingzags zingzags is offline
PokemonGDX creator
 
Join Date: Jan 2009
Location: Boston
Age: 21
Nature: Adamant
Posts: 560
Hey guys, another release to you guys from me. This is about 80% complete I guess. I forgot completely how does rock climb work in game, but it is similar to waterfall. This does not support side-stair's yet, but it can take you up and down a wall of rock.



TM.txt:
Code:
[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
^ All of that belong in TM.txt it is so that a pokemon can learn the TM/HM rock climb. Rock climb uses the same player graphics as surf, but it can be changed.

Pokemon Field:
this belongs in the PBTerrain class
Code:
RockClimb=16
RockCrest=17
Hopefully you know where a def (its a method, function w.e u want to call it) goes.
Code:
def pbIsPassableRockTag?(tag)
 return tag==PBTerrain::RockCrest
end

def pbIsRockTag?(tag)
 return tag==PBTerrain::RockCrest||
        tag==PBTerrain::RockClimb
end
in def Kernel.pbUpdateVehicle , just replace ALMOST everything
Code:
if meta
  if $PokemonGlobal.diving
   $game_player.character_name=meta[6] && meta[6]!="" ? meta[6] : meta[1] # Diving graphic
  elsif $PokemonGlobal.surfing
   $game_player.character_name=meta[4] && meta[4]!="" ? meta[4] : meta[1] # Surfing graphic
  elsif $PokemonGlobal.rock
   $game_player.character_name=meta[4] && meta[4]!="" ? meta[4] : meta[1] # Climbing graphic
  elsif $PokemonGlobal.bicycle
   $game_player.character_name=meta[2] && meta[2]!="" ? meta[2] : meta[1] # Bicycle graphic
  else
   $game_player.character_name=meta[1] # Regular graphic
  end
 end
end
in Game_Map_:
Code:
 elsif pbIsPassableRockTag?(@terrain_tags[tile_id])&&
        $PokemonGlobal.rock
in Walk_Run:
Code:
if $PokemonGlobal.playerID>=0 && meta && $PokemonGlobal && 
   !$PokemonGlobal.bicycle &&
   !$PokemonGlobal.diving &&
   !$PokemonGlobal.surfing &&
   !$PokemonGlobal.rock
PokemonMap:
Code:
 attr_accessor :rock
  @rock=false
PokemonHiddenMoves:
Code:
def Kernel.pbAscendRock(event=nil)
  x=$game_player.x
  y=$game_player.y
 currentTag=$game_map.terrain_tag(x,y) 
 facingTag=Kernel.pbFacingTerrainTag
 event=$game_player if !event
 return if !event
 return if event.direction!=8 # can't ascend if not facing up
 oldthrough=event.through
 oldmovespeed=event.move_speed
 terrain=Kernel.pbFacingTerrainTag#(nil,event)
 # Kernel.pbJumpToward 
 return if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest
  event.through=true
 event.move_speed=2
 Kernel.pbCancelVehicles
   $PokemonEncounters.clearStepCount
   $PokemonGlobal.rock=true
   Kernel.pbJumpToward
   Kernel.pbUpdateVehicle
# Kernel.pbJumpToward 
 # Kernel.pbJumpToward 
 loop do
  event.move_up
  terrain=pbGetTerrainTag(event)
 break if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest || $PokemonGlobal.rock=false #||
#$game_map.autoplayAsCue || $game_player.increase_steps
end
 event.through=oldthrough
 event.move_speed=oldmovespeed
 $game_map.autoplayAsCue
 $game_player.increase_steps
end


def Kernel.pbDescendRock(event=nil)
 x=$game_player.x
  y=$game_player.y
 currentTag=$game_map.terrain_tag(x,y) 
 facingTag=Kernel.pbFacingTerrainTag
 event=$game_player if !event
 return if !event
 return if event.direction!=2 # can't ascend if not facing up
 oldthrough=event.through
 oldmovespeed=event.move_speed
 terrain=Kernel.pbFacingTerrainTag#(nil,event)
 # Kernel.pbJumpToward 
 return if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest
  event.through=true
 event.move_speed=2
 Kernel.pbCancelVehicles
   $PokemonEncounters.clearStepCount
   $PokemonGlobal.rock=true
   Kernel.pbJumpToward
   Kernel.pbUpdateVehicle
# Kernel.pbJumpToward 
 # Kernel.pbJumpToward 
 loop do
  event.move_down
  terrain=pbGetTerrainTag(event)
 break if terrain!=PBTerrain::RockClimb && terrain!=PBTerrain::RockCrest || $PokemonGlobal.rock=false #||
#$game_map.autoplayAsCue || $game_player.increase_steps
end
 event.through=oldthrough
 event.move_speed=oldmovespeed
 $game_map.autoplayAsCue
 $game_player.increase_steps
end


def Kernel.pbRockClimb(event=nil)
  event=$game_player
 if $DEBUG #|| $Trainer.badges[BADGEFORCLIMB]
   movefinder=Kernel.pbCheckMove(:ROCKCLIMB)
   if $DEBUG || movefinder
    if Kernel.pbConfirmMessage(_INTL("These rocks look like they can be climbed upon. Would you like to use Rock Climb?"))
      speciesname=!movefinder ? $Trainer.name : movefinder.name
      Kernel.pbMessage(_INTL("{1} used Rock Climb.",speciesname))
      pbHiddenMoveAnimation(movefinder)
 #pbAscendRock
  case $game_player.direction
when 2
pbDescendRock
when 8
pbAscendRock
end

    return true
      end
   else
    Kernel.pbMessage(_INTL("These rocks look like they can be climbed upon."))
   end
 else
  Kernel.pbMessage(_INTL("These rocks look like they can be climbed upon."))
 end
 return false
end

HiddenMoveHandlers::CanUseMove.add(:ROCKCLIMB,proc{|move,pkmn|
   if !$DEBUG# && !$Trainer.badges[BADGEFORCLIMB]
    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
   case $game_player.direction
when 2
pbDescendRock
when 8
pbAscendRock
end
in def Kernel.pbHiddenMoveEvent
Code:
if terrain==PBTerrain::RockClimb
  Kernel.pbRockClimb
  return
 end
NOTE:
I do not recommend adding this if you do not know how to code. I will not help with error messages. Find out where to implement the if statements on your own. Also do not ask for whirlpool(I think I have it 100% working as an event, but I realized it would be better to make it work as a terrain tag), or Defog ( which I am working on right now).

I will take Credits.
__________________
Check out the Pokemon Game Engine I am working on:
https://github.com/sjosegarcia/Pokemon
Reply With Quote
  #2    
Old April 2nd, 2011 (08:36 PM).
zingzags's Avatar
zingzags zingzags is offline
PokemonGDX creator
 
Join Date: Jan 2009
Location: Boston
Age: 21
Nature: Adamant
Posts: 560
Surprised there is no comments yet.
__________________
Check out the Pokemon Game Engine I am working on:
https://github.com/sjosegarcia/Pokemon
Reply With Quote
  #3    
Old April 3rd, 2011 (03:02 PM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,561
The Waterfall move uses two different terrain tiles because it's possible to automatically descend the waterfall just by surfing too close to it, whereas you need to use the move to ascend it. Rock Climb doesn't have that feature - you'll always use the move to go up/down.

I think these scripts can be simplified to use just one terrain tag, as I mentioned to you and in my tutorial. Doing so is, of course, complicated.
__________________
Reply With Quote
  #4    
Old April 3rd, 2011 (06:20 PM).
oldsnake90's Avatar
oldsnake90 oldsnake90 is offline
Creator Pokemon Glacial Freeze
 
Join Date: Feb 2010
Location: Wisconsin USA
Gender: Male
Posts: 76
Send a message via Skype™ to oldsnake90
This would work great for my game. looks good.
__________________
V.K. Productions on Facebook

Pokemon Glacial Freeze Project on Facebook
Reply With Quote
  #5    
Old April 5th, 2011 (10:51 AM).
zingzags's Avatar
zingzags zingzags is offline
PokemonGDX creator
 
Join Date: Jan 2009
Location: Boston
Age: 21
Nature: Adamant
Posts: 560
Quote originally posted by Maruno:
The Waterfall move uses two different terrain tiles because it's possible to automatically descend the waterfall just by surfing too close to it, whereas you need to use the move to ascend it. Rock Climb doesn't have that feature - you'll always use the move to go up/down.

I think these scripts can be simplified to use just one terrain tag, as I mentioned to you and in my tutorial. Doing so is, of course, complicated.
You know what?, you may actually have a point there.
__________________
Check out the Pokemon Game Engine I am working on:
https://github.com/sjosegarcia/Pokemon
Reply With Quote
  #6    
Old April 6th, 2011 (09:02 AM).
Peeky Chew's Avatar
Peeky Chew Peeky Chew is offline
Master of Palettes
Crystal Tier
 
Join Date: Sep 2009
Location: Great Britain
Age: 21
Gender: Male
Posts: 852
Looks great, I'm sure it'll be helpful to people, and me if I decide to use Rock Climb.
__________________



Demo Beta out Now!

Reply With Quote
  #7    
Old March 24th, 2014 (05:14 PM). Edited March 24th, 2014 by joeyhugg.
joeyhugg's Avatar
joeyhugg joeyhugg is offline
 
Join Date: Apr 2013
Gender: Male
Posts: 384
Where do "Game_Map_", "Walk_Run", and "PokemonMap" go? I possess basic scripting knowledge and I cannot decipher this.

Edit: I figured out everything but Game_Map_. I have no idea where to put this.

Edit 2: Nevermind, nothing seems to be working. I would give you my code, but you said you won't respond, so... Oh well...
__________________
Reply With Quote
  #8    
Old March 25th, 2014 (02:11 PM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
@LukaSJ0
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 912
Quote originally posted by joeyhugg:
Where do "Game_Map_", "Walk_Run", and "PokemonMap" go? I possess basic scripting knowledge and I cannot decipher this.

Edit: I figured out everything but Game_Map_. I have no idea where to put this.

Edit 2: Nevermind, nothing seems to be working. I would give you my code, but you said you won't respond, so... Oh well...
Again, this post along with its code was written in 2011. It may not apply to the current version of Essentials.
Reply With Quote
  #9    
Old March 25th, 2014 (02:50 PM).
joeyhugg's Avatar
joeyhugg joeyhugg is offline
 
Join Date: Apr 2013
Gender: Male
Posts: 384
Yeah, I figured. I may have to open a new Question topic to ask how to implement this.
__________________
Reply With Quote
  #10    
Old July 6th, 2015 (05:57 PM).
Tigerfang98's Avatar
Tigerfang98 Tigerfang98 is offline
Elite 4
 
Join Date: May 2013
Posts: 20
Where would I put a def?
Reply With Quote
  #11    
Old July 6th, 2015 (10:07 PM).
mej71's Avatar
mej71 mej71 is offline
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Posts: 833
Quote originally posted by Tigerfang98:
Where would I put a def?
Clicking on a section and hitting Insert creates a new script section
Reply With Quote
  #12    
Old July 7th, 2015 (07:53 AM).
Tigerfang98's Avatar
Tigerfang98 Tigerfang98 is offline
Elite 4
 
Join Date: May 2013
Posts: 20
Would this be on the map or on the material base?
Reply With Quote
  #13    
Old July 8th, 2015 (03:52 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,561
It is expected that you know how to use RPG Maker XP before delving into Essentials. If you don't, go away and learn.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links

You may also like.. (Beta)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 07:33 PM.