JavaScript questions that don't deserve their own thread

nope. what you have should work just fine. theres no mistakes there or anything.

just as a sanity check, yanfly's buffs and states plugin is installed, youve saved your project after setting the notetag, and youve made a new save file for the playtest while trying this out instead of loading one?
Yep! I always playtest from a fresh, brand new save file. Honestly, I am at loss. I can only imagine some plugin is interfering somehow.

Here is a little recording I just made. In turn zero, the enemy uses the skill that applies the 'counter' STATE (the one with the code). You can see the STATE is applied because of the pink icon in the STATE icon column, to the left of the enemy. Then, the actor attacks, and deals 8 damage. If my understanding is correct, the STATE should store the 8 as the value of variable 501, right? But, in the next turn, the enemy uses its attack (the formula for the enemy attack is v[501]), and it does no damage. Then, the message shows the value of the variable, which is still 0.

Hey guys! If I save all of an actor's equipment into a variable (code below) how can I fetch their IDs individually?


Code:
$gameVariables.value(1) = $gameActors.actor(1).equips();
@TheNewSon
1 - you can't do that, you can't assign values to a return value.

2 - there are a number of threads about how to use arrays in MV's game variables. I suggest you do a Google and read through those.

3 - once you do have it, you check the individual IDs exactly the same way as when they were in the equips() array of the actor.
@TheNewSon - also you'd typically store the Game_Item data rather than the entire database record, e.g. like the MV / MZ Script Call List examples, Memorise Equipment & Restore Equipment:

screenshot.png
Local copy:
  • Memorise:
    JavaScript:
    // Store the party leader's current equipment in variable ID 5
    $gameVariables.setValue(
      5,
      JsonEx.makeDeepCopy($gameParty.members()[0]._equips)
    );
  • Restore:
    JavaScript:
    // Restore the party leader's equipment from variable ID 5
    $gameVariables.value(5).forEach(function(item, slotId) {
      $gameParty.members()[0].forceChangeEquip(
        slotId, item.object()
      );
    });

Alternatively, to store the IDs of actor ID 1's current equipment, I think you could just use Control Variables -> Script:
JavaScript:
Array.from($gameActors.actor(1).equips(), function(item) { return item ? item.id : 0; })
Is there a way to make pictures appears in a higher Z layer than the Battle Log and Actor Battle Gauges? Temporarily, if possible.

Or to temporarily have pictures appear at the highest Z layer? I'm trying to make an image that appears above the these items in the battle scene.

I tried to use this plug in here, but I don't know the constructor to allow this: https://forums.rpgmakerweb.com/index.php?threads/changing-picture-z-index-value.155236/
@Lonewulf123 WindowLayer
Perfect thank you
ezgif-5-f0fdf2dcba.gif


Is there somehow a way to change the animation for when the window pops in and out? I dunno what js file to poke on for this.
I dunno what js file to poke on for this
if it has to do with a game window, first place to check is the window js file

try the plugin here as a start
Quick question. Is there a constructor layer that goes higher than this one?

I was able to get it over the gauges, but it seems like visuatella QTE events appear above even that.

Wondering if I could get the picture layer even higher.
Animations and the flashing white destination cursor go higher
Quick question. Is there a constructor layer that goes higher than this one?
I was able to get it over the gauges, but it seems like visuatella QTE events appear above even that.
I can't tell you anything about VisuStella code. But you might be able to find it, if you open the console and type SceneManager._scene._spriteset.children

Animations and the flashing white destination cursor go higher
Is that a change in MZ? In MV, battle animations display under the windows.
Animations and the flashing white destination cursor go higher
Without plugins, that is not correct.

I was able to get it over the gauges, but it seems like visuatella QTE events appear above even that.
MZ's core scripts only add 2 display children directly to the map/battle scenes: the spriteset (including animation container and destination sprite), then the window layer (game windows and Touch UI buttons).

The window layer and the spriteset are siblings; to identify additional layers added by plugins you would check SceneManager._scene.children. This may not help if the QTE sprites are added/removed dynamically.
to identify additional layers added by plugins you would check SceneManager._scene.children.
Bah, I was only off by one! 😛
Are SceneManager._scene.children sorted using z values?
If so maybe a high enough z value can solve the problem?
Without plugins, that is not correct.


MZ's core scripts only add 2 display children directly to the map/battle scenes: the spriteset (including animation container and destination sprite), then the window layer (game windows and Touch UI buttons).

The window layer and the spriteset are siblings; to identify additional layers added by plugins you would check SceneManager._scene.children. This may not help if the QTE sprites are added/removed dynamically.
Thank you guys, I'll try this.
Are SceneManager._scene.children sorted using z values?
Not as far as I know. The MV/Z tilemaps manually implement z-sorting (Tilemap#_sortChildren), and PIXI.Container has methods like addChildAt for layering.

[Edit: oh, looks like there may be a sortableChildren flag for auto-sorting. Looks like it's only a shortcut for changing the child order, though.]
Without plugins, that is not correct.


MZ's core scripts only add 2 display children directly to the map/battle scenes: the spriteset (including animation container and destination sprite), then the window layer (game windows and Touch UI buttons).

The window layer and the spriteset are siblings; to identify additional layers added by plugins you would check SceneManager._scene.children. This may not help if the QTE sprites are added/removed dynamically.
Coming to report back, I couldn’t find any layers that were added by the QTE. It looks like they were added and removed dynamically like you suggested.

I could be wrong though, but this how it looks like its handled.

I’m not sure how to approach this, but I may come up with an alternate solution.
@Lonewulf123 - a variety of on-map QTEs can be created with no plugins or scripting, e.g.
This might be a bit more effort but it definitely gives you more creative control~
Is there some way to get the current amount of enemies in a fight? I wanted it so that the damage of my multi-target skill is evenly distributed, and I hope there's some thing I could get the values from.

Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/