The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => Topic started by: couldbne1 on November 07, 2011, 02:15:34 AM

Title: [XP] Grass slow movement
Post by: couldbne1 on November 07, 2011, 02:15:34 AM
OK I am just wondering if there is a way other than a huge area filled with events to have the character slow down when walking in deep grass/snow/bushes or something like that.
Title: Re: Grass slow movement
Post by: modern algebra on November 07, 2011, 02:51:11 AM
Well, it wouldn't have to be filled with events. It could be done by just having a layer of events all around it. Or, alternatively, you could use a single parallel process event which sets the Player's X and Y ot variables, and you could then use a series of conditional branches to check if the player was in a slow-down area or not, and set movement speed accordingly.

Also, there are scripts which can do it. For instance, if you're using RMVX, my Terrain Types (http://rmrk.net/index.php/topic,34410.0.html) script has that feature, though configuration might be a little heavy.

I am sure there are similar scripts for RMXP and, of course, it is a default option in RM2k3, so if that's what you're using it's simply a matter of going into the database.
Title: Re: Grass slow movement
Post by: Dyre on November 07, 2011, 03:01:44 AM
Variables, as mentioned above, would likely be your best bet if you're not big on script-use. You can use terrain tags to set which parts of the tileset will cause slow down.

I actually made a demo for something else, awhile back, to show how terrain tags and variables work. It's very simple but I've found it takes up the least amount of resources. For evented system, anyhow.

http://rmrk.net/index.php/topic,39866.msg459917.html#msg459917

If nothing else it can act as a starting point to figuring out how to make your tall grass/snow idea work.
Title: Re: Grass slow movement
Post by: couldbne1 on November 07, 2011, 03:06:54 AM
crap I did forget to say what program I am using didn't I lol yes I am using VX

Modern Algebra- I thought of just ringing the area with events  to slow/resume speed but with such a large area I think it will get laggy because the area I want to have movement slowed down in is one half of a "continent" of deep grass with random sized spaces of no grass, and the other is the obligatory snow/ice continent. I will give your Terrain types a try and see if I can get it to work for me as I am using a number of your other scripts and love them   :)


Drye- As I am somewhat absent minded and forgot to state that I am using VX I am not sure if I can use your demo as a guide but will give that a try as well.
Title: Re: Grass slow movement
Post by: couldbne1 on November 07, 2011, 03:45:46 AM
Well MA, it seems that your Terrain Type is a little more complicated than I am able to handle LOL so I will have to try the parallel process idea and see how that works out.
Title: Re: Grass slow movement
Post by: Nessiah on November 07, 2011, 10:04:02 AM
Or what you can do is get the Tile ID for grass tiles and make an event that says slow walk speed if stepping on x tile else return to normal speed. I'd have to check this out first though. Never really messed with that.
Title: Re: Grass slow movement
Post by: couldbne1 on November 08, 2011, 12:14:20 AM
OK Nessiah I am a bit new still how do I go about getting the ID for the grass tile I am using?
Title: Re: Grass slow movement
Post by: Nessiah on November 09, 2011, 09:26:31 AM
http://www.rpgmakervx.net/index.php?showtopic=19047&st=0&p=165421&#entry165421

What I'm not sure is how to actually bind it to a variable. Sorry. A scripter might be better for it.

But here's probably something that would interest you:
http://www.rpgmakervx.net/lofiversion/index.php/t42080.html
I can't find said mithran script tho '_');

Or use this:

Code: [Select]
#==============================================================================
# ** RMVX Eventer's Toolbox
#------------------------------------------------------------------------------
# * Includes several different utilities to make eventing easier.
# 10-03-2008 (dd-mm-yyyy) Â © Hevendor of hbgames.org
# Version 0.2.2
# Latest update: N/A
#==============================================================================

