MZ Core Engine VisuStella MZ, Problems

Hello, I'm having problems with these 3 Core Engine VisuStella MZ tags:
<JS xparam Plus: code>
<JS xparam Rate: code>
<JS xparam Flat: code>

Values do not change (first time only)
<JS HIT Rate: $gameVariables.value(20)[1]>
for example, using a vector (variable).

Even using this code below:
Code:
$gameActors.actor(21).actor().traits.push({code: 22, dataId: 0, value: -0.027})
For example, the value remains static, but when I disable the plugin I can change the values of xparam etc.

Can someone help me? I would like to stay very much with the Core Engine VisuStella MZ, thank you in advance.
It's probably a good idea to include a safety check, in case it's called before you store an array in that variable. E.g.

<JS HIT Rate: Array.isArray($gameVariables.value(20)) ? $gameVariables.value(20)[1] ? 1>
This should return 1 (i.e. 100%) if the value of game variable 20 is not an array.

Other ideas:
  1. Array index 1 is the second element in an array, e.g. ["A", "B", "C"][1] returns "B". If you want the first element, use [0] instead. What is the array in game variable 20?

  2. Check the console (F8 during playtest) to see if any error messages (red text) are logged there.
It's probably a good idea to include a safety check, in case it's called before you store an array in that variable. E.g.

<JS HIT Rate: Array.isArray($gameVariables.value(20)) ? $gameVariables.value(20)[1] ? 1>

This should return 1 (i.e. 100%) if the value of game variable 20 is not an array.

Other ideas:
  1. Array index 1 is the second element in an array, e.g. ["A", "B", "C"][1] returns "B". If you want the first element, use [0] instead. What is the array in game variable 20?

  2. Check the console (F8 during playtest) to see if any error messages (red text) are logged there.

Hi, thanks for replying, well everything is fine with my array. I declared the array and assignment.

See, using this tag from VisuStella's CoreEngine plugin
<JS HIT Plus: $gameVariables.value(20)[1]>

My Actor has 100% Hit Rate

In an Event A I have the following:
$gameVariables.value(20)[1] -= 0.01;
Reduces your Hit Rate by 1%.

I can run this event as many times as I want, for example running it ten times. My Actor will have 90% Hit Rate.

The problem comes when I check the Actor Hit Rate value using this:
var myHit = $gameActors.actor(21).hit * 100;
console.log(myHit.toFixed(2));
It includes the 90% Hit Rate.

But the problem is that, when I run Event A again, the value is static, that is, it doesn't matter how many times I run it, but from the moment I check the value of my Hit Rate, either when using this → var myHit = $gameActors.actor(21).hit * 100;
In other words, through Menu/Status/Parameters (with the VisuMZ_1_ElementStatusCore plugin) Even executing Event A again after one of the two queries, the value remains static.

Executing Event A five times would go to 95%, after querying the Menu, for example, when executing Event A again the value always remains at 95%

Even using the code below, it remains static after one of the two mentioned queries:
$gameActors.actor(21).actor().traits.push({code: 22, dataId: 0, value: RATE})
RATE - set a value.

Sorry for my english, using Google Translate ^^
Just my little bit:

I am not 100% sure if this line really can work in any way.
$gameVariables.value(20)[1] -= 0.01;
because from my understanding first of all .value is a query function which only returns a value and not sets it. The proper method would be .setValue. Then value of $gameVariables returns an integer value which would ignore an operation with a decimal value. And last but not least it's not an array Caethyll already mentioned.

if you want to set a game Variable it should look like:
$gameVariables.setValue(id, value)

where the value has to be a number without decimals. so something like 1,2,3... but not something like 1.265743...

so the line if you would use a value like 1 would look like
$gameVariables.setValue(20, $gameVariables.value(20) - 1);

hope that helps
Just my little bit:

I am not 100% sure if this line really can work in any way.
$gameVariables.value(20)[1] -= 0.01;
because from my understanding first of all .value is a query function which only returns a value and not sets it. The proper method would be .setValue. Then value of $gameVariables returns an integer value which would ignore an operation with a decimal value. And last but not least it's not an array Caethyll already mentioned.

if you want to set a game Variable it should look like:
$gameVariables.setValue(id, value)

where the value has to be a number without decimals. so something like 1,2,3... but not something like 1.265743...

so the line if you would use a value like 1 would look like
$gameVariables.setValue(20, $gameVariables.value(20) - 1);

hope that helps

Hi!

Code:
$gameVariables.setValue(ID, []);

It works!

Before doing the tests above, I assemble my arrays.

Code:
$gameVariables.setValue(20, []);
for(i = 0; i < 11; i++)
    $gameVariables.value(20)[i] = 0;

But the problem is not the fact of using an arrays, a simple variable... However Thanks for answering.

Original thread: https://forums.rpgmakerweb.com/threads/core-engine-visustella-mz-problems.150028/