Ladder Climbing Animation By BigEd781 Credit to DerVVulfman for his tile id formula
Introduction By default, when you climb down a ladder you face straight at the screen. I was making a mountain map and really didn't like it, so I made this. It doesn't need any configuration, but things can be adjusted if they need to be. All this does is turn the player around (i.e., facing up) when you are walking on a wall tile. Because wall tiles are generally unpassable, the only time this happens is when you are climbing up or down a ladder. This won't effect events or anything else but the player. Maybe I will add an option for events later on, but I really just did this because it was annoying me. This script also allows you to use a custom animation if you wish to, but as I had none that option is turned off by default.
Configuration / Use Just place it in the materials section. This script does not overwrite anything, so if you have any problems try placing it at the end of your list of scripts.
There are some things that you can configure if you wish. Like I said before, this works by setting certain tile id's which will act like "climbing ladder" tiles. All of the wall tiles in the RTP are already ON by default, so you probably will never have to configure anything. Most alternative tilesets place the walls in the same places as the RTP. If you are using tilesets which do not have wall tiles in the same places as the RTP, you can use the debug window to figure out which ones to remove. By default and when in test mode, pressing F5 will display a window that tells you the id of the tile you are standing on. When you need to add or remove a ladder tile, step on it in test mode and press F5. Remove that number from the collection of id's in the config section (shown below).
# this is the key that you may use to # display the id of the tile that you # are on. You shouldn't need to use # this, but if you would like to add # more tiles to the "ladder tile" # collection you can use this to find # the id. DEBUG_KEY = Input::F5 # this is a collection of tile ids. # this default set is all of the "wall" # type tiles in the RTP. If you need # to add or remove tiles to this set # you can use the debug window to do so. # to add a tile id, simply type in the # id number where noted below and add a # comma after it. Always keep the id's # between the two braces ('[' and ']'). # if you are using the Mack tileset, comment out # the two lines labeled "comment out for Mack". # you can do this by adding a '#' character # to the beginning of the line. TILE_IDS = [ 56, 57, 58, 59, 60, 61, 62, 63, 72, 73, 74, 75, 76, 77, 78, 79, 88, 89, 90, 91, 92, 93, 94, 95, 104, 105, 106, 107, 108, 109, 110, 111, 120, 121, 122, 123, 124, 125, 126, 127, 152, 153, 154, 155, 156, 157, 158, 159, # <-- comment out for Aërendyll's Mack tilesets 168, 169, 170, 171, 172, 173, 174, 175, 184, 185, 186, 187, 188, 189, 190, 191, # <-- comment out for Aërendyll's Mack tilesets # <-- Add id's here. ] # set this to true if you would like to # use a different graphic when climbing. USE_GRAPHIC = false # the file name of the custom graphic. # you do not need to add the file extension, # i.e., 'Actor1' not 'Actor1.png'. CHARACTER_NAME = 'Actor1' # the index of the character in the sheet. # in an 8 character sheet, '1' is the # top-left, '2' is the next to the right, # and '4' is the bottom left. CHARACTER_INDEX = 1
# this is the key that you may use to # display the id of the tile that you # are on. You shouldn't need to use # this, but if you would like to add # more tiles to the "ladder tile" # collection you can use this to find # the id. DEBUG_KEY = Input::F5 # this is a collection of tile ids. # this default set is all of the "wall" # type tiles in the RTP. If you need # to add or remove tiles to this set # you can use the debug window to do so. # to add a tile id, simply type in the # id number where noted below and add a # comma after it. Always keep the id's # between the two braces ('[' and ']'). # if you are using the Mack tileset, comment out # the two lines labeled "comment out for Mack". # you can do this by adding a '#' character # to the beginning of the line. TILE_IDS = [ 56, 57, 58, 59, 60, 61, 62, 63, 72, 73, 74, 75, 76, 77, 78, 79, 88, 89, 90, 91, 92, 93, 94, 95, 104, 105, 106, 107, 108, 109, 110, 111, 120, 121, 122, 123, 124, 125, 126, 127, 152, 153, 154, 155, 156, 157, 158, 159, # <-- comment out for Aërendyll's Mack tilesets 168, 169, 170, 171, 172, 173, 174, 175, 184, 185, 186, 187, 188, 189, 190, 191, # <-- comment out for Aërendyll's Mack tilesets # <-- Add id's here. ] # set this to true if you would like to # use a different graphic when climbing. USE_GRAPHIC = false # the file name of the custom graphic. # you do not need to add the file extension, # i.e., 'Actor1' not 'Actor1.png'. CHARACTER_NAME = 'Actor1' # the index of the character in the sheet. # in an 8 character sheet, '1' is the # top-left, '2' is the next to the right, # and '4' is the bottom left. CHARACTER_INDEX = 1
end
#--------------------------------------------------------------------- # * Debug class #--------------------------------------------------------------------- class Debug
def initialize @debug_window = nil @frame_count = 1 end
def hide_window? @frame_count += 1 @frame_count = 0 if @frame_count == 180 return (!@debug_window.nil?) && (@frame_count == 0) end
def hide_window unless @debug_window.nil? @frame_count = 1 @debug_window.dispose @debug_window = nil end end
def long_line(lines) long = '' lines.each { |line| long = line if line.size > long.size } return long end
def find_width(line) return Bitmap.new(544, 416).text_size(line).width + 32 end
def find_height(num_lines) return (num_lines * 24) + 32 end
def log(text, x=0, y=0) @debug_window = Window_Base.new(x, y, find_width(text), find_height(1)) draw(text) end
def log_lines(lines, x=0, y=0) @debug_window = Window_Base.new(x, y, find_width(long_line(lines)), find_height(lines.size)) draw_lines(lines) end
def draw(text) @debug_window.contents.draw_text(@debug_window.contents.rect, text) end
def draw_lines(lines) i = 0 for line in lines @debug_window.contents.draw_text(0, i, 544, 416, text) i += 24 end end
end
class Scene_Title
alias :eds_debug_create_game_objects :create_game_objects def create_game_objects eds_debug_create_game_objects $debugger = Debug.new end
end
class Scene_Base
def update $debugger.hide_window if ($debugger.hide_window? && $TEST) end
end
class Game_Map
#-------------------------------------------------------------------------- # * DerVVulfman method L get_tile_index #-------------------------------------------------------------------------- def tile_index(tile_id) case tile_id # Multi-tiled ids in Tileset 'A' when 2048..8191; return ((tile_id - 2000) / 48) - 1 # Individual tile ids in Tileset 'A' when 1536..1663; return(tile_id - 1408) # Tilesets 'B' to 'E' when 0..1023; return (tile_id + 256) end return 0 end
end
class Game_Player < Game_Character
def character_name=(value) @character_name = value end
def character_index=(value) @character_index = value end
alias :eds_pre_ladder_turn_left :turn_left def turn_left tile_index = $game_map.tile_index($game_map.data[x, y, 0]) return if Ladder_Config::TILE_IDS.include?(tile_index) eds_pre_ladder_turn_left end
alias :eds_pre_ladder_turn_right :turn_right def turn_right tile_index = $game_map.tile_index($game_map.data[x, y, 0]) return if Ladder_Config::TILE_IDS.include?(tile_index) eds_pre_ladder_turn_right end #-------------------------------------------------------------------------- # * Processing of Movement via input from the Directional Buttons #-------------------------------------------------------------------------- alias :eds_pre_ladder_move_by_input :move_by_input def move_by_input @move_failed = true eds_pre_ladder_move_by_input unless @move_failed tile_index = $game_map.tile_index($game_map.data[x, y, 0]) if Ladder_Config::TILE_IDS.include?(tile_index) if Ladder_Config::USE_GRAPHIC $game_player.character_name = Ladder_Config::CHARACTER_NAME $game_player.character_index = Ladder_Config::CHARACTER_INDEX else turn_up end else if Ladder_Config::USE_GRAPHIC $game_player.character_name = $game_party.members[0].character_name $game_player.character_index = $game_party.members[0].character_index end end end end #-------------------------------------------------------------------------- # * update #-------------------------------------------------------------------------- alias :eds_pre_ladder_update :update def update eds_pre_ladder_update if $TEST && Ladder_Config::DEBUG_KEY != nil if Input.trigger?(Ladder_Config::DEBUG_KEY) $debugger.hide_window $debugger.log($game_map.tile_index($game_map.data[x, y, 0])) end end end
For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.
Thanks in advance.
Hey there,
Well I don't make battle neither though I can still teach you some things :)... The way I've learned to script is by reading other scripts for the most part. I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!! The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script. You also need to feel the competition that's around in the scripting-community. Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P So that's an other thing... You also don't need to be afraid to learn from others or helpfiles. When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember. Then, you must be calm, cause you need to try the script a lot of times. When I write a script, I test it after almost every changes. First I set up the major structure. Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base def initialize(x,y,width,height) super(x,y,width,height) refresh end
def refresh self.contents.clear draw_contents end
def draw_contents draw_something(with, some, parameters) end
def update refresh if @something != @what_it_should_be end end
So that's also very important. Then, the biggest thing I learned scripting from is TRIAL AND ERROR. That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.
So that's it how I did it. Now it's up to you. Do some requests (if I didn't do it allready :P) and learn from them.
Hope that helped you out a little. If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials. Perhaps they're going to be usefull for you one day ;)
Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful
Comment Rate: Good
I find it very good and useful for climbing. it does make it more interesting in the game. I tryed it and it worked but it was a test and I didn't need it yet. Maybe I might add a climbing thing.
You could do the same with events...though perhaps a script is a bit more easy if you don't want to spent time copy and pasting 2 events
Greatzz, SojaBird.
Yeah, you would have to line every ladder though, and it just seemed unnecessary to me. Truthfully, I'm not a big fan of scripting things that could be done with events either, but I was making a map in my own game with a ton of ladders I did this solely for convenience. now I don't have to think about it.
If that class also had a Debug class with a method of the same name that did not take the same parameter number or type I suppose it could. I could change it DebugTileId or something I suppose.
Group: Member
Posts: 1
Type: None
RM Skill: Beginner
This is definitely an interesting script, and something I was interested in using. However, I did notice one thing. If a player is in an airship, and flies over a tile that is designated as a "wall" tile, then it will change direction as though it were climbing. Is there any way to use a switch to turn on and off the climbing sprite changes?
Well first off, this is a great idea! but unfortunately, it doesn't do anything when you go down, you face up for left, right and up but you face down when you move down... That might have been very confusing... thanks, Miget man12
__________________________
By the way:
I'm bored because it's summer so I decided to drop by for a bit.
Group: Member
Posts: 3
Type: None
RM Skill: Intermediate
Cool, it seems a lot simpler than doing the whole "event at the top of the ladder" thing. Though, it doesn't work with the Caterpillar script, so I'll have to stick with the "touch a ladder = transfer to other side" thing. But good job anyway, you've probably saved a lot of people from a big pain in the ass.
Well first off, this is a great idea! but unfortunately, it doesn't do anything when you go down, you face up for left, right and up but you face down when you move down... That might have been very confusing... thanks, Miget man12
That's not true, the whole point of the script is to turn the player up when moving down. There isn't much to do when moving up the ladder.
I don't think that either of those would be helpful. The screenshot would not be very descriptive, and a demo would be overkill. It is a simple script.