Jump to content

Recommended Posts

OK so I am still unable to fix a glitch I keep getting. Instead of screenshots I'll just link you a zip that has the map and glitch in question. As I was taking screenshots it hit me that the events are to long, and to really get the problem you had to see it as well as the full events. However as I don't want a random viewer to steal my game I just took the single map, scripts, and basically copied them into a new project file. A lot safer and it makes it easier for you guys to test it out.

 

So the glitch---if you pick up a item the killer NPC will either A, automatically see you even if he's 2 walls away from you. Or B and more commonly, he walks downward into the wall and completely stops moving. I CAN NOT FIX THIS NO MATTER WHAT I DO! If you just follow behind him it works just find, but there's enough room to go around him and catch him off guard.

 

So can someone download the game and tell me what's the deal with this? You can see the script I'm using for pathfinding in the file, but here it is anyways (it's not the problem tho as this glitch was present way before I found the script). I don't want a new pathfinding script as it'll just result in the same exact glitch I'm betting, plus this was the only script I could ever get to work. I know it's not the problem, but just because "somebody" will ask for it rather than look in the zip...yeah this glitch has me very annoyed. XD

 

I know it's not the script because before it I used events only for the pathfinding and the problem was exactly the same.

 

http://www.mediafire.com/file/xu4z61v6u748kvt/Glitch_Testing.zip

 

 

#===============================================================================
# Pathfinding
# By Jet10985(Jet)
# Minor modifications by Venima
#===============================================================================
# This script will allow you to use a pathfinder to move players or events.
# This script has: 0 customization options.
#
# Modifications:
# Goal location may now be inpassable, pathfinder will still reach it.
# Pathfinder still works "as intended" when the move route is set to repeat.
# Added parameter: distance (explained below).
# Note: Pathfinder is a bit more processor heavy when used with a repeating
# move route (it was useless before, so this is only a benefit)
#===============================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# None
#===============================================================================
=begin
To move a player or event, use this in an event "Script..." command:

find_path(x, y, ev = 0, wait = false, distance = 0)

x is the target x
y is the targey y

ev is set to 0 by default and can be omitted like so: find_path(9, 0)
ev represents what character is to be moved. -1 is the player, 0 is the
calling event, and anything above is an event on the map whose ID is the ev.

wait if set to false and can be ommitted like so:
find_path(9, 0) or find_path(9, 0, -1)
wait specifies if the player will have to wait for the move route to finish
to start moving again.

distance is set to 0 by default and can be omitted in the same way as above.
while x and y represent the target location, the event will only be moved
up to the specified distance from the target. This makes it easier to have
an event follow the player, without getting in the player's way. This could
be used as an alternative to following, except it works on any events,
not just party members. If you do specify distance, you must also specify
all optional parameters.

Example of following the player at a distance, either using:

Event's custom move route (on repeat):
  find_path($game_player.x, $game_player.y, 3)
Or set move route command in a loop:
  find_path($game_player.x, $game_player.y, 0, true, 3)



You may also use find_path(x, y) (no ev or wait) inside of an event's
"Set Move Route..." command, using the "Script..." tab. This does the same
as above, but takes on the properties of the move route you are making,
including the affected character.
=end

module Jet
  module Pathfinder
    
    # While mainly for coders, you may change this value to allow the
    # pathfinder more time to find a path. 1000 is default, as it is enough for
    # a 100x100 MAZE so, yeah.
    MAXIMUM_ITERATIONS = 1000
    
  end
end

class Node
 
  include Comparable

  attr_accessor :point, :parent, :cost, :cost_estimated

  def initialize(point)
    @point = point
    @cost = 0
    @cost_estimated = 0
    @on_path = false
    @parent = nil
  end

  def mark_path
    @on_path = true
    @parent.mark_path if @parent
  end
   
  def total_cost
    cost + cost_estimated
  end

  def <=>(other)
    total_cost <=> other.total_cost
  end
   
  def ==(other)
    point == other.point
  end
end

class Point
 
  attr_accessor :x, :y
 
  def initialize(x, y)
    @x, @y = x, y
  end

  def ==(other)
    return false unless Point === other
    @x == other.x && @y == other.y
  end

  def distance(other)
    (@x - other.x).abs + (@y - other.y).abs
  end

  def relative(xr, yr)
    Point.new(x + xr, y + yr)
  end
end

class Game_Map
 
  def each_neighbor(node, char = $game_player)
    x = node.point.x
    y = node.point.y
    nodes = []
    4.times {|i|
      i += 1
      new_x = round_x_with_direction(x, i * 2)
      new_y = round_y_with_direction(y, i * 2)
      next unless char.passable?(x, y, i * 2)
      #removed line below (technically, if your goal is an inpassable block,
      # e.g. an event, you can still reach it)
      #next unless char.passable?(new_x, new_y, 10 - i * 2)
      nodes.push(Node.new(Point.new(new_x, new_y)))
    }
    nodes
  end
 
  #modified line below (added distance parameter)
  def find_path(tx, ty, sx, sy, dist, char = $game_player)
    start = Node.new(Point.new(sx, sy))
    goal = Node.new(Point.new(tx, ty))
    #modified line below (added distance handling)
    return [] if start == goal or (dist > 0 and start.point.distance(goal.point) <= dist)
    return [] if ![2, 4, 6, 8].any? {|i| char.passable?(tx, ty, i) }
    open_set = [start]
    closed_set = []
    path = []
    iterations = 0
    loop do
      return [] if iterations == Jet::Pathfinder::MAXIMUM_ITERATIONS
      iterations += 1
      current = open_set.min
      return [] unless current
      each_neighbor(current, char).each {|node|
        #modified line below (added distance handling)
        if node == goal or (dist > 0 and node.point.distance(goal.point) <= dist)
          node.parent = current
          node.mark_path
          return recreate_path(node)
        end
        next if closed_set.include?(node)
        cost = current.cost + 1
        if open_set.include?(node)
          if cost < node.cost
            node.parent = current
            node.cost = cost
          end
        else
          open_set << node
          node.parent = current
          node.cost = cost
          node.cost_estimated = node.point.distance(goal.point)
        end
      }
      closed_set << open_set.delete(current)
    end
  end
 
  def recreate_path(node)
    path = []
    hash = {[1, 0] => 6, [-1, 0] => 4, [0, 1] => 2, [0, -1] => 8}
    until node.nil?
      pos = node.point
      node = node.parent
      next if node.nil?
      ar = [pos.x <=> node.point.x, pos.y <=> node.point.y]
      path.push(RPG::MoveCommand.new(hash[ar] / 2))
    end
    return path
  end
end

class Game_Character
 
  #modified function (added handling for repeated move route (recalculates path
  # each step so it doesn't just loop it's old path route and will revalidate  
  # if x or y changes, will follow variable value if x and y are set to it)
  def find_path(x, y, dist = 0)
    path = $game_map.find_path(x, y, self.x, self.y, dist).reverse
    if !@move_route.repeat
      @move_route.list.delete_at(@move_route_index)
      @move_route.list.insert(@move_route_index, *path)
      @move_route_index -= 1
    elsif path.length > 0
      process_move_command(path[0])
      @move_route_index -= 1
    end
    
  end
end

class Game_Interpreter
 
  #modified line below (added distance parameter)
  def find_path(x, y, ev = 0, wait = false, dist = 0)
    char = get_character(ev)
    #modified line below (added distance parameter)
    path = $game_map.find_path(x, y, char.x, char.y, dist)
    path.reverse!
    path.push(RPG::MoveCommand.new(0))
    route = RPG::MoveRoute.new
    route.list = path
    route.wait = wait
    route.skippable = true
    route.repeat = false
    char.force_move_route(route)
  end
 
end

 

Share this post


Link to post
Share on other sites

Screens of the event are really the most helpful thing. Are you using a script fr the NPC's sight, too? Right now it sounds like a switch or variable in the item event is triggering the NPC or an event controlling him. If you're using a script call in a Move Route something may be wrong there, but it's impossible to tell just by seeing the glitch in game.

Share this post


Link to post
Share on other sites

Screens of the event are really the most helpful thing. Are you using a script fr the NPC's sight, too? Right now it sounds like a switch or variable in the item event is triggering the NPC or an event controlling him. If you're using a script call in a Move Route something may be wrong there, but it's impossible to tell just by seeing the glitch in game.

 

You do know I said I copied everything into that zip, so you don't need to ask me what I'm using as by just opening the zip you can 100% see everything in that single map, everything.

 

Sorry but it just sounds like you didn't even look at the zip. XD But because you're asking me I'll just tell you. No, the script is used in a para-event and the event for his line of sight is also a para event.

 

Now let me ask w-h-y didn't you just look in the bloody dang zip? XD Do you use something other than VX Ace? If not than that sounds just lazy, I made that zip for the exact reason for you guys to open and even play the map and see everything that's there, to AVOID being asked what's what and where's where like you just did. XD If you use VX Ace then just open the zip inside RPG Maker and look inside the events instead of just rendering the zip 100% wasted time of my life.

Edited by Darkness Void

Share this post


Link to post
Share on other sites

I didn't look because I'm not somewhere I can open up Ace and look at it. Also, when you're asking for help, it's a good idea not be a prick or people won't want to help you.

  • Like 2

Share this post


Link to post
Share on other sites

I didn't look because I'm not somewhere I can open up Ace and look at it. Also, when you're asking for help, it's a good idea not be a prick or people won't want to help you.

 

Well you could've said that before, I didn't mean to sound like a prick so I apologize for that.

Share this post


Link to post
Share on other sites

Please be accommodating to people that you ask for help from :) For example I have trouble with mediafire links and won't be able to dl your file, unfortunately. I understand that you don't want people stealing your hard work but I must agree screenshots are the easiest way to go about this.

