[RMMV] Incompatibility between Yanfly Spawn & GalvTools

UPDATE 2:
Oaky!
After a second round of testing we have determined the cause is that when using Yanfly's Spawn/Morph/Copy plugins the notetags do not transfer correctly, or somehow make the notetag unreadable?

This is replicateable by spawning or morphing in an event with the notetag <rock:1> (an existing and working tag without the crops plugin), but the hammer does not recognize it. q0q Aaaaaaaahhh- I really need some help to fix/workaround this!

As a note, for some reason when spawning in an event with a parallel process on the first page the parallel does not run? Do these events require a refresh of some kind*has no idea what she's talking about*

When using galvs spawn event the notetags reads fine, but that doesn't solve the issue with morph/copy, plus I would really like to keep these three together working in tandem if at all possible. The ability to call the last event ID spawned is amazing (plus if that event was despawned it grabs the event before that it's very useful).

Screenshots:
Spoiler

Plugs Mentioned in the error:

Last Post:
Spoiler
UPDATE: After some troubleshooting it seems the issue lies in an incompatibility (or something similar) between yanfly's core engine and this event. So I am now seeking to have someone maybe help me fix/patch that! q0q Additionally, when Yanfly's SelfVariables is turned on the Dev tool replaces the yanflyCoreEngine with that in the error log. So I cannot spawn in this specific event while Yanfly's core plugin is working.

When I disable all yanfly plugins (utterly not ideal) and use the galvspawnevent instead it works.
This causes some huge issues for me, namely galvs spawn events cannot use player x,y-1 values I have set and has much less functionality, but the biggest issue is obvously not being able to use yanfly plugins at all!

To be more specific, the below (spawning in with the yanfly spawner) fires correctly and works on all regular events except this galv crop event. For those maybe still wonderiing, yes the region check condition is a plugin made by the wonderful ct_bolt!

Previous Post:
Spoiler
So I've been fiddling with creating a "hoe" that when used on certain tiles will spawn in Galv's crop event using Yanfly's Event Spawner but when the crop is spawned in it creates an error! q0q Is this a compatibility issue or just a "you can't spawn in this event while you're on the map" kind of thing, and is there possibly a way around it aah-

The game does not crash until you leave the area, let me know if you need more info!
Thanks so much for any help with this!! If there isn't a way around this I will seek a different route!

SCREENSHOTS:
Spoiler
1583040607740.png

1583041020391.png


The crop event:
a373f28a2cb2085cd352e53c87ecdc97.png


The Tool Common Event
1583040389327.png
not sure though, but $gamePlayer.regionInFront() is probably not a scriptcall that can be used normally.
its a longer list and a tiny plugin to see that direction, you should read the helpfile on both which
scriptcall can be used.
As above, I'm pretty sure that there is no script call like $gamePlayer.regionInFront() ??
Unless you wrote the script yourself?
I've never tested Galv Simple Crops/Tools, though Galv does have an event spawner https://galvs-scripts.com/2016/05/14/mv-event-spawner/ perhaps that will work to solve the issue.
btw, this is how you check region in front:

$gameMap.regionId($gameMap.roundXWithDirection($gamePlayer.x, $gamePlayer.direction()), $gameMap.roundYWithDirection($gamePlayer.y, $gamePlayer.direction())) === 15

change 15 to any number that you like.
otherwise, regioninfront script call require this plugin unless you have it though.

Event spawner should work, while galv and yanfly event spawner is different, so read the helpfile
from both to get it to work, or respawn the event by eventing it.
As above, I'm pretty sure that there is no script call like $gamePlayer.regionInFront() ??
btw, this is how you check region in front:

Good morning!
Ahhh, yes! The find region is a plugin! It plays the entire thing, and I receive the "Event should have spawned" message! That part works, everything works as intended, and the yanfly spawn event also works EXCEPT when THIS event is spawned in it produces this error!


Event spawner should work, while galv and yanfly event spawner is different, so read the helpfile
from both to get it to work
I've never tested Galv Simple Crops/Tools, though Galv does have an event spawner https://galvs-scripts.com/2016/05/14/mv-event-spawner/ perhaps that will work to solve the issue.

I tried it and found something interesting, I 99% believe this to be an incompatibility with the yanfly core! As when I disabled all yanfly plugins the galv spawner worked. However this is not a solution for me q-q It both restricts me from using ANY yanfly plugins (need those self variables etc.) and also the GalvSpawnEvent can not use my player x,y-1 values to spawn things in front of the player!

I have updated the thread to reflect this troubleshooting! Now I am specifically looking for someone to make a patch for this issue! qvq
Seeing as how I give Galv's Event Spawner commands like that, it definitely works. Though when it comes to it and Yanfly's Self Variables you have to have Yanfly's Self Variable plugins listed after Galv's Event Spawner. Otherwise the spawned events have issues with the self variables.

