- 1,224
- Posts
- 11
- Years
- Omnipresence
- Seen Aug 8, 2023
Note before you add this: PokeCommunity's formatting breaks scripts. To avoid unnecessary errors, please click Thread Tools and use the Show Printable Version tool. This will show the raw text data in the post, without all the formatting. If you comment on this with a syntax error after I've told you how to solve this, I will not respond.
Follow all these instructions, and you'll be surfing on lava very soon!
In Settings, under
add
In Game_Map, under
add
In Game_Player , add the red parts to the following methods
In Sprite_Character, in def update add the red parts
In Walk_Run add the red part to pbCanRun?
then (same section) under def character_name add the red part
In PokeBattle_ActualScene add the red part
This just allows you to have a lava base during battles
In PokemonField, under module PBTerrain, add the red part
16 can be a different number if you've added other tiles. As long as it's defined separately from other tiles.
Right after this module ends, add
Same section, add the red part to def Kernel.pbUpdateVehicle
Next add the red part to def Kernel.pbCancelVehicle
Replace def pbFishingBegin and def pbFishingEnd
Between the sections for Surf and Waterfall in PokemonHiddenMoves, add this whole thing
In PokemonMap under class PokemonGlobalMetadata, add the red part
Slightly lower under def initialize, add the red part
Lastly, same section, under Module PokemonMetadata replace this part
And that's all the coding part. Three other things you will need to do.
1. Add Lava Surf as a move to moves.txt
2. Add a filepath for each character in your metadata.txt (red part is the addition)
I'm just using the default surfing graphic, you can use a special graphic or whatever
3. Just like with bridges, you'll have to add the terrain tag to lava tiles through the Editor. Otherwise they won't be seen as lava tags. Don't forget that the terrain tag has to be added to the tile individually on each tileset.
4. (Optional) Make Lava Surf a tm/hm move. I didn't provide this, but you can just basically copy surf and rename it.
I've provided a 4th gen style lava autotile you can use (credit to rayquaza_dot)
Note that while this allows for the graphics to change and work for fishing, this does not enable fishing while lava surfing, because I think that's just silly.
Tutorial is written for v15, untested for previous versions.
Follow all these instructions, and you'll be surfing on lava very soon!
In Settings, under
Spoiler:
Code:
BADGEFORWATERFALL = 8
Code:
# You can make this equal to whatever, I'm just using this as a default
BADGEFORLAVASURF = BADGEFORSURF
In Game_Map, under
Spoiler:
Code:
# Make water tiles passable if player is surfing
elsif $PokemonGlobal.surfing &&
pbIsPassableWaterTag?(@terrain_tags[tile_id])
return true
Code:
# Make lava tiles passable if player is lava surfing
elsif $PokemonGlobal.lavasurfing &&
pbIsPassableLavaTag?(@terrain_tags[tile_id])
return true
Spoiler:
Code:
def move_down(turn_enabled = true)
if turn_enabled
turn_down
end
if passable?(@x, @y, 2)
return if pbLedge(0,1)
return if pbEndSurf(0,1) [COLOR="red"]|| pbEndLavaSurf(0,1)[/COLOR]
turn_down
@y += 1
$PokemonTemp.dependentEvents.pbMoveDependentEvents
increase_steps
else
if !check_event_trigger_touch(@x, @y+1)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def move_left(turn_enabled = true)
if turn_enabled
turn_left
end
if passable?(@x, @y, 4)
return if pbLedge(-1,0)
return if pbEndSurf(-1,0) [COLOR="red"]|| pbEndLavaSurf(-1,0)[/COLOR]
turn_left
@x -= 1
$PokemonTemp.dependentEvents.pbMoveDependentEvents
increase_steps
else
if !check_event_trigger_touch(@x-1, @y)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def move_right(turn_enabled = true)
if turn_enabled
turn_right
end
if passable?(@x, @y, 6)
return if pbLedge(1,0)
return if pbEndSurf(1,0) [COLOR="red"]|| pbEndLavaSurf(1,0)[/COLOR]
turn_right
@x += 1
$PokemonTemp.dependentEvents.pbMoveDependentEvents
increase_steps
else
if !check_event_trigger_touch(@x+1, @y)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
def move_up(turn_enabled = true)
if turn_enabled
turn_up
end
if passable?(@x, @y, 8)
return if pbLedge(0,-1)
return if pbEndSurf(0,-1) [COLOR="Red"]|| pbEndLavaSurf(0,-1)[/COLOR]
turn_up
@y -= 1
$PokemonTemp.dependentEvents.pbMoveDependentEvents
increase_steps
else
if !check_event_trigger_touch(@x, @y-1)
if !@bump_se || @bump_se<=0
pbSEPlay("bump"); @bump_se=10
end
end
end
end
In Sprite_Character, in def update add the red parts
Spoiler:
Code:
if @character==$game_player && @tile_id == 0
if $PokemonGlobal.surfing || $PokemonGlobal.diving [COLOR="red"]|| $PokemonGlobal.lavasurfing[/COLOR]
bob=((Graphics.frame_count%60)/15).floor
self.oy=(bob>=2) ? @ch-16-2 : @ch-16
end
end
if @tile_id == 0
if @character==$game_player && !$PokemonGlobal.fishing &&
($PokemonGlobal.surfing || $PokemonGlobal.diving [COLOR="red"]|| $PokemonGlobal.lavasurfing[/COLOR])
sx = bob * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
else
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
In Walk_Run add the red part to pbCanRun?
Spoiler:
Code:
def pbCanRun?
terrain=pbGetTerrainTag
return Input.press?(Input::A) &&
!pbMapInterpreterRunning? && !@move_route_forcing &&
$PokemonGlobal && $PokemonGlobal.runningShoes &&
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
!$PokemonGlobal.bicycle && terrain!=PBTerrain::TallGrass &&
terrain!=PBTerrain::Ice [COLOR="red"]&& !$PokemonGlobal.lavasurfing[/COLOR]
end
Spoiler:
Code:
if $PokemonGlobal.playerID>=0 && meta &&
!$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing[COLOR="red"] && !$PokemonGlobal.lavasurfing[/COLOR]
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
This just allows you to have a lava base during battles
Spoiler:
Code:
elsif $PokemonGlobal.surfing
trialname="Water"
[COLOR="red"]elsif $PokemonGlobal.lavasurfing
trialname="Lava"[/COLOR]
In PokemonField, under module PBTerrain, add the red part
Spoiler:
Code:
Bridge = 15
Lava = 16
Right after this module ends, add
Spoiler:
Code:
def pbIsPassableLavaTag?(tag)
return tag==PBTerrain::Lava
end
Same section, add the red part to def Kernel.pbUpdateVehicle
Spoiler:
Code:
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.bicycle
$game_player.character_name=pbGetPlayerCharset(meta,2) # Bicycle graphic
[COLOR="red"]elsif $PokemonGlobal.lavasurfing
$game_player.character_name=pbGetPlayerCharset(meta,8) # Lava surfing graphic[/COLOR]
else
$game_player.character_name=pbGetPlayerCharset(meta,1) # Regular graphic
end
end
end
Next add the red part to def Kernel.pbCancelVehicle
Spoiler:
Code:
def Kernel.pbCancelVehicles(destination=nil)
$PokemonGlobal.surfing=false
$PokemonGlobal.diving=false
[COLOR="red"]$PokemonGlobal.lavasurfing=false[/COLOR]
if !destination || !pbCanUseBike?(destination)
$PokemonGlobal.bicycle=false
end
Kernel.pbUpdateVehicle
end
Replace def pbFishingBegin and def pbFishingEnd
Spoiler:
Code:
def pbFishingBegin
$PokemonGlobal.fishing=true
if !pbCommonEvent(FISHINGBEGINCOMMONEVENT)
patternb = 2*$game_player.direction - 1
playertrainer=pbGetPlayerTrainerType
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
num=($PokemonGlobal.surfing) ? 7 : ($PokemonGlobal.lavasurfing)? 9 : 6
if meta && meta[num] && meta[num]!=""
charset=pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb-pattern)
2.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
end
def pbFishingEnd
if !pbCommonEvent(FISHINGENDCOMMONEVENT)
patternb = 2*($game_player.direction - 2)
playertrainer=pbGetPlayerTrainerType
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
num=($PokemonGlobal.surfing) ? 7 : ($PokemonGlobal.lavasurfing)? 9 : 6
if meta && meta[num] && meta[num]!=""
charset=pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb+pattern)
2.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
$PokemonGlobal.fishing=false
end
Between the sections for Surf and Waterfall in PokemonHiddenMoves, add this whole thing
Spoiler:
Code:
#===============================================================================
# Lava Surf
#===============================================================================
def Kernel.pbLavaSurf
if $game_player.pbHasDependentEvents?
return false
end
if $DEBUG ||
(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORLAVASURF : $Trainer.badges[BADGEFORLAVASURF])
movefinder=Kernel.pbCheckMove(:LAVASURF)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("The lava is a deep red...\nWould you like to surf on it?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used Lava Surf!",speciesname))
pbHiddenMoveAnimation(movefinder)
surfbgm=pbGetMetadata(0,MetadataSurfBGM)
if surfbgm
pbCueBGM(surfbgm,0.5)
end
pbStartLavaSurfing()
return true
end
end
end
return false
end
def pbStartLavaSurfing()
Kernel.pbCancelVehicles
$PokemonEncounters.clearStepCount
$PokemonGlobal.lavasurfing=true
Kernel.pbUpdateVehicle
Kernel.pbJumpToward
Kernel.pbUpdateVehicle
$game_player.check_event_trigger_here([1,2])
end
def pbEndLavaSurf(xOffset,yOffset)
return false if !$PokemonGlobal.lavasurfing
x=$game_player.x
y=$game_player.y
currentTag=$game_map.terrain_tag(x,y)
facingTag=Kernel.pbFacingTerrainTag
if pbIsPassableLavaTag?(currentTag) && !pbIsPassableLavaTag?(facingTag)
if Kernel.pbJumpToward(1,false,true)
# Kernel.pbCancelVehicles
$game_map.autoplayAsCue
$game_player.increase_steps
result=$game_player.check_event_trigger_here([1,2])
Kernel.pbOnStepTaken(result)
end
return true
end
return false
end
def Kernel.pbTransferLavaSurfing(mapid,xcoord,ycoord,direction=$game_player.direction)
pbFadeOutIn(99999){
$game_temp.player_new_map_id=mapid
$game_temp.player_new_x=xcoord
$game_temp.player_new_y=ycoord
$game_temp.player_new_direction=direction
Kernel.pbCancelVehicles
$PokemonGlobal.lavasurfing=true
Kernel.pbUpdateVehicle
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
Events.onAction+=proc{|sender,e|
terrain=Kernel.pbFacingTerrainTag
notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
if pbIsPassableLavaTag?(terrain) && !$PokemonGlobal.lavasurfing &&
!pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && notCliff
Kernel.pbLavaSurf
return
end
}
HiddenMoveHandlers::CanUseMove.add(:LAVASURF,proc{|move,pkmn|
terrain=Kernel.pbFacingTerrainTag
notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORLAVASURF : $Trainer.badges[BADGEFORLAVASURF])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
if $PokemonGlobal.lavasurfing
Kernel.pbMessage(_INTL("You're already surfing."))
return false
end
if $game_player.pbHasDependentEvents?
Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
return false
end
if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
return false
end
if !pbIsPassableLavaTag?(terrain) || !notCliff
Kernel.pbMessage(_INTL("No surfing here!"))
return false
end
return true
})
HiddenMoveHandlers::UseMove.add(:LAVASURF,proc{|move,pokemon|
if !pbHiddenMoveAnimation(pokemon)
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end
pbStartLavaSurfing()
return true
})
In PokemonMap under class PokemonGlobalMetadata, add the red part
Spoiler:
Code:
attr_accessor :surfing
[COLOR="red"]attr_accessor :lavasurfing[/COLOR]
Spoiler:
Code:
@surfing = false
[COLOR="red"]@lavasurfing = false[/COLOR]
Lastly, same section, under Module PokemonMetadata replace this part
Spoiler:
Code:
GlobalTypes={
"Home"=>[MetadataHome,"uuuu"],
"WildBattleBGM"=>[MetadataWildBattleBGM,"s"],
"TrainerBattleBGM"=>[MetadataTrainerBattleBGM,"s"],
"WildVictoryME"=>[MetadataWildVictoryME,"s"],
"TrainerVictoryME"=>[MetadataTrainerVictoryME,"s"],
"SurfBGM"=>[MetadataSurfBGM,"s"],
"BicycleBGM"=>[MetadataBicycleBGM,"s"],
"PlayerA"=>[MetadataPlayerA,"esssssssss",:PBTrainers],
"PlayerB"=>[MetadataPlayerB,"esssssssss",:PBTrainers],
"PlayerC"=>[MetadataPlayerC,"esssssssss",:PBTrainers],
"PlayerD"=>[MetadataPlayerD,"esssssssss",:PBTrainers],
"PlayerE"=>[MetadataPlayerE,"esssssssss",:PBTrainers],
"PlayerF"=>[MetadataPlayerF,"esssssssss",:PBTrainers],
"PlayerG"=>[MetadataPlayerG,"esssssssss",:PBTrainers],
"PlayerH"=>[MetadataPlayerH,"esssssssss",:PBTrainers]
}
And that's all the coding part. Three other things you will need to do.
1. Add Lava Surf as a move to moves.txt
Spoiler:
Code:
560,LAVASURF,Lava Surf,075,95,FIRE,Special,100,15,0,08,0,bef,"It swamps the area around the user with a giant wave of molten rock. It can also be used for crossing lava."
I'm just using the default surfing graphic, you can use a special graphic or whatever
Spoiler:
Code:
PlayerA=POKEMONTRAINER_Red,trchar000,boy_bike,boy_surf_offset,boy_run,boy_dive_offset,boy_fish_offset,boy_fishsurf_offset[COLOR="red"],boy_surf_offset[/COLOR][COLOR="red"],boy_fishsurf_offset[/COLOR]
PlayerB=POKEMONTRAINER_Leaf,trchar001,girl_bike,girl_surf_offset,girl_run,girl_dive_offset,girl_fish_offset,girl_fishsurf_offset[COLOR="red"],girl_surf_offset,girl_fishsurf_offset[/COLOR]
3. Just like with bridges, you'll have to add the terrain tag to lava tiles through the Editor. Otherwise they won't be seen as lava tags. Don't forget that the terrain tag has to be added to the tile individually on each tileset.
4. (Optional) Make Lava Surf a tm/hm move. I didn't provide this, but you can just basically copy surf and rename it.
I've provided a 4th gen style lava autotile you can use (credit to rayquaza_dot)
![[PokeCommunity.com] Lava Surfing [PokeCommunity.com] Lava Surfing](https://i.imgur.com/B8Di70U.png)
Note that while this allows for the graphics to change and work for fishing, this does not enable fishing while lava surfing, because I think that's just silly.
Tutorial is written for v15, untested for previous versions.
Last edited: