[ACE] Scripting Error?

I'm unsure if this is in the right area of the forums (I'm rather new to all of this) but I'm a bit at a loss of what to do on how to fix a repeating error that is interrupting a section of a new project. (I honestly have no scripting experience whatsoever so I have no idea what's going on or why it's giving me an error).

I'm using Hime's "Event Follower" script to make my Player Character follow an NPC (it was the only script I could find for this, so if there are others that might instead negate the problem, if the problem is with Hime's script, halp?)

The error happens exactly and always after a second map change. There is one NPC but the Event ID for the NPC is different on each map (Map1 Event ID 004, works fine, script ends and Player transfers to Map2)

On Map2 something weird happens, it get's buggy I guess? The script doesn't start like it did on Map1. The NPC makes a loop when the Script is started, forcing the Player to loop with them, but then follows the route as normal. Event ends and Player is transfered to Map3. (Event ID is now 006)

I get a glimpse of Map3 where the script is supposed to happen again, forcing the Player to follow the NPC (now Event ID 011) to its conclusion, but as soon as Map3 loads the game crashes and gives me an error report.

Script 'Game_Character' line 180: NameError occurred.

 

undefined local variable or method 'event_006' for the #<Game_Player:0x800baec>

 

I've tested this several times, changed the event scripting several times, even added in new scripting between stopping the follow script and the map transition and I still get the same error. The only difference is the #<Game_Player:0x800baec> portion changes slightly. The last time this happened I recieved #<Game_Player:0x8033d78>

 

I've double checked all event scripts to be certain that nothing is out of place, and as far as I can tell nothing is out of place. So I have no idea why I'm getting this error or how to fix it. Any help?

 

(If this is in the wrong topic, please tell me where I'm supposed to post this thank you!)
Moving to RGSSx Script Support (where you post for help with existing scripts)


Please include links to scripts you're having troubles with when you need help with them. Don't assume we're familiar with them or have easy access to them.


As I don't have the script, I don't know what you're supposed to do to make the player follow and event. Do you have to put an event on each map telling the player who to follow? 'event_006' does not sound right at all, so I am guessing you've called the script with the wrong arguments on that map. Events are internally identified with numbers, not with names, so if the script is expecting a number and you are passing a name, that's what the problem is. Please show a screenshot of the event on that map that tells the player what event to follow.
The script is placed in the Move/Route option on the events page of the event itself. I select Player as the object to move and input "follow(event_ID)" in the case of the error the script is listed as "follow(011)" and in the previous maps "follow(006)" etc, etc. So no, it's not an issue with how I'm inputting the script. I can see that clearly.

There appears to be some other sort of issue. I'm not sure if it's specifically the Event Followers script or an issue with something else entirely. I've doubled checked and triple checked everything on the events in question and everything is written exactly as it was on previous maps. It seems to act a little wonky on Map2 and then crashes on Map3. It's calling to a script that is NOT the Event Follow script (it's calling the error back to a routing script listed in one of the games main scripts) and then citing the issue is with there being no "Event 006" which is why I'm confused.

Last time it crashed like this it WAS because I inputted the script incorrectly (despite the directions stating that you can input the script such a way anyway) and have since not seen an issue. This is the first issue I've seen on this since then.

As for the script in question, you can find it here on the forums: http://forums.rpgmakerweb.com/index.php?/topic/11046-event-followers/

What I'm trying to figure out is if there is a cross-issue between the Event Followers script and the main game scripts or if it's a different issue entirely. Hence why I provided the information I provided, including the error string that it gave me as it crashed.
did you do a stop_follow prior to leaving the previous map? Maybe that's all you need to do, just prior to the transfer, so that it doesn't start looking for an event_006 on the new map.


BTW - don't use leading zeros for your event ids. You can see in the example on the page you linked to, Event 11 is defined as (11), not (011). It may not be in this case, but some scripts do act up when you use leading zeros.
Does the error disappear if you remove the  follow(011)  command? (Or disable it by adding  #  at the beginning of the line)

I can't see how this command would cause this error right now.

If it doesn't, you could try this script for testing purposes. It won't fix the error, but might provide more detailed information about it:

Spoiler
class RPG::MoveRoute   attr_accessor 😮rigin_textendclass Game_Character   alias_method🙂update_routine_move_ILC_catchMoveError, :update_routine_move)  def update_routine_move    begin      update_routine_move_ILC_catchMoveError    rescue      message = "#{$!.message}\n\nOrigin Info:\n"\      "- Character:  #{char_identity_text}\n"\      "- Source:       #{@move_route ? @move_route.origin_text : "Unknown" }\n"\      "- Move Route Index:  #{@move_route_index}\n\n"\      "Command: #{@move_route && @move_route.list[@move_route_index].inspect}"      fail $!.class, message, $!.backtrace    end  end   def char_identity_text    return "Player"        if $game_player == self    return "Event #{@id}"  if $game_map.events[@id || 0] == self    return "Unknown (#{self})"  endendclass Game_Event   alias_method🙂setup_page_settings_ILC_moveRouteOrigin, :setup_page_settings)  def setup_page_settings    @page.move_route = @page.move_route.clone    pi = @event.pages.index(@page)    evt = "Map %d, Event %03d, Page %s" % [@map_id, id, pi ? pi + 1 : "???"]    @page.move_route.origin_text = "#{evt} (Custom Move Route)"    setup_page_settings_ILC_moveRouteOrigin  endendclass Game_Interpreter  alias_method🙂command_205_addMoveRouteOrigin, :command_205)  def command_205    @params = @params.clone    @params[1] = @params[1].clone    @params[1].origin_text = "#{event_identity_text} (Near Line #{@index + 1})"    command_205_addMoveRouteOrigin  end   def event_identity_text    $data_common_events.each_with_index do |ce, index|      next  unless ce and ce.list.equal?(@list)      return "Common Event %03d" % index    end    $game_map.instance_variable_get🙂@map).events.each do |id, event|      event.pages.each_with_index do |page, page_index|        next  unless page.list.equal?(@list)        return "Map #{@map_id}, Event %03d, Page %d" % [id, page_index + 1]      end    end    return "Unknown Event (Map: #{@map_id}, Event: #{@event_id})"  endend

