• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Scripting Question] riding pokemon

  • 23
    Posts
    9
    Years
    • Seen Nov 24, 2016
    hi to all, for my hack i want pu the possibility to riding different pokemon (tauros,arcanine, all eevee evolution ecc...)
    for doing this i want made different items, and when player use it, ride the selected pokemon.
    for example, if use item "BALLARC", player ride an Arcanine.
    i have no problem to made an arcanine, my only problem is "how can change the picture?where and what script i must insert?".
    i say that i must put in folder character a sprite.
     
    master that post is for an mt, i want different item, is a bit different. what i need to change?
     
    Not an event in map. Is an item such as a Bicycle. We can think that exist a lot of item called bicycle-namepokemon (bicycle-arcanine, bicycle-tauros ecc...) when you use one of this item, appears the exact sprite

    For example i made a sprite "boy_bicycle_arcanine" and a sprite "boy_bicycle_tauros". If i use item"bicycle_arcanine" i use sprite "boy_bicycle_arcanine"; if i use item "bicycle_tauros" use sprite"boy_bicycle_tauros"... i want add this possibility for a lot of item.. such as (30 or more).. and all of this item have the speed of a bicycle
     
    Last edited by a moderator:
    In this case is more simple. Make sure to have Pokemon Essentials v 16.2 and to make a BACKUP of your save game (because the metadata will be changed and, probably, it will ruin your save data.) and of your Script.rxdata.

    First of all, into PBS/items.txt, add your item line (Replace XXX with your custom ID number):
    Code:
    XXX,BALLARC,Ballarc,Ballarc,8,0,"Description",2,0,6,


    Giving focus to the scripts, into PField_Metadata script section, after attr_accessor :bicycle add the following code:

    Code:
    attr_accessor :riding

    Then, after @bicycle = false, add the following code:

    Code:
    @riding               = [false,nil]



    Then, into Walk_Run script section, in def pbCanRun?, right after this:

    Code:
    !$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain)

    You have to add this:

    Code:
     &&
           !$PokemonGlobal.riding[0]

    Then, into def update?, after this lines:

    Code:
    if $PokemonGlobal.bicycle
            @move_speed = $RPGVX ? 8 : 5.2

    You have to add this:

    Code:
          elsif $PokemonGlobal.riding[0]
            @move_speed = $RPGVX ? 7 : 5



    Then into MiscData script section, after line MetadataPlayerH = 15, add this:

    Code:
    MetadataRidingBGM        = 16

    Then, right after "PlayerH"=>[MetadataPlayerH,"esssssss",:PBTrainers] you have to put a comma and you have to add this:

    Code:
    "RidingBGM"=>[MetadataRidingBGM,"s"]

    These previous codes allow you to play a custom BGM when you riding a Pokémon. Remember to add the parameter "RidingBGM" into PBS/metadata.txt



    Then, into PField_Field script section, after the entire section of def Kernel.pbMountBike section you have to add this:

    Code:
    def Kernel.pbRidePokemon(pokemonName)
      return if $PokemonGlobal.riding[0]
      $PokemonGlobal.riding[0]=true
      $PokemonGlobal.riding[1]=pokemonName
      Kernel.pbUpdateVehicle
      ridingbgm=pbGetMetadata(0,MetadataRidingBGM)
      if ridingbgm
        pbCueBGM(ridingbgm,0.5)
      end
    end

    After the entire section of def Kernel.pbDismountPokemon add this:

    Code:
    def Kernel.pbDismountPokemon
      return if !$PokemonGlobal.riding[0]
      $PokemonGlobal.riding[0]=false
      $PokemonGlobal.riding[1]=nil
      $game_player.setDefaultCharName(nil,$game_player.fullPattern)
      Kernel.pbUpdateVehicle
      $game_map.autoplayAsCue
    end

    Then, into def Kernel.pbUpdateVehicle, after this:

    Code:
    elsif $PokemonGlobal.bicycle
          $game_player.character_name=pbGetPlayerCharset(meta,2) # Bicycle graphic

    You have to add this:

    Code:
          elsif $PokemonGlobal.riding[0]  # Riding graphic
           if $Trainer.gender==0
            $game_player.setDefaultCharName("boy_riding_"+$PokemonGlobal.riding[1].to_s,$game_player.fullPattern)
          elsif $Trainer.gender==1
            $game_player.setDefaultCharName("girl_riding_"+$PokemonGlobal.riding[1].to_s,$game_player.fullPattern)
          end



    Then, into PField_HiddenMoves script section, in HiddenMoveHandlers::CanUseMove.add(:SURF,proc{|move,pkmn|, after

    Code:
       if $PokemonGlobal.surfing
         Kernel.pbMessage(_INTL("You're already surfing."))
         return false
       end

    You have to add this:

    Code:
       if $PokemonGlobal.riding[0]
         Kernel.pbMessage(_INTL("You currently can't surf because you're mounting a Pokémon."))
         return false
       end



    Then, into PItem_Items script section, into def pbBikeCheck, before the line:

    Code:
    if $game_player.pbHasDependentEvents?

    Add this:

    Code:
      if $PokemonGlobal.riding[0]
        Kernel.pbMessage(_INTL("You currently can't use that because you're mounting a Pokémon."))
        return false
      end

    Then, after the entire section of def pbBikeCheck, you have to add this:

    Code:
    def pbRidingCheck
      if($PokemonGlobal.surfing || pbGetTerrainTag==PBTerrain::TallGrass)
        Kernel.pbMessage(_INTL("Can't use that here."))
        return false
      end
      if $PokemonGlobal.bicycle
        Kernel.pbMessage(_INTL("You can't mount a Pokémon at the moment."))
        return false
      end
      if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        return false
      end
      val=pbGetMetadata($game_map.map_id,MetadataOutdoor)
      if !val
        Kernel.pbMessage(_INTL("Can't use that here."))
        return false
      end
      return true
    end



    Finally, into PItems_ItemsEffect script section, after this code:

    Code:
    ItemHandlers::UseFromBag.add(:BICYCLE,proc{|item|
       next pbBikeCheck ? 2 : 0
    })

    You have to add this:

    Code:
    ItemHandlers::UseFromBag.add(:BALLARC,proc{|item|
       next pbRidingCheck ? 2 : 0
    })
    )

    After the entire section of ItemHandlers::UseInField.add(:BICYCLE,proc{|item|, you have to add your item script:

    Code:
    ItemHandlers::UseInField.add(:BALLARC,proc{|item|
       if pbRidingCheck
         if $PokemonGlobal.riding[0]
           Kernel.pbDismountPokemon
         else
           Kernel.pbRidePokemon("Arcanine")
         end
       end
    })

    It's needed that your riding sprites have a specific structure.
    - If the trainer is male:
    boy_riding_POKEMONNAME => e.g. boy_riding_Arcanine
    - If the trainer is female:
    girl_riding_POKEMONNAME => e.g. girl_riding_Arcanine


    If you want to add more riding Items, you have to duplicate Ballarc effect, after Ballarc Item script section, like this:
    Code:
    ItemHandlers::UseInField.add(:SADDLE,proc{|item|
       if pbRidingCheck
         if $PokemonGlobal.riding[0]
           Kernel.pbDismountPokemon
         else
           Kernel.pbRidePokemon("Tauros")
         end
       end
    })

    And after this line:
    Code:
    ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)

    You have to add this:
    Code:
    ItemHandlers::UseFromBag.copy(:BALLARC,:SADDLE) #Add riding items in this list, separated by a comma



    ONLY IF YOU'RE USING THIS SCRIPT
    You have to edit def pbRidePokemon to the following code:

    Code:
    def Kernel.pbRidePokemon(pokemonName)
      return if $PokemonGlobal.riding[0]
      $PokemonGlobal.riding[0]=true
      $PokemonGlobal.riding[1]=pokemonName
      if $game_switches[Toggle_Following_Switch]
        $PokemonTemp.dependentEvents.remove_sprite(true)
      end
      Kernel.pbUpdateVehicle
      ridingbgm=pbGetMetadata(0,MetadataRidingBGM)
      if ridingbgm
        pbCueBGM(ridingbgm,0.5)
      end
    end

    Then, you have to edit def pbDismountPokemon to the following code:

    Code:
    def Kernel.pbDismountPokemon
      return if !$PokemonGlobal.riding[0]
      $PokemonGlobal.riding[0]=false
      $PokemonGlobal.riding[1]=nil
      if $game_switches[Toggle_Following_Switch]
        $PokemonTemp.dependentEvents.Come_back(true)
      end
      $PokemonTemp.dependentEvents.refresh_sprite
      $game_player.setDefaultCharName(nil,$game_player.fullPattern)
      Kernel.pbUpdateVehicle
      $game_map.autoplayAsCue
    end

    Then, delete the following section to def pbRidingCheck:

    Code:
      if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        return false
      end

    Finally, right after this line:

    Code:
    if Input.trigger?(Input::CTRL) && ALLOWTOGGLEFOLLOW && !$PokemonGlobal.bicycle

    You have to add this:

    Code:
    && !$PokemonGlobal.riding[0]
     
    Last edited:
    Thanks master! Now i can't test if (i'm not at home) where i can i implement it immediatly and i tell you how it is perfext 😍

    master i get thius error
    Spoiler:


    what i do wrong?
     
    Last edited by a moderator:
    No, it doesn't. This is not the problem, because i've tested your script.rxdata and it works well (I have put under comment some of your libraries because I haven't them).
    I'll update my main post (with some improvements) as soon as I can. Make sure to take a look.

    EDIT:
    Take a look to Walk_Run and PBS/items.txt
     
    Last edited:
    master now it work perfectly; buf if i have a pokemon that follow me i can't use it... can you help me to fix that? such as when you start to riding you stop the following pokemon animation, and it return when you dismount
     
    I'll update my main post with your requests as soon as I can. Make sure to take a look.

    EDIT: I need your game project (you can also send me a Demo version) to make some tests about follower animation, because i haven't all i need.
     
    Last edited:
    Perfect. I'll update the main post, with a dedicated section to following Pokémon.

    EDIT: Now, it works with your script.
     
    Last edited:
    Back
    Top