I would like to vary the walk and dash speeds by very small amounts e.g. make walk 4.2 instead of 4 and dash 4.75 instead of 5 as I've found in my previous games that it makes both speeds feel better.
In the file named rmmz_objects.js within the folder js, there is a line of code named Game_CharacterBase.prototype.realMoveSpeed.
By default it is return this._moveSpeed + (this.isDashing() ? 1 : 0);
_moveSpeed is initialized with a value of 4.
realMoveSpeed is used in Game_CharacterBase.prototype.distancePerFrame. In that function is return Math.pow(2, this.realMoveSpeed()) / 256;
I would highly suggest creating a plugin using any text editor you like, but don't forget to save your file with .js
Within your plugin, you will need to overwrite Game_CharacterBase.prototype.realMoveSpeed and most likely Game_CharacterBase.prototype.distancePerFrame as well, however if you don't care what happens to your core files, then edit them. Be warned whenever a new update comes out and you want to update your project, it will overwrite any and all changes to core files.
Always remember to keep backups of all files in your project. Good rule to follow.
Sadly I couldn't write a plugin to save my life. I reached the stage where I could do ultra easy things in Ruby, but I moved from VX Ace to MZ only a few days ago and know simply nothing about JavaScript.
You can use this sort of thing in a Script command to change the player's move speed: $gamePlayer.setMoveSpeed(4.2);However, I would recommend a plugin for this, since it's easier to use the built-in dash system and vehicles have a...quirk that makes them reset player speed to 4 on exit rather than preserving the player's previous speed.
Try this (untested):
JavaScript:
/*:
* @target MZ
* @plugindesc Change player walk and dash speed.
* @author Caethyril
* @url https://forums.rpgmakerweb.com/index.php?threads/147948/
* @help Terms of use: free to use and/or modify for any project.
*/
// Alter player walk speed
(alias => {
Game_Player.prototype.initMembers = function() {
alias.apply(this, arguments);
this._moveSpeed = 4.2; // walk speed
};
})(Game_Player.prototype.initMembers);
// Alter dash speed (default is walk + 1, change that by -0.5)
(alias => {
Game_Player.prototype.realMoveSpeed = function() {
return alias.apply(this, arguments) - (this.isDashing() ? 0.5 : 0);
};
})(Game_Player.prototype.realMoveSpeed);
// Restore pre-vehicle move speed when leaving a vehicle
// (By default it resets to speed 4.)
(alias => {
Game_Player.prototype.getOnVehicle = function() {
const res = alias.apply(this, arguments);
if (res)
this._preVehicleSpeed = this.moveSpeed();
return res;
};
})(Game_Player.prototype.getOnVehicle);
(alias => {
Game_Player.prototype.getOffVehicle = function() {
const res = alias.apply(this, arguments);
if (res) {
// normally resets to 4 here, override that
this.setMoveSpeed(this._preVehicleSpeed || 4.2);
delete this._preVehicleSpeed;
}
return res;
};
})(Game_Player.prototype.getOffVehicle);
I think that'll cover all cases for the player. If you want to affect walk speed for all characters, you can replace this part:
JavaScript:
// Alter player walk speed
(alias => {
Game_Player.prototype.initMembers = function() {
alias.apply(this, arguments);
this._moveSpeed = 4.2; // walk speed
};
})(Game_Player.prototype.initMembers);
...with this:
JavaScript:
// Alter all characters' walk speed
(alias => {
Game_CharacterBase.prototype.initMembers = function() {
alias.apply(this, arguments);
this._moveSpeed = 4.2; // walk speed
};
})(Game_CharacterBase.prototype.initMembers);
That includes (what I think is) a fix for the speed reset on leaving a vehicle.
[Edit: replaced getOn and getOff with correct name alias.]
Copy + paste the code into a text editor (e.g. Notepad).
File > Save As:
File Type: All Files
Filename: something.js
(This works because .js files are plaintext.)
Import that file as a plugin via the Plugin Manager.
Save your project to apply Plugin Manager changes.
I had done the same as you in the VX Ace times with Ruby. I started learning more about javascript right after the huge scene when a lot of plugin makers got tired of harassment and abuse from fellow community members, because of that I am afraid to post my own plugins that are collecting dust in my folder.
I spent a good amount of time problem solving and getting them to work the way I want them to work. I know years from now, I will look back for nostalgia sake and rewrite them better.
The best place to start is taking your time and understanding the basics. I am no expert or master. A year ago I told myself that it would be too hard. The thing is, if you keep telling yourself that it is too hard or that you can't, then unfortunately you will continue down that path. Switch can't to can. Better your mind with positive thoughts.
I can teach you some of the basics when I have time. I remember a year ago when I wished I had someone to learn from. Feel free to message me directly. I will try to help. First steps in learning are usually the hardest. Remember that it is mostly with the mind.
You can also use a search engine and look up what is javascript function. Read up on functions, syntax, integers, and strings. Those are the building blocks.
1st step: I suggest is downloading notepad++. It is very helpful. The default text editor packaged with Windows or Apple is okay but could do better.
2nd step: Open notepad++.
3rd step: Create a new file with notepad++.
4th step: Save the as Kes_MovementSpeed.js // Now the editor understands that you plan to write in javascript, because of the file type is .js Also // in javascipt is to comment in your script. It doesn't effect your code. In Notepad++ comments are green text.
5th step: Your first line should will be Game_CharacterBase.prototype.realMoveSpeed = function() {
6th step: Your second line will be return 4 + (this.isDashing() ?1 : 0); // Remember your semicolon ; Learn the syntax. Learn what is a javascript function.
7th step: Play with the values 4 and 1 in 6th step.
8th step: Your last line will be }; // Never forget to end your functions with );
9th step: Save the file.
10th step: Move Kes_MovementSpeed.js to your project inside js and into plugins.
11th step: Open your plugin manager in your project, then select Kes_MovementSpeed.js, then maker sure it is on. Press Ok button. // Congrats you made your first plugin. It isn't fully complete. You might notice the first issue, but hey you now got more speed.
Edit: I got caught up on writing that reply for about an hour. Use caethril plugin. caethril is really good and very helpful. Thank you caethril
@caethyril Thank you so much for that. I've tried it out just on walking (don't have a vehicle set up atm) and it works perfectly.
What do I need to do to change the dash speed from 5 to 4.75? It is just a shade too manic at the default speed for getting round on the type of maps I tend to do. I've done my best at looking at the plugin, but couldn't see any reference to that.
I picked 0.55 because that's the difference between your quoted values, 4.75 and 4.2. [Edit: whoops I just noticed you wrote 4.75. I've edited my numbers to fit. ]
In case it's relevant:
There's an Always Dash setting in the in-game Options menu.
Touch-based movement always uses dashing speed.
For reference, the default version of that method is this:
I.e. normally you move at walk speed +1 when dashing, +0 when not. My original suggestion is a patch that can be read as "default realMoveSpeed, minus 0.45 if dashing". It's -0.45 here because that's the difference between +0.55 (desired dash +speed) and +1 (default dash +speed).
As mentioned, though, an override would probably be totally OK here~
@caethyril Thank you for the clarification. I'm afraid that when it comes to coding I have a bird brain (as you might expect given my avatar) and JavaScript is completely new to me. I therefore can miss the most obvious.
@caethyril I seem to have hit a problem.
All was fine when I was just running around the map testing passabilities, but when I went to use Galv's camera plugin (still just running around) I got this error message
The console shows this:
I'm not trying to get on or off a vehicle, and so have no idea why it's trying to call that.
Once I turned this plugin off the camera command working without a hitch.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.