A number with a leading zero is interpreted as an octal number, so  011  would equate to the decimal number  9  for example.
Okay so I went looking back, and I'm sorry for the long reply, but I think it's not actually with the script itself at all (possibly?). For some reason the map I'm transitioning to lists events 001 - 005 and then completely skips an even ID of 006 (as if it exists but I can't find it ANYWHERE on my map) and continues on with 007.

Is there any way, aside from COMPLETELY redoing the map itself, to fix this? Would there be any reason why it seems to think that there is an event that doesn't exist on the map? Could that be the reason why it's giving me this error and not involved with the follow script at all?

Also, Another Fen, where would I put that script? How would I use it? Thank you for your help it's been really helpful.
Just add the code as a new script between 'materials' and 'main'.

The script should extend the error message you are getting from your move route, so it probably would be helpful if you could post the error message that appears after you added the script. However, I'd recommend to remove it again once you don't need it anymore.

It's just quite uncommon to refer to an event as  event_XXX  within RGSS. It does not seem to be used by the script you posted either, so chances are it's another script call that causes the error.
When you add events to your map, it numbers them sequentially. So the first event you add will always be 1, the second always 2, etc. If you add 50 events and then you delete the 6th one you added, you'll have events numbered 1, 2, 3, 4, 5, and next it'll jump to 7. It numbers them as you add them. When you play the game, the event numbers/ids don't change.


If you create 50 events, then delete event 6, then you create another event, it will be called 6. It looks for gaps and fills them in before going higher. So you deleted at least event 6 from this map and haven't added any others since.


If you have an event there that the player SHOULD be following, just copy it and paste it to a new spot, then delete the original. The new one will get the first unused event id (6).

Original thread: https://forums.rpgmakerweb.com/threads/ace-scripting-error.38820/