Share this post


Link to post
Share on other sites

Please be accommodating to people that you ask for help from :) For example I have trouble with mediafire links and won't be able to dl your file, unfortunately. I understand that you don't want people stealing your hard work but I must agree screenshots are the easiest way to go about this.

 

Well the events for sight and pathfinding are long so screening them would be a pain, sorry for late reply I got sick a few days ago...anyways I could upload the zip to Dropbox if you can use that? If not, and I'm warning ya right now, the screenshots will be in like the 15s. I have OCD, have to be sure to share as much as I can if the zip isn't a option.

Share this post


Link to post
Share on other sites

Surprised nobody still hadn't looked at the zip, was hoping to avoid doing this as it'll take up space in my Tinypic but I'll go ahead and post some screenshots. Not of all of the events, mind you, you should download the zip to fully see everything.

 

Some of the events, mostly the finding paths ones and the sight path, are pretty long so they would need at least 4-5 screenshots by themselves. Idk what else to say so here are the 11 screenshots I took, I still suggest to download the zip to fully experience this glitch and finding a solution,  but if you can do that by just looking at these requested screenshots (how is that the best way to do this may I ask?) by all means do so.

 

 

 

5v2jqu.jpg

 

 

 

 

wwn50l.jpg

 

 

34eopef.jpg

 

 

