[XP] Lagless Path Finder

Started by Blizzard, February 09, 2013, 09:22:06 am

Previous topic - Next topic

Seltzer Cole

December 08, 2013, 10:52:37 am #60 Last Edit: December 08, 2013, 10:53:52 am by Seltzer Cole
Quote from: Blizzard on December 05, 2013, 01:54:58 am
Can you make a demo?
Also, please check if the wait commands works when you don't use the path finder. Because the wait command is buggy in some RMXP editions.


I decided to keep messing around with it so you wouldn't have to waste your time lol.

My waits work perfectly in whatever edition I have. I kept messing around with when the game calls your lagless pathfinding script and stops it from running using $game_map.events[ID].clear_path_target. <--- after plugging that into the right spot and setting the range of it calling the script to 0 instead of 1, it works now.

Hopefully things will run smoothly now or I will have to upload a demo as you said.

I was wondering though, is this script messing around with the X and Y cords of my character and events that are calling it? I know it prolly is obviously, but is it changing there X and Y positions to things that are false? Such as if the main character has an X and Y of 12/24 is it changing his X and Y to something not true. Because I have variables using X and Y of the main character and events other than your pathfinder script...and that may be messing with my variables.
You know you play video games to much when you put sunglasses on and whisper "Plus 10 Appearance"

If at first you don't succeed, call it version 1.0

Blizzard

No, it doesn't change the X and Y coordinates. But it does add custom movement commands so technically the coordinates get altered afterward.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20