#==============================================================================
# * INSTRUCTIONS
# Remember when you had to set player coords, event coords to variables
# just to check where your events were, where rocks were etc.?
# Not anymore! Rock-pushing puzzles? Made easy!
# Use each of these commands wherever you want, though they are designed to use
# in a conditional branch event command. An example follows:
# @>Conditional Branch: $game_map.standing_on_tile?(5, 13)
#     @> Do stuff, will happen if you ARE standing on the coords 5,13
#   Else
#     @> Do the rest of stuff, will happen if you ARE NOT standing on 5,13
#------------------------------------------------------------------------------
# * COMMANDS
# $game_map.standing_on_tile?(x, y)
#   - checks if player is standing on map coordinates (x, y)
#
# $game_map.standing_on_event?(id)
#   - checks if player is standing on event (id)
#
# $game_map.adjacent_tile?(x, y, standing)
#   - checks if player is adjacent to tile (x, y).
#   - if standing = false, it will check only if you are adjacent
#   - if standing = true, it will check if you are adjacent OR standing on tile
#
# $game_map.cross_adjacent_event?(id, n)
#   - checks if player is in a cross range of event ID, where n is the radius
# of the cross. To check if player is adjacent to event, use n=1
#
# $game_map.event_adjacent_event?(id, id2, n)
#   - checks if event (id) is adjacent to event (id2), where n is the radius
# of the cross. To check if the events are directly adjacent, use n=1.
#
# $game_map.event_standing_coords?(id, x, y)
#   - checks if event (id) is standing on map coordinates (x, y).
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :px
  attr_accessor :py
  #--------------------------------------------------------------------------
  # * Alias Definitions
  #--------------------------------------------------------------------------
  alias hev_rmvx_toolbox_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    hev_rmvx_toolbox_initialize
    @px = 0
    @py = 0
  end
  #--------------------------------------------------------------------------
  # * Player standing on map coords (x, y)?
  #--------------------------------------------------------------------------
  def standing_on_tile?(x, y)
   if $game_player.x == x and $game_player.y == y
     return true
   else
     return false
    end
  end
  #--------------------------------------------------------------------------
  # * Player standing on event (id)?
  #--------------------------------------------------------------------------
  def standing_on_event?(id)
    if $game_player.x == @events[id].x && $game_player.y == @events[id].y
      return true
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  # * Is player adjacent (or standing on) to tile (x, y)?
  #--------------------------------------------------------------------------
  def adjacent_tile?(x, y, standing)
     @px = $game_player.x
     @py = $game_player.y
    if standing = false
     if (@px != x && @py != y) || (@px == x && @py == y)
      return false
     end
    end
    if standing = true
     if (@px != x && @py != y)
       return false
     end
    end
    if @px < x
      if (x - @px) <= 1
        return true
      end
    end
    if @px > x
      if (@px - x) - @px <= 1
        return true
      end
    end
    if @py > y
      if (@py - y) <= 1
        return true
      end
    end
    if @py < y
      if (y - @py) <= 1
        return true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Is player (n) tiles adjacent to event (id) [in a cross pattern]?
  #--------------------------------------------------------------------------
  def cross_adjacent_event?(id, n)
     @px = $game_player.x
     @py = $game_player.y
    if (@px != @events[id].x && @py != @events[id].y) || (@px == @events[id].x && @py == @events[id].y)
      return false
    end
    if @px < @events[id].x
      if (@events[id].x - @px) <= n
        return true
      end
    end
    if @px > @events[id].x
      if (@px - @events[id].x) - @px <= n
        return true
      end
    end
    if @py > @events[id].y
      if (@py - @events[id].y) <= n
        return true
      end
    end
    if @py < @events[id].y
      if (@events[id].y - @py) <= n
        return true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Is event (id) adjacent to event (id2?)
  #--------------------------------------------------------------------------
  def event_adjacent_event?(id, id2, n)
    if @events[id].x != @events[id2].x && @events[id].y != @events[id2].y
      return false
    end
    if @events[id].x == @events[id2].x && @events[id].y == @events[id2].y
      return false
    end
    if @events[id].x < @events[id2].x
      if (@events[id2].x - @events[id].x) <= n
        return true
      end
    end
    if @events[id].x > @events[id2].x
      if (@events[id].x - @events[id2].x) - @events[id].x <= n
        return true
      end
    end
    if @events[id].y > @events[id2].y
      if (@events[id].y - @events[id2].y) <= n
        return true
      end
    end
    if @events[id].y < @events[id2].y
      if (@events[id2].y - @events[id].y) <= n
        return true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Is event (id) standing on map coords. (x, y)?
  #--------------------------------------------------------------------------   
  def event_standing_coords?(id, x, y)
    if @events[id].x == x && @events[id].y == y
      return true
    else
      return false
    end
  end
end

If you're resorting to using events instead, make sure to have anaryu's anti-lag script.
Title: Re: Grass slow movement
Post by: couldbne1 on November 10, 2011, 03:19:54 AM
OK how do I find the Tile ID? I have found online that lets say TileA tiles can have an ID of something like 5445 and TileB tiles can have an ID of something like 2210.