9gvimc.jpg

 

 

2ujmvbn.jpg

 

 

t53nls.jpg

 

 

6pqcxs.jpg

 

 

rvkitf.jpg

 

 

29b22ra.jpg

 

 

29lzdps.jpg

 

 

2csgx87.jpg


 

P.S my family will be away over the weekend so it'll be late Sunday at best before I can work on the game again.

Share this post


Link to post
Share on other sites

Well I tried the glitch demo. From what I can see the problem is with event 5. Page 1 and 2. Page 2 is set to move towards player in a parallel event.

If changing the switch that activates this page, you force the event to stay on page one, when you pick up the scroll or knife this event (5) goes into a loop.

Removing the move towards player seems to be fine, but then I figured that you could attack the killer as that seemed to be an option in the event, but you die every time.

You have a lot of stuff going on. I don't fully understand what you're trying to do with all the conditional branches checking for x and y variables for the killer and player. But,

If I understand in any way, what you need is a detection script. It might make what you're doing easier.

Share this post


Link to post
Share on other sites

@roninator2

 

I did try a detection script, but hit a brick wall that you can check in those topics.

 

http://www.rpgmakercentral.com/topic/40485-need-help-with-detection-script/

 

http://www.rpgmakercentral.com/topic/40501-need-a-scripters-help/

 

As for attacking the killer, you need to get the knife and get him from behind. The X/Y events are simple to explain---they keep track of where the player and killer are. If you look in the Killer's Sight event you'll see, that depending on where the player is, can see the player and goes after them.

 

The reason it and Killer's Path are so long is due to the map size. I wanted the killer to be able to roam, not just stand still and offer no challenge at all. So one event tells the killer to walk to a spot depending on his current X/Y, while another keeps checking the player's X/Y. It was a pain to test this because with every new edit the killer's events kept respawning at the start. I know it isn't perfect, and likely will scrap the Sight event when I can get the detection script to working---if you look at the links above you'll see the current issue is getting the killer to move at the player or to just move at all.

Share this post


Link to post
Share on other sites

I played around with it a bit more. I got it partially working. The part that is not good is the move route for the killer. When picking up the knife he stops moving. But it is also flaky, because I put in the tracer script and sometimes it will work others it doesn't activate for a second or two. I'll package the demo back up and send you a pm.

Share this post


Link to post
Share on other sites

@roninator2

 

Yeah I had him walking into walls when picking up stuff, I'll look at your zip shortly and edit this afterwards. ^^

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted