Some of my players seem to be getting this error when entering certain maps with specific party members.
Apparently it is reproducable with the same party members once they go over a certain level.
"TypeError" "maybeTarget._character.eventId is not a function
What on earth could be causing this?
The maps it is happening on have no events, only an npc with a store.
It has to be something from a plugin you've installed or code you've added via script commands.
There is no code in the default MZ engine that uses a variable "maybeTarget".
To get any kind of real help, you need to reproduce the crash in a playtest, then press F8, go to the Console tab, and provide a screenshot of the error trace.
have they only gotten one version of the game, or did you give them updates?
As said above there are many ways how a typeerror could have happened, but one of the more common causes is if you make a savefile under a game version and then switch to a different version that has a plugin added with such a command - only that the savefile cannot handle that because it is not compatible to the new game version.
Many plugins store their data into the savefile. That is the reason why adding a plugin can make an older savefile (that is missing that data) incompatible.
and if your players loaded an older savefile with such a case, it usually results in a type error when the added plugin needs its data.
I just found a solution, in the case someone need it.
In the plugin, I replaced:
if (maybeTarget && maybeTarget._character &&
maybeTarget._character.eventId() === id) {
return maybeTarget;
}
with the following:
if (maybeTarget && maybeTarget._character &&
typeof maybeTarget._character.eventId === "function" &&
maybeTarget._character.eventId() === id) {
return maybeTarget;
}
As this thread appears to be previously solved, it is now closed.