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

Spin Tiles

  • 1,682
    Posts
    8
    Years
    • Seen Jun 13, 2024
    Spin Tiles

    This script adds in Spin tiles, a Pokémon staple! Once the player steps on one of these tiles, they'll go spinning in the direction on the tile until they hit an impassable object. Hitting another spin tile redirects the player.

    To use it, you must create 4 new tiles with terrain tags specifying the spun direction. Remember to change the presets if you have other terrain tags installed!

    There's also one other edit to def character_name in Game_Player_Visuals.
    New lines in red.
    Code:
      def character_name
        @defaultCharacterName = "" if !@defaultCharacterName
        return @defaultCharacterName if @defaultCharacterName!=""
        if !@move_route_forcing && $PokemonGlobal && $PokemonGlobal.playerID>=0
          meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
          if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
            if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
              # Display running character sprite
              @character_name = pbGetPlayerCharset(meta,4)
    [COLOR="Red"]        elsif $PokemonGlobal.spinning
              @character_name = pbGetPlayerCharset(meta,7)[/COLOR]
            else
              # Display normal character sprite 
              @character_name = pbGetPlayerCharset(meta,1)
            end
            @wasmoving = moving?
          end
        end
        return @character_name
      end
    You also have to edit pbCanRun? in the same section to add in the anti run in spin check.
    Code:
      def pbCanRun?
        return false if $game_temp.in_menu || $game_temp.in_battle ||
                        @move_route_forcing || $game_temp.message_window_showing ||
                        pbMapInterpreterRunning?
        terrain = pbGetTerrainTag
        input = ($PokemonSystem.runstyle==1) ? ($PokemonGlobal && $PokemonGlobal.runtoggle) : Input.press?(Input::A)
        return input &&
           $PokemonGlobal && $PokemonGlobal.runningShoes &&
           !$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
           !$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain)[COLOR="Red"] && 
           !$PokemonGlobal.spinning # this and the above && are new[/COLOR]
      end
    Finally you have to edit update in the same section to prevent carrying an old speed over into the tiles.
    Code:
      def update
        if PBTerrain.isIce?(pbGetTerrainTag)
          @move_speed = ($RPGVX) ? 6.5 : 4.8 # Sliding on ice
    [COLOR="Red"]    elsif $PokemonGlobal.spinning
          @move_speed = ($RPGVX) ? 4.5 : 3.8 # Spinning[/COLOR]
        elsif !moving? && !@move_route_forcing && $PokemonGlobal
          if $PokemonGlobal.bicycle
            @move_speed = ($RPGVX) ? 8 : 5.2 # Cycling
          elsif pbCanRun? || $PokemonGlobal.surfing || $PokemonGlobal.diving
            @move_speed = ($RPGVX) ? 6.5 : 4.8 # Running, surfing or diving
          else
            @move_speed = ($RPGVX) ? 4.5 : 3.8 # Walking
          end
        end
        update_old
      end
    You also have to add a new image to the Player fields in metadata.txt. Here's mine:
    Code:
    PlayerA=POKEMONTRAINER_Red,trchar000,boy_bike,boy_surf,boy_run,boy_surf,boy_fish_offset[COLOR="Red"],boy_spin[/COLOR],xxx
    If you have another script that uses the metadata, you will need to change the 7 in pbGetPlayerCharset(meta,7) to the new position in the metadata.
    my boy_spin looks like this:
    Spin Tiles

    You can swap the left and right facing columns if it looks better. I tried both, can't tell the difference.

    Make sure to credit Vendily, thepsynergist and Barrel's O'Fun!
    Get it here!
     
    Last edited:
  • 1,682
    Posts
    8
    Years
    • Seen Jun 13, 2024
    Hi, one question, can we just flip the same boy000 sprite instead making a new character metadata? Just like here- https://www.pokecommunity.com/showthread.php?t=407411
    So that, we dont have to do a long process!!!

    That tutorial uses an outfit, kind of. While technically you could use an outfit, I left it to the metadata so that if you want to use outfits, both systems play nice together.
    Besides, it's only 2 extra steps, both rather small.
     
  • 1,682
    Posts
    8
    Years
    • Seen Jun 13, 2024
    New Update, Stop tiles added!

    This update adds in Stop tiles, which is a thing, apparently? Never really played much of RBY, FRLG, or HGSS, so I never saw them.

    Stop tiles do exactly what you think they do, stop the player dead in their tracks if they're spinning.

    If you don't plan on using them, just set the terrain tag to -1!
     

    Karthick__

    Pokemon Fan Game Developer
  • 48
    Posts
    4
    Years
    and where do i make the event?

    You need to make or modify events in the spin tiles, set the character spin directions and most important is, the spin chracter Protoganist is must needed for this, so don't delete that you need to edit your protoganist chracter after you finish the work.
     

    The cool Treecko

    Wild Treecko appeared!
  • 146
    Posts
    3
    Years
    You need to make or modify events in the spin tiles, set the character spin directions and most important is, the spin chracter Protoganist is must needed for this, so don't delete that you need to edit your protoganist chracter after you finish the work.

    thank you
     

    alphakhronos

    Noob Game Designer
  • 1
    Posts
    3
    Years
    • Seen Feb 7, 2021
    I am using this with v18 and getting an error with line 70 of the script when play testing. This is the line it doesn't like:

    Events.onStepTakenFieldMovement+=proc {|sender,e|

    I'm assuming it's because this was written for v17.

    Any ideas on how to fix this please?

    Edit: I was being stupid and didn't put the script in a new script page. I was trying to put it in pbTerrain. Now I've fixed this, the game not longer crashes or has error messages. But, my character isn't spinning, just running along the tiles. I know my image for spinning character works because i used it for the run character and when i ran i also spun. It's just not changing the character set when stepping on the spin tiles. Is this because $PokemonGlobal.spinning isn't active or because the player visuals formatting is wrong in character name

    def character_name
    @defaultCharacterName = "" if !@defaultCharacterName
    return @defaultCharacterName if @defaultCharacterName!=""
    if !@move_route_forcing && $PokemonGlobal.playerID>=0
    meta = pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
    if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
    charset = 1 # Display normal character sprite
    if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
    charset = 4 # Display running character sprite
    elsif $PokemonGlobal.spinning
    @character_name = pbGetPlayerCharset(meta,8)
    end
    newCharName = pbGetPlayerCharset(meta,charset)
    @character_name = newCharName if newCharName
    @wasmoving = moving?
    end
    end
    return @character_name
    end
     
    Last edited:
  • 62
    Posts
    4
    Years
    • Seen Jun 2, 2024
    Updated for v19.1

    https://pastebin.com/wF9WraPA

    It has some additional parameters at the top you must define, and the edits listed at the beginning of this page still apply.
    My code is probably not perfect/messy but it works for me!
     
  • 2
    Posts
    2
    Years
    • Seen Jan 26, 2023
    Anyone willing to help a newbie, not sure if I got the terrain tags incomplete somehow or placing it on the wrong layer, is there an event that needs to be made on each tile(is this specified anywhere I might've missed?) or maybe I am adding the code to the wrong area(not its own page, in PBTerrain, etc.) Please let me know I'll be checking in every now and then here to check for responses, thank you.
     
  • 2
    Posts
    2
    Years
    • Seen Jan 26, 2023
    (Version 17.2) Not that it isn't obvious but I had left it out in my OG post. I am referring to the spin tiles not working when I step on them. No spinning, no errors. Nothin'.
    Wanted to add that I might've found something for an event but none that I was able to use to make it work. What I mean is the following:
    Kernel.pbSpinTile
    (PBTerrain::SpinTileUp)
    Does nothing, not sure if Im doin it right but again please let me know.
     
    Last edited:
  • 10
    Posts
    1
    Years
    • Seen today
    Hi, anyone has a version working with 20.1 or another script making spin tiles work ?
     
    Back
    Top