I'd say mess around with your plugin order, I've largely had no problem with Galv's plugins and Yanfly's as long as I have Core Engine first, and Self Variables last. But they both have a lot of plugins so my testing isn't exhaustive.
I'd say mess around with your plugin order, I've largely had no problem with Galv's plugins and Yanfly's as long as I have Core Engine first, and Self Variables last. But they both have a lot of plugins so my testing isn't exhaustive.


They are layered Yanfly core > Galvs Tools > Yan spawn > Yan morph > SlfVars. Okay so I think for some reason the notetags don't respond to the if script: Galv.TOOLS.frontEvent('notetag') after being spawned in onto the map? Not sure how to fix that tho oof. q^q

I noticed when I spawn in the event doesn't run the parallel process either hmm. Aaaa-? I thought the yanfly script might be out of date but it's 1.02 so it should be okay (the highest listed is 1.01, questionable haha).

I replicated it in a fresh demo by spawning in the galv event using the yanfly spawn plug, the notetag did not return with the script call above.



EDIT: It doooooes work with the galv spawn plug though, so something is different between them. qvq I might not have a choice. Ideally I would like to use yanflys because I am also using the event copier and event morpher, both of which are going to probably have the same issue.

EDIT 2: Okay they for sure DO have the same issue. When yanfly Spawn, event, morph spawn in an event with a notetag for galvs tools it does not recognize the notetag for some reason!
Well if you want to post screenshots of the events in question, and your exact plugin order I can take a look at it.
Well if you want to post screenshots of the events in question, and your exact plugin order I can take a look at it.

Sure! When I get up in the morning I will shave off all the eventing bloat that I know works and leave the part I can't get working! (I am totally not awake at 2am in bed with fiance mulling over this). Edit: Added em in!

Specifically though, it's when say a tool normally uses an if: (conditional branch) script: condition using Galv.TOOLS.frontEvent('rock:1'), it works fine! Aka the common event for pickaxe on the rocks in the demo! But spawn in that exact event with yanfly and it no longer recognizes the notetag.

I replicated this bug with only galv tools and yanfly core+spawn earlier, alternating tools/spawn plugin order with the same effect. (Note if you try it for yourself to delete aaall dem crop events on the first map cuz the game hella don't like runnin' 'em without the galv crops plugin).

Again, for whatever reason the notetag persists using galvs spawner, Y u do dis yanfly plug-

Screenshots:
Spoiler
HERE is the common event being used on the newly spawned rock.
HERE is the tool being used on the same event not spawned in.

The tool common event is left unchanged.
1583240053528.png

1583240064490.png


Ignore the fact those text coords are wrong aha-
1583240105683.png


Same rock event from the front page-
1583240115092.png
Replace this code in the Tools plugin....
JavaScript:
Galv.TOOLS.frontEvent = function(tag,value) {
    var direction = $gamePlayer.direction();
    var x1 = $gamePlayer.x;
    var y1 = $gamePlayer.y;
    var x2 = $gameMap.roundXWithDirection(x1, direction);
    var y2 = $gameMap.roundYWithDirection(y1, direction);
    return Galv.TOOLS.getEvent(x2,y2,tag,value);
};

With....

JavaScript:
Galv.TOOLS.frontEvent = function(tag, eSwitch) {
    var direction = $gamePlayer.direction();
    var x = $gameMap.roundXWithDirection($gamePlayer.x, direction);
    var y = $gameMap.roundYWithDirection($gamePlayer.y, direction);
    var eId = $gameMap.eventIdXy(x, y) || [];
    var eNote = $gameMap.event(eId).event().note || [];
    if (tag === eNote){
        var key = [$gameMap._mapId, eId, eSwitch];
        $gameSelfSwitches.setValue(key, true);
    }
    return;
};

I've basically just pushed the whole switch flip he was doing to the plugin itself. Just be certain to do your tags exactly like in the pictures. I've also made it so you can pick the switch that is being flipped when you make the function call. (See pics for examples).

Then you just make the switch be for a page that trigger's a despawn command and/or any animation you want.
I've basically just pushed the whole switch flip he was doing to the plugin itself.

Ahhh qvq thank-you for all your hard work and this workaround! I think that works for some of it, like setting the crop to the watered state, but like you mentioned before for planting the seeds yeah it's still a problem. orz.

I think it will need to be like, Turn slfsw B on then have selfsw B page run a CE to plant the seeds- Although it's a bit runaround that could work! So thank-you very much! I am not going to close this thread right away until I am confident all te bugs have buggered off, besides, it's only 9am for me yet! Time to get le testin'!

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.

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-incompatibility-between-yanfly-spawn-galvtools.118730/