Calling/dispatching airship (Common event)

Hello, and thanks for taking your time to read this topic! 😀 👍

Anyway, I'm looking for help with my airship event. It's (hopefully) rather basic but there are some frustrating bugs which I can't seem to exterminate. I hope it's all because my own limitations and not the engine/event system itself. Please take a look and see if you can help me out!

For this common event I'm using three plugins;
* Yanfly's Button Common Events (only used to bind the "F" key to activate this common event)
* Victor Sant's Custom Vehicles
* Galv's Basic Event Shadows

So right now my event looks like this...
uNCCvRq.jpg


If you are not familiar with Victor Sant's Custom Vehicles och Galv's Basic Shadows plugins. I've explained the plugin commands and script calls used here:

Spoiler
SetVehicleLocation PinkWing v[1] v[2] v[3] <-- This is a plugin command from the custom vehicles plugin. It calls said vehicle to players current location. PinkWing is the vehicle name. V[1] is variable 1 which handles map ID. V[2] is variable 2 which handles players map x location and V[2] is variable 3 which does the same for players map Y location.

SetVehicleLocation PinkWing 50 2 2 <-- By looking at the explanation above it's easy to figure out that this plugin command dispatches the airship when not used to a storage map which have map ID 50.

Galv.BES.pShadows(true); <-- This activates the player shadow through Galv's Basic Shadows plugin. It just draws a normal shadow under player when he is walking.


Galv.BES.pShadows(false); <-- This obviously deactivates above mentioned player shadow. This is because the vehicle is flying and flying vehicles in MV have their own shadows drawn.


IMPORTANT!
It needs to be said that Victor Sant's "Custom Vehicle" plugin makes it possible to activate/deactivate a switch depending on if you are currently in the vehicle or not! This is done outside of this event and I have named this switch "Currently Flying".

The event works. Well kind of, it is not 100% reliable and there are some glitches I'd like to sort out so I'll list them here.

* Sometimes the airship sprite stays on screen for a split second before being stored away. The same thing happens sometime when calling the airship. For a split second it is visible at the same time as the player sprite. This mainly (but not exclusively) happens if the player is calling the airship while walking.

* When the player is flying above an area where he cannot land (an example of this would be above tiles the player can't walk on), Galv's plugin will still draw a second shadow underneath the player. Which is strange considering the "if" statements?

* Often the shadow drawn by Galv's plugin stays when the airship have been called and boarded. I've re-written the event a couple of times and this is a new glitch.

That's all. If you have any questions (or answers! 😛 ) feel free to speak up.

Thanks for taking your time.
I'm not familiar with the plugins, but I notice you test the switch immediately after the get on/off vehicle command.  By default, it might take a few frames for you to actually complete the get on/off vehicle command - depending on how Victor's script works, that switch may not be updated until after the command is completed.


It might be worth adding a Wait X Frames immediately after the Get On/Off Vehicle commands - start with 60 frames, then reduce it to 30, then 15, and see if any of them make any difference.  


How is this common event activated?  If only by the F key, then you wouldn't expect the shadow to change while you're flying, unless you're also pressing the F key while you're flying.  If activated by a keypress, this is a 'point in time' common event that will only test the status at the very moment the key is pressed.  You would not expect it to change the shadow when flying over areas you can't land.  Is that the only thing that determines whether the shadow is visible or not?  Or is there something in Galv's plugin that does it?  If 
Galv's plugin doesn't cater for can/cannot land areas, then you would need to have something else activated to determine whether the shadow is displayed or not.
@Shaz

Thanks for your time. And you are right, there probably should a a wait command there, and I've added it but it doesn't seem to fix the problem. In fact the event became even stranger since now the airship sprite does not move at all,instead player flashes once then he is standing on the ground once again, airship not to be seen.

This event is activated only by pressing the "F" key. I wanted "F" to toggle if the player is flying or not and when pressed instantaneous make the airship appear and be boarded. While writing this I realize there is another BIG problem with this whole event which is I don't know how to prevent that player presses "space" or "enter" while in the airship which by default vehicle rules makes them leave it but does not activate the event thus leaving the airship on the map etc. I'm pretty sure that Victors Custom Vehicles follows the normal rules for vehicles so I don't know if it's possible to override this without another (currently non existent?) plugin?

Galv's plugin does not look for anything. It's just a script call which activates och deactivates the shadows.

I also forgot to mention that I have a parallel process that runs whenever the "currently flying" switch is turned on. It has a "wait 8 frames" command at the start. Could it be that this process messes with this event somehow? I don't think I've noticed any lag yet though.

[EDIT; I realized that I might not be able to have the ON / OFF checks in the same event since what seems to be happening is that the first if statement is completed which turns on the switch and thus completes the other statement as well!]
no - in fact, the wait 8 frames at the start would PREVENT lag.


I think you just need to have another switch - one for the plugin and one for your common event.
@Shaz

Ah sorry I probably typed that poorly. The 8 frame wait is of course in the parallel process to prevent lag. But since I believe that it might still be a heavy process I was considering whether that process would mess with this common event? But again, since I've yet to notice any lag I guess it is safe to assume it doesn't?

What I did now was that I changed the later "if" statement to a "else" statement that belongs to the first "if". That way at least both shouldn't be triggered at the same time. But I guess I might need someway to check if player is somewhere he cannot land (for Galv's shadows) and maybe also a separate event for checking if "currently flying" is not activated, and migrate the "dispatch of airship" command to that event to make sure it happens even if player chooses to leave the airship by pressing space/enter. Since I probably can't disable that option.

I'm starting to confuse myself though and I don't have a clear idea on how I would set this up in a good way anymore. You mentioned that I could use another switch, could you elaborate how you think I should use it since I'm not sure I follow what you mean? 🙂

Original thread: https://forums.rpgmakerweb.com/threads/calling-dispatching-airship-common-event.65317/