RPGツクールMV

RPGツクールMV

How to fix "ReferenceError player is not defined" error?
How to fix "ReferenceError player is not defined" error?

Here is the link for the error screenshot: https://drive.google.com/file/d/1dDQMnYqbPBOsTuqVPeDvy6nVPmxNX7O0/view?usp=sharing
< >
1-3 / 3 のコメントを表示
I can't seem to find any such reference in the base code, so I imagine it's a script call or plugin.

It is helpful if you can say when the error occurs, e.g. before the title screen, when you try to save, etc? In this case (from your screenshot) it seems the error happens on the map, possibly mid-event? My guess would be a script call error: double-check any Script commands in your project. =)

Otherwise it's probably a plugin issue. Try this:
  1. Go to Tools > Plugin Manager
  2. Shift-click (or Ctrl+A) to select all plugins in the list, then right-click > Turn OFF
  3. Save your project
  4. Test!
If the error does not appear after following these steps, it is a plugin issue. The problem may be:
  • Version mismatch: the plugin is written for a newer or older version of the base code than that of your project.
  • Bad configuration: e.g. a typo in some code you have entered into a plugin parameter, notetag, damage formula, etc.
    • To solve, check all places where you might have made a typo or scripting error.
  • Plugin conflict: multiple plugins that make changes to similar parts of the game code, in a way that causes an error when they are active at the same time.
    • One possibility is that your plugins are simply in the wrong order, e.g. Yanfly's plugins should be loaded in the order listed here: http://www.yanfly.moe/wiki/Category:Yanfly_Engine_Plugins
    • Otherwise, try to turn on your plugins again, one-by-one or in small batches (saving your project each time before testing), to see when the error reappears. This may help to isolate the culprit(s), though it can take a lot of testing to correctly identify which plugins may be conflicting.
  • Plugin error: there might be an error in the code of one or more plugins you're using. Much less likely unless you're the only one using those plugins.
    • Solution: rewrite the plugin to remove the error.
  • Malformed base code: very unlikely unless you've edited your project's base code files.
    • Solution: follow the instructions in the announcement above to "refresh" your project's base code.
Otherwise my only suggestion is to start a new project. .-.
Hi Caethyril,

Great day! Thank you for the prompt reply. The eror came when I called a script like this:

$gamePlayer.locate(player.walkstart.x,player.walkstart.y);

in a Set Movement Route on my Player. Is my script correct? My goal is for my Player to move to a specific X and Y coordinates of the map or an event. Kindly help me on this one please.
gen110888 の投稿を引用:
The eror came when I called a script like this:

$gamePlayer.locate(player.walkstart.x,player.walkstart.y);
Well, like the error says, there's no variable called player defined there. If you want to assign a persistent value you need to give it to an object that exists outside the script's scope. With no further details, I'll assume you just made a wild (and incorrect) guess. =P

Locate will instantly transport a character to a specific point, e.g.
$gamePlayer.locate(2, 10);
To path to a specific point, you could set up a repeating move route with a single script entry, e.g.
var x = 2, y = 10, d = this.findDirectionTo(x, y); if (d) { this.moveStraight(d); } else { this._moveRoute.repeat = false; };
...or use a plugin like Yanfly's Move Route Core that offers "path to" type move commands. =)
< >
1-3 / 3 のコメントを表示
ページ毎: 1530 50

投稿日: 2019年11月21日 0時30分
投稿数: 3