Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Ladder Climbing Done Right, No more walking down a ladder facing the screen
BigEd781
post Jan 18 2009, 03:01 AM
Post #1


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




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

CODE
# 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


Script
CODE
module Ladder_Config
    
  # 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
  
end


Compatibility / Bugs
Let me know of any issues.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
SojaBird
post Jan 18 2009, 05:28 AM
Post #2


Level 51
Group Icon

Group: Revolutionary
Posts: 1,573
Type: Scripter
RM Skill: Advanced




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 biggrin.gif

Greatzz,
SojaBird.


__________________________
Art from the highest shelf?

Scriptology, scripting podcast



HUD's Request Lobby (multiple hud-scripts)


------------------------------------------------------------------

Random Stuff
OMG, it's Hab!!


This is a crazy drawing application! (by me)

How did I learned to script
QUOTE
Hey pim! I'm the Law G14!

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 ;)


Greatzz,
SojaBird.
Go to the top of the page
 
+Quote Post
   
Mickadell
post Jan 18 2009, 07:28 AM
Post #3


Level 5
Group Icon

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.
Attached File(s)
Attached File  Good.png ( 2.39K ) Number of downloads: 24
 
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 18 2009, 12:45 PM
Post #4


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (pim321 @ Jan 18 2009, 05:28 AM) *
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 biggrin.gif

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.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
sandy
post Jan 18 2009, 01:33 PM
Post #5


Level 17
Group Icon

Group: Revolutionary
Posts: 329
Type: None
RM Skill: Undisclosed




Great idea, BigEd! One of those little things most people don't even think about smile.gif


__________________________
RPG Maker VX Resources - Blogthing updated daily with new stuff you can use
Temporarily not be updated daily. My bad!
Go to the top of the page
 
+Quote Post
   
woratana
post Jan 18 2009, 07:10 PM
Post #6


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Good idea~! I've never think about this. >_>/


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 18 2009, 07:19 PM
Post #7


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (woratana @ Jan 18 2009, 07:10 PM) *
Good idea~! I've never think about this. >_>/


Thanks Wora. Like they say, necessity is the mother of invention.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
woratana
post Jan 18 2009, 07:42 PM
Post #8


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




My suggestion is that class 'Debug' is not the best name I can think of using in my script.

The script might crash with other script that make class with the same name.
You may want to change the name to something that is not too simple. ^^


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 18 2009, 08:07 PM
Post #9


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




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.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
DragonRaw22
post Jan 26 2009, 03:28 PM
Post #10



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Beginner




I like this script but I can't seem to get it to work along with the catipillar script, any help would be nice. Cheers happy.gif
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 26 2009, 03:48 PM
Post #11


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (DragonRaw22 @ Jan 26 2009, 03:28 PM) *
I like this script but I can't seem to get it to work along with the catipillar script, any help would be nice. Cheers happy.gif


I don't use the caterpillar script, but it would be easy, so I'll make a patch for it. Can you link me to the script that you are using?


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
DragonRaw22
post Jan 29 2009, 09:02 AM
Post #12



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Beginner




Sorry about the delay internet went down, this is the script i am using, thanks for this.

http://www.rpgrevolution.com/forums/index.php?showtopic=8040

cheers
Go to the top of the page
 
+Quote Post
   
cello_marl
post Feb 15 2009, 10:21 AM
Post #13



Group Icon

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?
Go to the top of the page
 
+Quote Post
   
miget man12
post Feb 15 2009, 10:59 AM
Post #14


Making a Comeback
Group Icon

Group: Revolutionary
Posts: 393
Type: Musician
RM Skill: Intermediate




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.
Go to the top of the page
 
+Quote Post
   
jick6
post Mar 6 2009, 10:25 PM
Post #15



Group Icon

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.
Go to the top of the page
 
+Quote Post
   
BigEd781
post May 3 2009, 04:20 PM
Post #16


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (miget man12 @ Feb 15 2009, 11:59 AM) *
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.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
gamemakernoob
post Oct 20 2009, 09:45 AM
Post #17



Group Icon

Group: Member
Posts: 1
Type: Developer
RM Skill: Beginner




I tested this script and it was conveniently awesome yes.gif

This post has been edited by gamemakernoob: Oct 20 2009, 09:46 AM
Go to the top of the page
 
+Quote Post
   
alexstore1
post Nov 11 2009, 09:36 AM
Post #18


Level 1
Group Icon

Group: Member
Posts: 10
Type: Developer
RM Skill: Intermediate




Can you make a demo teehee.gif or screenshot?
Go to the top of the page
 
+Quote Post
   
alexstore1
post Nov 11 2009, 09:43 AM
Post #19


Level 1
Group Icon

Group: Member
Posts: 10
Type: Developer
RM Skill: Intermediate




I don't understand!

please dont double post - use the edit button instead.

Thanks

kaz
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 9 2009, 10:54 AM
Post #20


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (alexstore1 @ Nov 11 2009, 09:36 AM) *
Can you make a demo teehee.gif or screenshot?


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.

QUOTE (alexstore1 @ Nov 11 2009, 09:43 AM) *
I don't understand!


dry.gif What don't you understand exactly?


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 10:56 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker