MZ I really need to check if an enemy notetag exists or not plugin wise

Okay, so I'm modding the SV_Battler motions for enemies and since it runs under Visustellas Battle Core it already connects SV_Battlers to both actors and enemies through Sprite_Actor.

Adding an "If not Actor" whas easy but adding another "if" to check an enemy notetag so I could have a variant with only four motions whas much harder. I figured out the Meta things really quickly but referencing it and seeing if its existence whas true whas really not.

I plan another one to check for another tag and then extend a sheet to four frames if it exists and I don't really worry about this (besides the tag ofcourse) since indexes and measurements are pretty obvious.

I could really appreciate some help with this and the tutorials and things that exists are either related to MV, tags with values or exist in the context of damage formulas.

I've moved this thread to JS Support. Thank you.

Not seeing your code makes it a bit difficult to support you, but I can try explaining the meta object.

The meta object contains all notetags that follow the <My Tag> and <My Tag: 42> pattern. By default, the pattern <My Tag>TEXT</My Tag> is not supported and requires a regex check. At the beginning, you should avoid it and stick to the other variants.

Then you can query like this:

Code:
// notetag exists?
const notetagExists = "My Tag" in meta

// alternatively
const notetagExists = meta["My Tag"] !== undefined

// <My Tag>
const bool = meta["My Tag"]

// <My Tag: TextValue>
const textValue = meta["My Tag"]

// <My Tag: 42>
const numberValue = Number(meta["My Tag"])
Ah, sorry about the placing it in the wrong subforum.
I know the <> </> whas a VX thing at least.

Anyway. What I'm trying to do is check if an enemy has a <fourMotions> notetag and then jump to the index of four motions. I think I might be dumb but everything I try, even empty trial branches tells me its undefined.

I did try the variants posted above but either I understood it wrong (should I check if each constant equals the meta or is the meta to should the question itself be shoved into the constant?).

I think my problem is that it doesn't find the enemy subject since this code sits in Sprite_Actor. But both Sprite_Enemy and Sprite_Actor pulls from Game and Sprite_Battler so I don't know why it shouldn't.

/* const Game_Enemyinitialize = Game_Enemy.prototype.initialize;
Game_Enemy.prototype.initialize = function(enemyId, x, y) {
Game_Enemyinitialize.call(this);
this.setup(enemyId, x, y);
this.fourMotions = $dataEnemies[enemyId].meta.fourMotions || null;
}; */

const actor = this._actor;
const enemy = this._enemy;
/* const fourMotions = $dataEnemies[enemy].meta.fourMotions; */
/* if (fourMotions ==! true){
}; */


if (actor) {
//normal Actor SV_sheet
Sprite_Actor.MOTIONS = {
walk: { index: 0, loop: true },
wait: { index: 1, loop: true },
chant: { index: 2, loop: true },
guard: { index: 3, loop: true },
damage: { index: 4, loop: false },
evade: { index: 5, loop: false },
thrust: { index: 6, loop: false },
swing: { index: 7, loop: false },
missile: { index: 8, loop: false },
skill: { index: 9, loop: false },
spell: { index: 10, loop: false },
item: { index: 11, loop: false },
escape: { index: 12, loop: true },
victory: { index: 13, loop: true },
dying: { index: 14, loop: true },
abnormal: { index: 15, loop: true },
sleep: { index: 16, loop: true },
dead: { index: 17, loop: true }
};
} else {

//edited Enemy SV_sheet
Sprite_Actor.MOTIONS = {
walk: { index: 0, loop: true },
wait: { index: 1, loop: true },
chant: { index: 2, loop: true },
guard: { index: 3, loop: true },
damage: { index: 0, loop: false },
evade: { index: 5, loop: false },
thrust: { index: 6, loop: false },
swing: { index: 7, loop: false },
missile: { index: 8, loop: false },
skill: { index: 9, loop: false },
spell: { index: 10, loop: false },
item: { index: 11, loop: false },
escape: { index: 12, loop: true },
victory: { index: 13, loop: true },
dying: { index: 0, loop: true },
abnormal: { index: 0, loop: true },
sleep: { index: 0, loop: true },
dead: { index: 0, loop: true }
};
//fourMotions should be between here

}

Original thread: https://forums.rpgmakerweb.com/threads/i-really-need-to-check-if-an-enemy-notetag-exists-or-not-plugin-wise.183311/