Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Diagonal Stairs Event Tutorial

This is a rewrite of my former diagonal stairs toturial which unfortunately got lost with the latest database error a few months ago...


Part 1 :: Introduction

This tutorial's purpose is basically to teach you guys how to make 'real' diagonal stairs as in being able to walk on them and not 'skip' all of them with an event at the beginning of the stairs (a method I dislike because you take the control from the player in every single situation, which is bad in my opinion...).
This is once again event-based, though there's a little scripting part. You don't need to know much about events or scripts, as I'll try to explain it newbie-proof and have the script ready, but you should of course know where to find the event commands and similar easy stuff ;)


Part 2 :: Event Setup

Okay, so for this example, we're going to have from-upper-left-to-lower-right stairs. This is a sketch on how the stairs will look like, as well as a second picture showing the events we'll need...

http://img64.imageshack.us/img64/8494/s1ar0.png[/img] http://img64.imageshack.us/img64/4884/s2yk6.png[/img]

As you can already see, we'll need a lot events, but as they'll all be triggered on touch, they shouldn't cause much lag, nor much efford, as you only need three events which you can copy&paste then.

For the events, as you can also see in the second picture, we'll need three different ones - one center event handling all directions, and two border events just handling the left and right movement... you can tell what the events do by looking at the event code that can be seen in the following three pictures...

http://img453.imageshack.us/img453/3539/e1aq1.jpg[/img]
http://img117.imageshack.us/img117/3086/e2wi9.jpg[/img]
http://img453.imageshack.us/img453/574/e3kj1.jpg[/img]

You can copy the setup from these pictures. The only thing you need to pay attention to that's not quite shown in the picture is to select an impassable, invisible tile for all of the events.


Part 3 :: The Scripting Bit

The following script is needed to make the whole event stuff working. While it was possible in RM2k3 without this, it isn't anymore in RMXP because of a simple reason: You're no longer allowed to move from impassable tiles to passable ones for whatever reason. I have no idea why Enterbrain changed this, but I think installing this script will only get you good things... if you discover any inconcenienced with this script, please let me know. By the way, besides deleting the default comments, commenting-out the three lines you can spot in there, and of course the header comments, the script has been left unchanged.

To install it, simply paste it somewhere below the default Game_Character script.

Code:
#==============================================================================
# Impassable Tiles Movement Fix Script
#------------------------------------------------------------------------------
# Script by BlueScope
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    unless $game_map.valid?(new_x, new_y)
      return false
    end
    if @through
      return true
    end
    #unless $game_map.passable?(x, y, d, self)
    #  return false
    #end
    unless $game_map.passable?(new_x, new_y, 10 - d)
      return false
    end
    for event in $game_map.events.values
      if event.x == new_x and event.y == new_y
        unless event.through
          if self != $game_player
            return false
          end
          if event.character_name != ""
            return false
          end
        end
      end
    end
    if $game_player.x == new_x and $game_player.y == new_y
      unless $game_player.through
        if @character_name != ""
          return false
        end
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
end


Part 4 :: Outroduction

I hope people will use this tutorial to improve their stairs and their maps with it... because that's basically what this tutorial is about, I'm finished with one sentence! XD


Part 4 :: Credits & Thanks

BlueScope
Raiju for indirectly reminding me about posting this again.
 
I'm not entirely sure, but couldn't you just make a line of events on either side of the staircase that flip on a switch:

Making it so that when you hit the Right or Left keys, it moves your character right-down, or left-up.
 
Hm... you could, of course, would include a little more scripting... well, it's pointless for smaller stairs like the one I used as example, there's nothing wrong with using C&P a few times... IMO. I might update this with your suggestion in the near future, though.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top