2. You missinterpreted my post to be this: $gameActors.actor(n).shouldDisplayLevel() = false
The bold part will throw the type error, because while it's a method of Game_Actor, it's not to be called as a function in this context.
You can't just decide something isn't a function. What you typed could be used to store a reference to the shouldDisplayLevel function in a variable and call it later, but it can't change what that function returns.
Shouldn't it be $gameActors.actor(n).shouldDisplayLevel = () => false; instead?
That is more like it, if you included that as a plugin - however, my understanding of the original question is that the OP
only wanted to not display level ups under specific circumstances.
So,
@imaginaryrose - what do you want to do in your game? If you are always giving exp via script call and never want to display level up information, put Nolonar's line into a plugin.
But if you also have regular combat, and you want level up info there but not when you're awarding exp outside of combat, you'll need a way to control it. So, again in a plugin,
Code:Game_Actor.prototype.shouldDisplayLevelUp = function() {
return $gameSwitches.value(X);
};
where X is an ID of an unused switch in your game. Then you can use event/script commands to turn that switch on or off and display the level up info accordingly.