I've been smashing my head against this problem for a few days, and it's making me feel stupid, because I've been analyzing plugins from other people and I don't seem to be doing anything differently. When I try to alias and redefine the Game_Player initialize functions, it'll say "Maximum call stack exceeded," due to an infinite loop. So one of my friends suggested I just put those definitions all in brackets {} and declare the alias with let since they're one-time executions and won't refer to each other by the time the next alias is called. Then they'll fall out of scope. This works for getting rid of the errors, but I've haven't yet seen a single plugin where this was used for such a simple problem. I'm like in step one of one of the tutorials here. Why isn't this working?
Part of the issue is that I have two separate plugins I'm working on that both expand the Game_Player.prototype.initMembers function (just to add member variables to it!), but I've put two plugins in the same project that extend that exact function before, and they don't seem to cause infinite loops or tell me that there's a syntax error because the alias has already been declared. I'm trying to follow the example of this thread and this thread as well as just looking at random plugins by people who we all know know what they're doing, like Yanfly, but it is just glancing off my smooth brain. I don't get it. And why would you ever declare an alias globally as a const to begin with if everyone is using the same naming conventions for them?
These are the offending functions. I've tried every combination of let, var, const, or lack thereof. Please tell me what I'm doing wrong, or if I really do just have to put them in global brackets with a let declaration.
Part of the issue is that I have two separate plugins I'm working on that both expand the Game_Player.prototype.initMembers function (just to add member variables to it!), but I've put two plugins in the same project that extend that exact function before, and they don't seem to cause infinite loops or tell me that there's a syntax error because the alias has already been declared. I'm trying to follow the example of this thread and this thread as well as just looking at random plugins by people who we all know know what they're doing, like Yanfly, but it is just glancing off my smooth brain. I don't get it. And why would you ever declare an alias globally as a const to begin with if everyone is using the same naming conventions for them?
These are the offending functions. I've tried every combination of let, var, const, or lack thereof. Please tell me what I'm doing wrong, or if I really do just have to put them in global brackets with a let declaration.
Code:
var _Game_Player_initMembers = Game_Player.prototype.initMembers;
Game_Player.prototype.initMembers = function() {
_Game_Player_initMembers.call(this);
this._speedMulti = 1;
}
Code:
var _Game_Player_initMembers = Game_Player.prototype.initMembers;
Game_Player.prototype.initMembers = function() {
_Game_Player_initMembers.call(this);
this._active = true;
this._prevRoom = $gameMap._mapId;
}