Changing an Events move speed & move type within a JS plugin

Basically this plugin controls an events movement speed and movement type and is dependent on what switches are active at the time.


What would be the JS command to increase the movement speed of an event so that it's "normal"


and what would be the JS command to change the movement type to random?


Many thanks
Depending on your familiarity with JS, you should look in the rpg_object.js file. I think that's the one. You're looking for Game_Event most likely! I'll dig around in a little bit when I'm home and see what I can find for you unless someone beats me to it. 😉
Sorry, I woke up late yesterday and had to go in for a 14 hour shift. Came home and passed out dead last night hahaha.


So, I didn't see anything that shows me how to do this directly just within the  rpg_object.js   this function   Game_Event.prototype.setupPageSettings  the movement speed command literally seems to just be setMoveSpeed and the holder for the movetype is _moveType. Movetype is utilized by three numbers: 1, being random; 2, toward the player; and 3, a custom movement. However, I'm unsure as to how you would use that to directly affect a gameplay element such as an event. Hopefully someone can comment and shed some light on how to directly access an event to set its movement speed or type from the event script command.
You do something like:


this._moveSpeed = 4;
this._moveFrequency = 6;


Here are the values you can change, found in rpg_objects.js on line 6223:


this._x = 0;
this._y = 0;
this._realX = 0;
this._realY = 0;
this._moveSpeed = 4;
this._moveFrequency = 6;
this._opacity = 255;
this._blendMode = 0;
this._direction = 2;
this._pattern = 1;
this._priorityType = 1;
this._tileId = 0;
this._characterName = '';
this._characterIndex = 0;
this._isObjectCharacter = false;
this._walkAnime = true;
this._stepAnime = false;
this._directionFix = false;
this._through = false;
this._transparent = false;
this._bushDepth = 0;
this._animationId = 0;
this._balloonId = 0;
this._animationPlaying = false;
this._balloonPlaying = false;
this._animationCount = 0;
this._stopCount = 0;
this._jumpCount = 0;
this._jumpPeak = 0;
this._movementSuccess = true;




You can use the event command "Script..."


It's very versatile, like for example you could fade out an event like so: 


First page of event, you set variables, use parallel or autorun:


this._opacity = 255;




Next page, set to parallel or autorun: Script... Event Command: 


if (this._opacity > 0) {
this._opacity -= 1;
}


It will fade out your character into oblivion. Javascript + rpg maker mv is the best.


Random in javscript is like the following: 


Math.floor(Math.random()*((10-5+1)+5);


Does a random number between 5-10. Just replace the two 5's and the 10 with your number range of choice.


To change Event movement speed you do:


var eventspeed_fastest = 6;
var eventspeed_slowest = 1;
this._moveSpeed = Math.floor(Math.random()*((eventspeed_fastest-eventspeed_slowest+1)+eventspeed_slowest);




You can also do the same with the player object if you'd like:

Code:
var eventspeed_fastest = 6;
var eventspeed_slowest = 1;
$gamePlayer._moveSpeed = Math.floor(Math.random()*((eventspeed_fastest-eventspeed_slowest+1)+eventspeed_slowest);
Amazing Astracat! Super helpful information 🙂  You've helped two people out! Hope to learn some more from you on here. 😀
Wow, thank you so much for this information. Truly helpful! Thank you Thank you Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/changing-an-events-move-speed-move-type-within-a-js-plugin.61785/