Wanting to make it look like characters walking up the stairs were actually making an effort, instead of just dashing through the stairs like it was flat terrain, I thought of tweaking the "stepping speed" and the "move speed" to respectively speed up and slow down when on a specific region.
This seems to work, but as soon as the leader has finished climbing the stairs and resumes its normal walking speed, the followers also pick up pace. The animationWait (i.e. the "stepping speed") is correctly dependent on whether the follower happens to be on the set of stairs or not.
I saw in rmmz_objects.js that
This seems to work, but as soon as the leader has finished climbing the stairs and resumes its normal walking speed, the followers also pick up pace. The animationWait (i.e. the "stepping speed") is correctly dependent on whether the follower happens to be on the set of stairs or not.
JavaScript:
// ================================================== //
// RunUpTheStairs.js
// ================================================== //
/*:
* @target MZ
* @plugindesc Causes slower walkspeed while maintaining or increasing animation wait while on stairs
* @author Werzaque
* @url https://
* @help Free to use and/or modify for any project, no credit required.
*
* @param RunUpRegion
* @desc A region id that causes increase in stepping speed
* @default 0
* @type number
*
* @param RunUpStepping
* @desc The increase in stepping speed. 1 is no change, 2 is double speed.
* @min 0.1
* @default 1.5
* @type decimal
*
* @param RunUpSlowDown
* @desc The decrease in move speed. 1 is no change, 2 is half speed.
* @min 1
* @default 1.5
* @type decimal
*/
void (() => {
'use strict';
function toNumber(str, def) {
return isNaN(str) ? def : +(str || def);
}
const PLUGIN_NAME = "RunUpTheStairs";
const parameters = PluginManager.parameters(PLUGIN_NAME);
const pRunUpRegion = toNumber(parameters["RunUpRegion"]);
const pRunUpStepping = toNumber(parameters["RunUpStepping"]);
const pRunUpSlowDown = toNumber(parameters["RunUpSlowDown"]);
//increase stepping speed if on a "staircase" region
Game_CharacterBase.prototype.animationWait = function() {
const isOnStairs = this.regionId() == pRunUpRegion && pRunUpRegion > 0 ? 3/pRunUpStepping : 3;
return (9 - this.realMoveSpeed()) * isOnStairs;
};
//decrease walking speed if on a "staircase" region
Game_CharacterBase.prototype.realMoveSpeed = function() {
const isOnStairs = this.regionId() == pRunUpRegion && pRunUpRegion > 0 ? 1-pRunUpSlowDown : 0;
return this._moveSpeed + (this.isDashing() ? 1 : 0) + isOnStairs;
};
})();
I saw in rmmz_objects.js that
Game_Follower.prototype.update and Game_Follower.prototype.chaseCharacter set the moveSpeed of the followers to that of the $gamePlayer, so I thought of tweaking that. After having no luck I was scratching my head and commented out the entire this.setMoveSpeed($gamePlayer.realMoveSpeed()); line in both functions, and interestingly enough it did absolutely nothing. So I'm a little lost as to how realMoveSpeed of the followers is set as it seems to match that of the $gamePlayer even without those lines. Any advice or pointers greatly appreciated.