Original Source
- Original title: Bug Restore move route - index skip
- Original author: caethyril
- Original date: March 2, 2021
- Source thread: https://forums.rpgmakerweb.com/threads/restore-move-route-index-skip.134007/
- Source forum path: Game Development Engines > RPG Maker MZ Support > RPG Maker MZ Feedback
Summary
Edit: this bug is fixed in v1.2.1 of the core scripts.Seen in RMMZ core scripts up to the current version (v1.2.0). DescriptionEvents can have an auto move route assigned. If given an "active" route, e.g. via the Set Movement Route command, the auto route will be restored when the active one completes. On restore, the auto route's index skips one command. This can cause unintentional offsets in event movements. Steps to reproduce Create an event with an auto move route that makes it walk in a loop.
Archived First Post
Edit: this bug is fixed in v1.2.1 of the core scripts.
Seen in RMMZ core scripts up to the current version (
v1.2.0).Description
Steps to reproduce
- Create an event with an auto move route that makes it walk in a loop.
- Give the event any active route (e.g. wait 60 frames) using the Set Movement Route event command.
- When the active route ends, the event's auto route will resume 1 command after where it was interrupted.
- Interact with the NPC to give her an empty active route: she will skip one step in her auto walk loop.
Technical explanation
Game_Character.prototype.updateRoutineMove = function() {
if (this._waitCount > 0) {
this._waitCount--;
} else {
this.setMovementSuccess(true);
const command = this._moveRoute.list[this._moveRouteIndex];
if (command) {
this.processMoveCommand(command);
this.advanceMoveRouteIndex();
}
}
};
Game_Character.prototype.processMoveCommand = function(command) {
const gc = Game_Character;
const params = command.parameters;
switch (command.code) {
case gc.ROUTE_END:
this.processRouteEnd();
break;
// ... //
}};
Game_Character.prototype.processRouteEnd = function() {
if (this._moveRoute.repeat) {
this._moveRouteIndex = -1;
} else if (this._moveRouteForcing) {
this._moveRouteForcing = false;
this.restoreMoveRoute();
}
};
Game_Character.prototype.restoreMoveRoute = function() {
this._moveRoute = this._originalMoveRoute;
this._moveRouteIndex = this._originalMoveRouteIndex;
this._originalMoveRoute = null;
};
Suggested fix!
this._moveRouteIndex = this._originalMoveRouteIndex - 1;
advanceMoveRouteIndex call immediately afterwards.Temporary fix
restoreMoveRoute method and adjust the index that way:(alias => {
Game_Character.prototype.restoreMoveRoute = function() {
alias.apply(this, arguments);
this._moveRouteIndex--; // not so fast!
};
})(Game_Character.prototype.restoreMoveRoute);
- view/download CaeF_RestoreRouteFix.js (Google Drive)
[Edit: updated to clarify that the bug still exists in v1.2.0.]
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...