• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Making a move Like Surf but for Lava

119
Posts
10
Years
  • hey, i tried copying the the surf script but modifying it for lava as well as adding a lava terrain tag but with no luck, i am new to ruby scripting so i dont have any background knowledge on it but i have a somewhat of an understanding.

    If someone could help me create a move that lets only fire pokemon surf on a lava tileset that would be awesome.

    Thanks
     
    119
    Posts
    10
    Years
  • its not that im getting errors its just that its not working as intended. I copy and pasted the surf from HiddemMoves and changed it to fit the terrain tags.
    here are the lines i have added :

    this was added in PokemonField under terrain tags:

    ################################################################################
    # Terrain tags
    ################################################################################
    class PBTerrain
    Ledge = 1
    Grass = 2
    Sand = 3
    Rock = 4
    DeepWater = 5
    StillWater = 6
    Water = 7
    Waterfall = 8
    WaterfallCrest = 9
    TallGrass = 10
    UnderwaterGrass = 11
    Ice = 12
    Neutral = 13
    SootGrass = 14
    Bridge = 15
    Lava = 22
    end



    def pbIsLavaSurfableTag?(tag)
    return pbIsLavaTag?(tag)
    end

    def pbIsLavaTag?(tag)
    return tag==PBTerrain::Lava
    end


    def pbIsSurfableTag?(tag)
    return pbIsWaterTag?(tag)
    end

    def pbIsWaterTag?(tag)
    return tag==PBTerrain::DeepWater ||
    tag==PBTerrain::Water ||
    tag==PBTerrain::StillWater ||
    tag==PBTerrain::WaterfallCrest ||
    tag==PBTerrain::Waterfall
    end

    and added the badge :

    BADGESBOOSTATTACK = 1
    BADGESBOOSTDEFENSE = 5
    BADGESBOOSTSPEED = 3
    BADGESBOOSTSPATK = 7
    BADGESBOOSTSPDEF = 7
    HIDDENMOVESCOUNTBADGES = true
    BADGEFORCUT = 1
    BADGEFORFLASH = 2
    BADGEFORROCKSMASH = 3
    BADGEFORSURF = 4
    BADGEFORFLY = 5
    BADGEFORSTRENGTH = 6
    BADGEFORDIVE = 7
    BADGEFORWATERFALL = 8
    BADGEFORLAVASURF = 4

    and added this in PokemonHiddenMoves :

    #===============================================================================
    # 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 dyed a deep red... Would you like to surf?"))
    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.surfing=true
    Kernel.pbUpdateVehicle
    Kernel.pbJumpToward
    Kernel.pbUpdateVehicle
    $game_player.check_event_trigger_here([1,2])
    end

    def pbEndSurf(xOffset,yOffset)
    return false if !$PokemonGlobal.surfing
    x=$game_player.x
    y=$game_player.y
    currentTag=$game_map.terrain_tag(x,y)
    facingTag=Kernel.pbFacingTerrainTag
    if pbIsLavaSurfableTag?(currentTag) && !pbIsLavaSurfableTag?(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.pbTransferSurfing(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.surfing=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 pbIsLavaTag?(terrain) && !$PokemonGlobal.surfing &&
    !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>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
    Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
    return false
    end
    if $PokemonGlobal.surfing
    Kernel.pbMessage(_INTL("You're already Lava 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 !pbIsLavaTag?(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
    })



    here is a link to a video that shows what happens and you will see my problem : https ://www . youtube. c om/ watch?v=NBLgM4GuvBM&feature=youtu . be

    i cant post an actual link so just take away the spaces that have been added

    thanks for replying to my question. If you could help me fix this i would would greatly appreciate it!
     
    1,224
    Posts
    10
    Years
  • Code:
    $PokemonGlobal.surfing

    Not sure about all your problems, but you want to define a new variable in class PokemonGlobalMetadata that handles this (@lavasurfing, after @surfing. And make an accessor for it.) This is what everything should use, to differentiate between surfing and lava surfing. You will also need to add some stuff in Game_Map to check passability regarding this, and add a part to def pbUpdateVehicles to include lava surfing. Possibly other things.

    Another thing, please never ever use that yellow font again. It hurts my eyes to look at, I had to highlight it to be able to read it. Try red or blue.
     
    119
    Posts
    10
    Years
  • Alright thanks for the response. sorry for the font color i just used it to differentiate between new stuff and stuff already there, also i dont actually have knowledge in scripting so this seems a little advanced to me. i didnt think it would be this much work to add something that seems so easy. i may just add this later if i have time. Again thanks for the help!
     
    1,224
    Posts
    10
    Years
  • also what do you mean by "make an accessor for it"?

    adding
    Code:
    attr_accessor :lavasurfing
    to a class is a shorthand in ruby of adding a read method and a write method for that variable (@lavasurfing , in this case)

    It is the same as saying
    Code:
     def lavasurfing
    @lavasurfing #ruby will return the last value if there is not a return statement
    end
    
    def lavasurfing=(value)
    @lavasurfing=value
    end

    In this case it will let you check whether or not you are lava surfing, and allow you to set it to true or false.

    And this is probably a bit more advanced than you initially thought, just because it's handled in so many different places. It's good learning experience though, and will force you to learn more about the inner workings of Essentials.
     
    119
    Posts
    10
    Years
  • thanks a lot for all the responses, now im going to try and add the "pbUpdateVehicles to include lava surfing" part. You have been a great help. to be honest i didnt expect so many responses so quick
     
    119
    Posts
    10
    Years
  • i have added :

    # Make lava tiles passable if player is surfing
    elsif $PokemonGlobal.lavasurfing &&
    pbIsPassableLavaTag?(@terrain_tags[tile_id])
    return true
    in Game_Map but it still wont let me pass through the lava tile. am i doing it wrong?
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • Code:
    class PBTerrain
    Ledge = 1
    Grass = 2
    Sand = 3
    Rock = 4
    DeepWater = 5
    StillWater = 6
    [COLOR="MediumTurquoise"]Water = 7[/COLOR]
    Waterfall = 8
    WaterfallCrest = 9
    TallGrass = 10
    UnderwaterGrass = 11
    Ice = 12
    Neutral = 13
    SootGrass = 14
    Bridge = 15
    [COLOR="Red"]Lava = 22 [/COLOR]
    end
    Change Lava 22 to 7
    This will let it work like the water tile
     
    1,224
    Posts
    10
    Years
  • Code:
    class PBTerrain
    Ledge = 1
    Grass = 2
    Sand = 3
    Rock = 4
    DeepWater = 5
    StillWater = 6
    [COLOR="MediumTurquoise"]Water = 7[/COLOR]
    Waterfall = 8
    WaterfallCrest = 9
    TallGrass = 10
    UnderwaterGrass = 11
    Ice = 12
    Neutral = 13
    SootGrass = 14
    Bridge = 15
    [COLOR="Red"]Lava = 22 [/COLOR]
    end
    Change Lava 22 to 7
    This will let it work like the water tile

    I think he wants them to be separate HMs.
     
    Back
    Top