Retain Speed Setting on Airship Exit

I was wondering if it is possible to modify the airship exit behavior?

I've created an item that modifies player speed for a short time, and all is working well except in relation to the airship.

It seems that the airship logic must set the player speed to 4 on exit, and I'm a bit out of my depth on how to modify the behavior with a conditional branch such that the speed will be set to 5 if the item Switch is active.

Any ideas would be much appreciated!
You could set up a parallel common event with the item switch as the trigger that sets movement route --> movement speed = 5... I don't love it, but it would work.

You could also comment out the this.setMoveSpeed(4); at line 7967 of rpg_objects.js.
Or better pull it out into a plugin, alias the function and then add:

if (this.isInAirship() && $gameSwitches.value(YOUR_SWITCH_ID)==true){
this.setMoveSpeed(5);
}

This would retain the natural function of returning the player's move speed to 4, increasing it to 5 if the item switch is on.
Thanks @AdeptusUK ! Line 7967 in rpg_objects.js is exactly what I was looking for.

It looks like it's at line 7953 in my build (maybe it's an MV version thing? I'm running 1.6.2)

I gave commenting it out a shot, but that results in the Speed remaining at airship speed after exit (woooooo!), so I replaced it with this:

if ($gameSwitches.value(53)==true) {
this.setMoveSpeed(5);
} else {
this.setMoveSpeed(4);

It seems to be working great!

Can you think of any potential problems with adding the logic directly to the getOffVehicle function in rpg_objects? You'd mentioned pulling it into a plugin and aliasing the function, but I wasn't sure how to do that so opted to fiddle with it directly.
Oh yeah, of course it leaves your speed at airship speed, haha!

I don't think that there is any issue with doing it directly in the code, I think it's just better practice to pull it into a plugin (there are loads of places in my project where I haven't done this either though, which is also probably why our line numbers don't match). Also, I'm not an expert and I am just learning js as I go in my project - my standard caveat!
Also, I'm not an expert and I am just learning js as I go in my project - my standard caveat!

You and me both! This is the first time I've run into something I couldn't modify as needed on the GUI-side, so it was a great excuse to start learning js :LZScool:

Thanks again for pointing me in the right direction!

Original thread: https://forums.rpgmakerweb.com/threads/retain-speed-setting-on-airship-exit.128926/