• 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.

Add Common Event When Choosing To Surf

148
Posts
11
Years
  • I made an event that starts when the player touches it and it checks to see if they have a Gyarados in their party, and if they do, asks them If they want to surf on it, changing the graphic. I'd have to put the event on every tile the player can choose to surf to make it work.

    I saw Rayd12smitty's Following Pokemon script used a common event to be called when talking to the pokemon. Though looking through it I'm not sure how it works. It would be a huge time saver if I could just make this event a common event and have it be called right after the player chooses "yes" to surf. Would someone mind explaining how that would work?
     

    Derxwna Kapsyla

    Derxwna "The Badman" Kapsyla
    437
    Posts
    12
    Years
  • Correct me if I'm wrong, but couldn't it be possible to alter the surf script so that it works like:
    If player has Gyarados in party (and ideally, you use it to surf)
    display [gyarados graphic]
    else
    display [normal surf graphic]

    I wouldn't know how to code it in properly, but that's how I'd handle it.
     
    824
    Posts
    8
    Years
  • Correct me if I'm wrong, but couldn't it be possible to alter the surf script so that it works like:
    If player has Gyarados in party (and ideally, you use it to surf)
    display [gyarados graphic]
    else
    display [normal surf graphic]

    I wouldn't know how to code it in properly, but that's how I'd handle it.

    If you want to do it this way, you want to go in the scripts to PField_Field, around line 1601 you'll find the following code:
    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
          [COLOR="red"]if pbHasSpecies?(:GYARADOS)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end
          else[/COLOR]
            $game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
          [COLOR="Red"]end[/COLOR]
        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
    Add the stuff in red.

    Then you need to add this somewhere above Main
    Code:
    module Settings
      GyaraSurfFileName = [
        "boy_surfGyara", # Player A
        "girl_surfGyara", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end

    You can change the file names. But whatever you do name them to, you need an image of the same name in Graphics/Characters/
     
    148
    Posts
    11
    Years
  • If you want to do it this way, you want to go in the scripts to PField_Field, around line 1601 you'll find the following code:

    You can change the file names. But whatever you do name them to, you need an image of the same name in Graphics/Characters/

    Thank you for the help. This worked beautifully. But I went and tried to have this work for multiple Pokemon. When I tried surfing as Gyarados it showed up as the default swim graphic, and when I tried with Sharpedo it just shows the player sort of skating on the water. I only had one of them in my party at a time.

    In PokemonField:

    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
    ###############################################################################
    #Player Has A Gyarados in Party                                               #
    ###############################################################################
    [COLOR="red"]  if pbHasSpecies?(:GYARADOS)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end[/COLOR]
    ###############################################################################
    #Player Has A Sharpedo in Party                                               
    ###############################################################################        
      [COLOR="Green"] if pbHasSpecies?(:SHARPEDO)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end      [/COLOR]
    ###############################################################################
    ###############################################################################
    ###############################################################################                
    [COLOR="red"] else   [/COLOR]           
          $game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
       [COLOR="Red"]end #Gyarados[/COLOR]
      [COLOR="Green"]  end #Sharpedo [/COLOR]

    and in the seperate section above "Main".
    Code:
    module Settings
      GyaraSurfFileName = [
        "boy_surfGyara", # Player A
        "girl_surfGyara", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end
    
    module Settings
      SharpedoSurfFileName = [
        "boy_surfSharpedo", # Player A
        "girl_surfSharpedo", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end

    Any idea why it messed up so bad? Thanks again for the help.
     
    Last edited:

    Derxwna Kapsyla

    Derxwna "The Badman" Kapsyla
    437
    Posts
    12
    Years
  • I believe what you want to do is change the if pbHasSpecies?(:SHARPEDO) to elsif pbHasSpecies?(:SHARPEDO), and then remove that end statement for Sharpedo.

    If you're going to do it for multiple Pokemon, it might also be best to run a check for the Pokemon that comes first. (as thats what surf prioritizes iirc), because if you have both: it'll be checking for Gyarados first due to placement in the script, and if guarados is in the party, but in Slot 6, it'll presume the script doesn't need to check for Sharpedo... I think. I've never had to mess with the surf stuff like this, so I'm only guessing.
     
    148
    Posts
    11
    Years
  • I believe what you want to do is change the if pbHasSpecies?(:SHARPEDO) to elsif pbHasSpecies?(:SHARPEDO), and then remove that end statement for Sharpedo.

    If you're going to do it for multiple Pokemon, it might also be best to run a check for the Pokemon that comes first. (as thats what surf prioritizes iirc), because if you have both: it'll be checking for Gyarados first due to placement in the script, and if guarados is in the party, but in Slot 6, it'll presume the script doesn't need to check for Sharpedo... I think. I've never had to mess with the surf stuff like this, so I'm only guessing.

    Thanks for the advice, though, the "elsif" causes the graphics to disappear all together for whatever reason.
     
    824
    Posts
    8
    Years
  • You want to do this:

    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
    [COLOR="Red"]      if pbHasSpecies?(:GYARADOS)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end
    [/COLOR][COLOR="Lime"]      elsif pbHasSpecies?(:SHARPEDO)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end                
    [/COLOR]      else              
            $game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
          end
        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

    Though I have to agree with the guy above me, should find a way to figure out the species of the first Surf-capable Pokemon in your party and use that. I'll have to look at the code and see if I can get a subroutine that returns the first Surf-capable Pokemon.
     
    Last edited:
    148
    Posts
    11
    Years
  • You want to do this:

    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
    [COLOR="Red"]      if pbHasSpecies?(:GYARADOS)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::GyaraSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end
    [/COLOR][COLOR="Lime"]      elsif pbHasSpecies?(:SHARPEDO)
            trainer=$Trainer if !trainer
            outfit=trainer ? trainer.outfit : 0
            if outfit==0
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]
            else
              $game_player.character_name=Settings::SharpedoSurfFileName[$PokemonGlobal.playerID]+"_"+outfit.to_s
            end                
    [/COLOR]      else              
            $game_player.character_name=pbGetPlayerCharset(meta,3) # Surfing graphic
          end
        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

    Though I have to agree with the guy above me, should find a way to figure out the species of the first Surf-capable Pokemon in your party and use that. I'll have to look at the code and see if I can get a subroutine that returns the first Surf-capable Pokemon.

    Thank you for the help and quick reply. The code you just posted was exactly what I had already though. I replaced mine with yours anyways and the issue is still the same. This is so far outside my wheelhouse. Really appreciate you taking the time to try and help.
     
    824
    Posts
    8
    Years
  • Copy and replace the entire function. The way you had it, it would only check for Sharpedo if you had a Gyarados. I've actually reformatted the "end"s at the end because of that.

    Also, it might be worth it to copy and paste from the printable version of the thread. The pretty version sometimes messes up bits of code longer than three lines.
     
    148
    Posts
    11
    Years
  • Copy and replace the entire function. The way you had it, it would only check for Sharpedo if you had a Gyarados. I've actually reformatted the "end"s at the end because of that.

    Also, it might be worth it to copy and paste from the printable version of the thread. The pretty version sometimes messes up bits of code longer than three lines.

    I did. replaced the whole thing and copied from thread tools. Still the same issues. Did I need to change anything from this?
    Code:
    module Settings
      GyaraSurfFileName = [
        "boy_surfGyara", # Player A
        "girl_surfGyara", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end

    i copy/pasted a version for sharpedo in the same script. Not sure if that matters.
     
    824
    Posts
    8
    Years
  • I did. replaced the whole thing and copied from thread tools. Still the same issues. Did I need to change anything from this?
    Code:
    module Settings
      GyaraSurfFileName = [
        "boy_surfGyara", # Player A
        "girl_surfGyara", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end

    i copy/pasted a version for sharpedo in the same script. Not sure if that matters.

    Does the file Graphics/Battlers/boy_surfGyara.png exist?
     
    824
    Posts
    8
    Years
  • Yep. The graphics show up fine when it's just checking for one species. But when it's both it starts messing up.

    That's really odd. I don't know why that would be.

    Logically the way you have the little bit where you define the filenames should work fine, but through experience helping other people I've discovered that things don't always work the way they logically should in Ruby. Try this:

    Code:
    module Settings
      GyaraSurfFileName = [
        "boy_surfGyara", # Player A
        "girl_surfGyara", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
      SharpedoSurfFileName = [
        "boy_surfSharpedo", # Player A
        "girl_surfSharpedo", # Player B
        "", # Player C
        "", # Player D
        "", # Player E
        "", # Player F
      ]
    end

    It's possible that your two definitions of module settings within the same script section are cancelling each other out.

    If this doesn't work then I've got nothing else for you.

    Also, if you do use this, in addition to crediting me (by the name Rot8er_ConeX), you should also credit Hansiec, since it's his/her/it's Mach and Acro Bike script that showed me how add new player spritesets.
     
    Last edited:
    148
    Posts
    11
    Years
  • Thank you for all the help. Nothing was working, then I had to restart my computer and when I reopened RPG Maker it all started working fine. Again, thanks so much. Huge time saver having this.
     
    148
    Posts
    11
    Years
  • There's one more thing I can't quite get to work. Using what Rot8er_Cone/ showed me I made different graphics show up when the player get's on their bike, depending on if a certain Pokemon was first in their party. Instead of a bike, it's them riding the Pokemon. I wanted to have each Pokemon have it's own speed. I looked in the "Walk_Run" section and all I could end up doing was make every speed increase, not just what I wanted. I thought having a switch turn on to change the speed depending on which Pokemon they were riding would work, but I wasn't sure how to have a specific switch turn on depending on the graphic. Or how to turn it off when they got off the Pokemon. Hate to keep asking for help but If anyone would mind.

    Example in case I wasn't to clear.

    Rhyhorn is first in the player's party. They select the bike, their graphic changes to them riding the Rhyhorn (this works fine now). Instead of the regular bike speed I'd like each ridable Pokemon to have it's own speed. Normal bike speed in my project is 7 : 7, when riding Rhyhorn I'd like it to be 4 : 4. Hope that was clear and hope someone wouldn't mind helping em out. Again.
     
    Back
    Top