December 28, 2016, 11:28:30 pm #62 Last Edit: December 28, 2016, 11:31:14 pm by KK20
Quote from: hirasu on November 03, 2013, 12:04:32 am
If i enable 8-Dir he stuck on the wall and can find the path and without 8-dir works im alone with this bug? when no please fix it :(

lmao Blizz, you totally misinterpreted this guy's question xD

Zex mentioned this bug to me. If you enable DIRECTIONS_8_WAY and make an event path find from say 3,3 to 0,0, the event never actually makes it.
The problem was in set_found_path:

    # each move command code equals direction / 2
    path.reverse.each {|dir| route.list.unshift(RPG::MoveCommand.new(dir / 2))}

Now this works fine for 4 directions (2,4,6,8) because

      # During move command (from move down to jump)
      if command.code <= 14
        # Branch by command code
        case command.code
        when 1  # Move down
          move_down
        when 2  # Move left
          move_left
        when 3  # Move right
          move_right
        when 4  # Move up
          move_up

But when you add in the diagonal movement:

            when PathFinder::DIR_DOWN_LEFT, PathFinder::DIR_LEFT_DOWN
              result[i], result[i + 1] = 1, nil
            when PathFinder::DIR_DOWN_RIGHT, PathFinder::DIR_RIGHT_DOWN
              result[i], result[i + 1] = 3, nil
            when PathFinder::DIR_LEFT_UP, PathFinder::DIR_UP_LEFT
              result[i], result[i + 1] = 7, nil
            when PathFinder::DIR_RIGHT_UP, PathFinder::DIR_UP_RIGHT
              result[i], result[i + 1] = 9, nil
            end

Those values get divided by 2 as well! xD

EDIT: Realized I could have just replaced the diagonal values with 10,12,14,16 but oh well
I updated to v1.23. Feel free to replace the first post with this:

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Lagless Path Finder by Blizzard
# Version: 1.23
# Type: Pathfinding System
# Date: 9.2.2013
# Date v1.01: 11.4.2013
# Date v1.1: 29.7.2013
# Date v1.2: 7.10.2013
# Date v1.21: 8.10.2013
# Date v1.22: 11.11.2013
# Date v1.23: 28.12.2016 (fix by KK20)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# IMPORTANT NOTE:
#
#   This Path Finder is a derived version of Blizz-ABS's original Path Finder.
#   If you are using Blizz-ABS, please remove this script. Blizz-ABS has a
#   Path Finder already built-in.
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. May cause
#   incompatibility issues with exotic map systems.
#
#
# Features:
#
#   - calculates path from point A to point B on the map
#   - allows immediate calculation as well as path calculation requests that
#     are done over the course of a few frames in order to reduce lag
#   - supports dynamic calculation that is done every step to ensure the
#     character reaches its targets
#   - can assign other characters as targets so dynamic calculation with a
#     moving will cause the character to find the target regardless of his
#     changed position
#
# new in v1.01:
#   - fixed attempted optimizations to work properly
#
# new in v1.1:
#   - fixed a problem with how dyn_request is handled
#   - added PASSABLE parameter for all path finder functions to determine
#     how to behave when using the RANGE parameter
#
# new in v1.2:
#   - added waypoints
#   - Game_Character#has_path_target? now returns true as well when using
#     target coordinates instead of a target character
#
# new in v1.21:
#   - added option for loose movement when target cannot be reached
#   - added separate option for debug messages
#
# new in v1.22:
#   - fixed a problem with waypoints when using range
#
# new in v1.23:
#   - fixed a problem when DIRECTIONS_8_WAY is turned on
#
# Instructions:
#   
# - Explanation:
#   
#   This script will allow your characters to walk from point A to point B,
#   navigating by themselves, finding the shortest path and all that without
#   you having to manually specify their moving route. They can also navigate
#   through dynamically changing environments or track a dynamically moving
#   target.
#
# - Configuration:
#
#   MAX_NODES_PER_FRAME - maximum number of node calculation per frame when
#                         using path requests instead of immediate calculations
#   DIRECTIONS_8_WAY    - if set to true, it will smooth out corner movement
#                         and use a diagonal movement step wherever possible
#                         (this does NOT mean that the path finder will do
#                         8-directional path finding!)
#   LOOSE_MOVEMENT      - if set to true, it will cause characters to continue
#                         moving when the target cannot be reached for some
#                         reason, following its last movement path (works only
#                         with "dyn" variants)
#   DEBUG_MESSAGES      - if set to true, it will display messages when paths
#                         can't be found
#   
#
# - Script calls:
#
#   This path finder offers you several script calls in order to designate path
#   finding to characters on the map. Following script calls are at your
#   disposal:
#   
#     PathFinder.find(C_ID, TARGET[, RANGE[, PASSABLE]])
#     PathFinder.request(C_ID, TARGET[, RANGE[, PASSABLE]])
#     PathFinder.dyn_find(C_ID, TARGET[, RANGE[, PASSABLE]])
#     PathFinder.dyn_request(C_ID, TARGET[, RANGE[, PASSABLE]])
#
#   C_ID     - either an event ID, 0 for the player character or an actual
#              character (e.g. $game_map.events[ID])
#   TARGET   - an array with X,Y coordinates, an actual target character,
#              an array with arrays of X,Y waypoints or an array of actual
#              character waypoins
#   RANGE    - range within which the target should be located (greater than 0)
#   PASSABLE - when using a range, this is used to determine if the next tile
#              must be passable as well, false by default, used usually when
#              passability between 2 tiles isn't used
#   
#   This is how the 8 different script calls behave:
#   
#   - The "find" variants always calculate the path immediately.
#   - The "request" variants always request a path calculation to be done over
#     the course of several frames in order to avoid lag. Requesting paths for
#     multiple characters will cause the calculation to take longer as each
#     frame only a certain number of nodes is calculated (can be configured).
#     So if there are more characters requesting a path, naturally each one
#     will consume a part of the allowed node calculations every frame.
#   - The "dyn" variants (dynamic) will recalculate/request a calculation every
#     step in order to keep a path up to date with an ever-changing
#     environment. You won't need to use these calls if there are no moving
#     events on the map or if there are no environmental passability changes.
#   - When using a "dyn" variant, if actual coordinates (X, Y) are used, the
#     character will find its path to these fixed coordinates. If an actual
#     target character is being used, the path finder will track the character
#     instead of fixed coordinates. If the character changes its position, the
#     path calculation will attempt to find a path to the new position of the
#     target.
#   - Using "dyn_find" a lot, with many characters at the same time and/or for
#     long paths may cause performance issue and lag. Use it wisely.
#   - Using "dyn_request" is much more performance-friendly, but it will also
#     cause characters to "stop and think". This can also cause problems in a
#     constantly changing environment as the environment may change during the
#     few frames while the calculation is being done. Use it wisely.
#   - In order to queue multiple targets like waypoints, simply call any of the
#     functions as many times as you need.
#   
#   In order to cancel dynamic path calculation for a character, use following
#   script call:
#   
#     character.clear_path_target
#   
#   Example:
#     
#     $game_map.events[23].clear_path_target
#   
#   In order to check if a character has a dynamic path calculation for a
#   target, use following script call:
#   
#     character.has_path_target?
#   
#   Example:
#     
#     if $game_map.events[23].has_path_target?
#   
#
# Notes:
#
#   - This path finder is an implementation fo the A* Search Algorithm.
#   - The PathFinder module is being updated during the call of
#     $game_system.update. Keep this in mind if you are using specific exotic
#     scripts.
#   - When using the option LOOSE_MOVEMENT, keep in mind that it doesn't work
#     accurately with dyn_request, because request calculations aren't done
#     immediately like with dyn_find.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

module BlizzCFG
 
  MAX_NODES_PER_FRAME = 50
  DIRECTIONS_8_WAY = false
  LOOSE_MOVEMENT = false
  DEBUG_MESSAGES = false
 
end

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

$lagless_path_finder = 1.22

#==============================================================================
# module PathFinder
#==============================================================================

module Math
 
  def self.hypot_squared(x, y)
    return (x * x + y * y)
  end
 
end

#==============================================================================
# module PathFinder
#==============================================================================

module PathFinder
 
  PATH_DIRS = [[0, 1, 1], [-1, 0, 2], [1, 0, 3], [0, -1, 4]]
  DIR_DOWN_LEFT = [1, 2]
  DIR_LEFT_DOWN = [2, 1]
  DIR_DOWN_RIGHT = [1, 3]
  DIR_RIGHT_DOWN = [3, 1]
  DIR_LEFT_UP = [2, 4]
  DIR_UP_LEFT = [4, 2]
  DIR_RIGHT_UP = [3, 4]
  DIR_UP_RIGHT = [4, 3]
  DIR_OFFSETS = [[ 0, 0], [0, 1], [-1, 0], [1, 0], [0,-1],
                 [-1, 1], [1, 1], [-1,-1], [1,-1]]
 
  @requests = {}
 
  def self.clear
    @requests = {}
  end
 
  def self.find(char, target, range = 0, pass = false)
    char, target = self.check_args(char, target, range, pass, false, true)
    self._find(char, target, true)
    return true
  end
 
  def self.dyn_find(char, target, range = 0, pass = false)
    char, target = self.check_args(char, target, range, pass, true, true)
    self._find(char, target, true)
    return true
  end
 
  def self.request(char, target, range = 0, pass = false)
    char, target = self.check_args(char, target, range, pass, false, false)
    self._request(char, target, true)
    return true
  end
 
  def self.dyn_request(char, target, range = 0, pass = false)
    char, target = self.check_args(char, target, range, pass, true, false)
    self._request(char, target, true)
    return true
  end
 
  def self.check_args(char, target, range, pass, dynamic, immediate)
    range = 0 if range == nil || range < 0
    if char.is_a?(Numeric)
      char = (char > 0 ? $game_map.events[char] : $game_player)
    end
    target = PathTarget.new(target, range, pass, dynamic, immediate)
    if $DEBUG && BlizzCFG::DEBUG_MESSAGES && char == nil
      p "Warning! Character to move does not exist!"
    end
    return [char, target]
  end
 
  def self._find(char, target, new = false)
    if @requests[char] == nil && (!char.has_path_target? || !new)
      @requests[char] = PathRequest.new(char.x, char.y, target)
      result = nil
      result = self.calc_node(char) while result == nil
      if $DEBUG && BlizzCFG::DEBUG_MESSAGES && result.size == 0
        p "Warning! Path Finder could not find path for character at (#{target.x},#{target.y})!"
      end
      if !BlizzCFG::LOOSE_MOVEMENT && target.dynamic
        char.set_found_step(result)
      else
        char.set_found_path(result)
      end
    end
    char.add_path_target(target) if new
  end
 
  def self._request(char, target, new = false)
    if @requests[char] == nil
      @requests[char] = PathRequest.new(char.x, char.y, target)
    end
    char.add_path_target(target) if new
  end
 
  def self.update
    @requests = {} if @requests == nil
    characters = @requests.keys
    count = BlizzCFG::MAX_NODES_PER_FRAME
    while characters.size > 0 && count > 0
      char = characters.shift
      dynamic = @requests[char].target.dynamic
      result = self.calc_node(char)
      if result != nil
        if !BlizzCFG::LOOSE_MOVEMENT && dynamic
          char.set_found_step(result)
        else
          char.set_found_path(result)
        end
      else
        characters.push(char)
      end
      count -= 1
    end
  end

  def self.calc_node(char)
    request = @requests[char]
    if request.open.size == 0
      @requests.delete(char)
      return []
    end
    found = false
    key = request.open.keys.min {|a, b|
        a[2] > b[2] ? 1 : (a[2] < b[2] ? -1 :
        (Math.hypot_squared(a[0] - request.target.x, a[1] - request.target.y) <=>
        Math.hypot_squared(b[0] - request.target.x, b[1] - request.target.y)))}
    request.closed[key[0], key[1]] = request.open[key]
    request.open.delete(key)
    kx, ky = 0, 0
    passable = false
    passable_checked = false
    PATH_DIRS.each {|dir|
        kx, ky = key[0] + dir[0], key[1] + dir[1]
        passable = false
        passable_checked = false
        if (kx - request.target.x).abs + (ky - request.target.y).abs <= request.target.range
          if request.target.pass
            passable = char.passable?(key[0], key[1], dir[2]*2)
            passable_checked = true
          else
            passable = true
          end
          if passable
            request.closed[kx, ky] = dir[2]
            found = true
            break
          end
        end
        if request.closed[kx, ky] == 0
          passable = char.passable?(key[0], key[1], dir[2]*2) if !passable_checked
          if passable
            request.open[[kx, ky, key[2] + 1]] = dir[2]
          end
        end}
    return nil if !found
    result = request.backtrack(kx, ky)
    @requests.delete(char)
    return result
  end
 
end

#==============================================================================
# PathTarget
#==============================================================================

class PathTarget
 
  attr_reader :range
  attr_reader :pass
  attr_reader :dynamic
  attr_reader :immediate
 
  def initialize(target, range, pass, dynamic, immediate)
    if target.is_a?(Game_Character)
      @char = target
    else
      @x, @y = target
    end
    @range = range
    @pass = pass
    @dynamic = dynamic
    @immediate = immediate
  end
 
  def x
    return (@char != nil ? @char.x : @x)
  end
 
  def y
    return (@char != nil ? @char.y : @y)
  end
 
end

#==============================================================================
# PathRequest
#==============================================================================

class PathRequest
 
  attr_reader :open
  attr_reader :closed
  attr_reader :sx
  attr_reader :sy
  attr_reader :target
 
  def initialize(sx, sy, target)
    @sx, @sy, @target = sx, sy, target
    @open = {[@sx, @sy, 0] => -1}
    @closed = Table.new($game_map.width, $game_map.height)
  end
 
  def backtrack(tx, ty)
    cx, cy, x, y, result = tx, ty, 0, 0, []
    loop do
      cx, cy = cx - x, cy - y
      break if cx == @sx && cy == @sy
      result.unshift(@closed[cx, cy])
      x, y = PathFinder::DIR_OFFSETS[@closed[cx, cy]]
    end
    return self.modify_8_way(result)
  end
 
  def modify_8_way(result)
    if BlizzCFG::DIRECTIONS_8_WAY
      result.each_index {|i|
          if result[i] != nil && result[i + 1] != nil
            case [result[i], result[i + 1]]
            when PathFinder::DIR_DOWN_LEFT, PathFinder::DIR_LEFT_DOWN
              result[i], result[i + 1] = 5, nil
            when PathFinder::DIR_DOWN_RIGHT, PathFinder::DIR_RIGHT_DOWN
              result[i], result[i + 1] = 6, nil
            when PathFinder::DIR_LEFT_UP, PathFinder::DIR_UP_LEFT
              result[i], result[i + 1] = 7, nil
            when PathFinder::DIR_RIGHT_UP, PathFinder::DIR_UP_RIGHT
              result[i], result[i + 1] = 8, nil
            end
          end}
      result.compact!
    end
    return result
  end
 
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  alias update_lagless_path_finder_later update
  def update
    PathFinder.update
    update_lagless_path_finder_later
  end
 
end

#==============================================================================
# Game_Map
#==============================================================================

class Game_Map
 
  alias setup_lagless_path_finder_later setup
  def setup(map_id)
    PathFinder.clear
    setup_lagless_path_finder_later(map_id)
  end
 
end

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
 
  def add_path_target(target)
    @path_targets = [] if @path_targets == nil
    @path_targets.push(target)
  end
 
  def clear_path_target
    @path_targets = nil
  end
 
  def next_path_target
    if @path_targets.size <= 1
      self.clear_path_target
    else
      @path_targets.shift
    end
  end
 
  def has_path_target?
    return (@path_targets != nil && @path_targets.size > 0)
  end
 
  def set_found_path(path)
    return if path.size == 0
    route = RPG::MoveRoute.new
    route.repeat = false
    path.reverse.each {|dir| route.list.unshift(RPG::MoveCommand.new(dir))}
    self.force_move_route(route)
  end
 
  def set_found_step(path)
    return if path.size == 0
    route = RPG::MoveRoute.new
    route.repeat = false
    route.list.unshift(RPG::MoveCommand.new(path[0]))
    self.force_move_route(route)
  end
 
  alias update_lagless_path_finder_later update
  def update
    update_lagless_path_finder_later
    return if self.moving? || !self.has_path_target? || self.jumping?
    if (@x - @path_targets[0].x).abs + (@y - @path_targets[0].y).abs <=
        @path_targets[0].range
      self.next_path_target
      check = true
    else
      check = @path_targets[0].dynamic
    end
    if check && self.has_path_target?
      if @path_targets[0].immediate
        PathFinder._find(self, @path_targets[0])
      else
        PathFinder._request(self, @path_targets[0])
      end
    end
  end
 
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

Oh lol! xD I'll upload the fix today when I get home.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Josey

Hi! :D

I use the google-translator, sorry for my bad english :<


Can "if $game_map.events[23].has_path_target?" used in a conditional branch?
So it is important to me that the event can run several waypoints and a variable is changed at each point as soon as it is reached. :<

Then I have the following problem:
Where and how would I have to install, that also a terrain tag should be considered (so an event can only move on a certain TT)? Please do not always, but only at certain events. So best in the pathfind call, where coordinates X and Y is determined. So if no TT is determined, the event can move freely, if a TT is determined in the pathfind-call (in brackets), the event can only move on a specific TT.
Is that somehow and if so how? :D

Thanks in advance! :D
Josey~

(This english is so cruel XD
I hope you understand me... _._)

KK20

Remove the "if" in your statement and it can be used in a Conditional Branch.

The Terrain Tag feature is not built into the script. It would need to be manually added by a scripter.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Josey

Thank you for your answear! : D

Should I create a new topic for the Terrain Tag Feature?

KK20

You could, but no one is going to fulfill that request.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Scriptguy32

July 04, 2021, 07:20:49 pm #68 Last Edit: July 04, 2021, 07:22:15 pm by Scriptguy32
I've found a problem with this script. It works amazingly in most cases, however if you have a tile that is passable in at least one direction, but not all four, sometimes when pathfinding it's possible for events to get stuck trying to move into a tile that is not passable in a certain direction.

I've got a lot of these types of tiles, mainly for decoration (bar stools you can move behind but but not through them, for example) and a lot of my NPCs get stuck.

There even seems to be a check in place for this, as the script DOES account for direction. (See lines 395 and 407.)

passable = char.passable?(key[0], key[1], dir[0]*2)

I don't really understand how this script works, so I have no idea how to fix this...
Hiya! I'm a scripter who's been scripting for a year now and wants to share his scripts. I've been using RMXP for about two years now but only got into scripting recently.
I use mkxp a lot for its speed and customizability.
Some of my scripts may rely on custom mkxp modules or functions!

KK20

If you could provide a visible example, I'd take a look at it.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Scriptguy32

July 05, 2021, 08:36:06 pm #70 Last Edit: July 05, 2021, 08:39:05 pm by Scriptguy32
Thanks!
Here's just a quick thing I whipped up in a default project to demonstrate.
In this setup the player will get stuck trying to navigate through the plant.
(Edit: No idea why the images won't display properly. Here they are anyway.)
https://imgur.com/a/leRSyFe
https://imgur.com/a/Gw4GljV

Hiya! I'm a scripter who's been scripting for a year now and wants to share his scripts. I've been using RMXP for about two years now but only got into scripting recently.
I use mkxp a lot for its speed and customizability.
Some of my scripts may rely on custom mkxp modules or functions!

KK20

July 05, 2021, 10:56:27 pm #71 Last Edit: July 05, 2021, 10:58:17 pm by KK20
Yeah, it has to do with the PASSABLE parameter in the script call. You should be setting that to true in these cases.
PathFinder.find(0, [19, 13], 0, true)
I feel like true should have been the default, or at the very least be the default if the range is 0.
  def self.check_args(char, target, range, pass, dynamic, immediate)
    range = 0 if range == nil || range < 0
    pass = true if range == 0

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Scriptguy32

Tysm!  I didn't realize that passable did that. :^_^':
Hiya! I'm a scripter who's been scripting for a year now and wants to share his scripts. I've been using RMXP for about two years now but only got into scripting recently.
I use mkxp a lot for its speed and customizability.
Some of my scripts may rely on custom mkxp modules or functions!

Blizzard

I think I did this because of performance reasons. But it's been a such long time ago, I really don't remember.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.