Can't update params (?)

Hi
I'm trying to do a very simple event in order to reset to 1 an actor param and then rise it equal to a variable value.
I tried in this way, but if I check the party my actor parameter is always 1.
What's wrong?
how do you check the parameter?
I suggest using control variable and show text at several times between the lines of this event to check where it goes wrong.
how do you check the parameter?
I suggest using control variable and show text at several times between the lines of this event to check where it goes wrong.

Variable value is always correct: the problem seems to be the "-9999" operation (regardless of the entered value).
In the following img I tried to modify my actor atk param and right after reset and update it with a new value.
Now: doing the "+9998" "-9998" thing seems to fix the problem, but only the first time it calculates the param. After, when I try to reset/update atk with a new value it can't correctly calculate it.
Opening the menu after every step showed me that the second time MV calculates 300 (the right value of the first variable) +9998-9998 = 300 (but the max for my stat is 9999 still it doesn't stop there while calculating) so...uhm... idk know how to get out of this problem...

How can I do the same things via script? Maybe it's better
I asked how you check the value and suggested the display to be included in this single event for a lot of reasons, because if you check the value outside the event something else can interfere and mess up everything.
so please change the event so that you display the attack value between your changes.

like
change parameter attack +9999
control variable temp = attack value
show text "attack value is ..."
change parameter attack -9999
control variable temp = attack value
show text "attack value is ..."
change parameter attack +variable
control variable temp = attack value
show text "attack value is ..."

and so on
I asked how you check the value and suggested the display to be included in this single event for a lot of reasons, because if you check the value outside the event something else can interfere and mess up everything.
so please change the event so that you display the attack value between your changes.

like
change parameter attack +9999
control variable temp = attack value
show text "attack value is ..."
change parameter attack -9999
control variable temp = attack value
show text "attack value is ..."
change parameter attack +variable
control variable temp = attack value
show text "attack value is ..."

and so on

Hope these are what you need
and what is the result of that event?
the code itself doesn't help me. If each number is the expected result then the commands work as intended - especially since you entered the correct expected results next to the numbers
and what is the result of that event?
the code itself doesn't help me. If each number is the expected result then the commands work as intended - especially since you entered the correct expected results next to the numbers

In pic 2 when the max value of atk param is 9999 and then I subtract 9998 the result is still 300, that's not correct or, at least, MV is doing something I don't understand. The expected result should be 1 (complete reset of the param value)
(Final atk value is 699 but it should be 400)
By default, the final value for one of an actor's basic parameters (e.g. ATK) is given by:
Code:
(base + plus) * rate
...where:
  • base is the value from their current class at their level;
  • plus is the permanent bonus from the Change Parameter (Modifica Parametro) command;
  • rate is from traits, e.g. ATK * 120%.
But plus can be negative, and the overall minimum value for a parameter is 1 (or 0 for MMP). This is why you're ending up with 1 ATK when you add -9999. 😅

So when you say "reset to 1", which one of these do you want?
  1. Change plus so that (base + plus) * rate equals 1.
  2. Change plus so that base + plus equals 1.
  3. Change plus to 0.
  4. Something else? (If so, what?)
You can get the overall current ATK of an actor (i.e. (base + plus) * rate) using Control Variables > Game Data > Actor > ATK. So you could subtract that value instead of 9999, then +1 before applying your new value, e.g.
Code:
◆Comment:Get (ATK - 1)
◆Control Variables:#0009 temporary = Attack of Harold
◆Control Variables:#0009 temporary -= 1
◆Comment:Subtract that from current ATK bonus: ATK - (ATK - 1) = 1
◆Change Parameter:Harold, Attack - {temporary}
◆Comment:Add new bonus
◆Change Parameter:Harold, Attack + {Harold ATK}
Note that it will need to be reapplied if/when the base ATK value (or ATK trait) changes, e.g. on level-up. Remember you can change the parameter curves of any class via the Classes tab in the database.

Otherwise you can use scripting (e.g. in Control Variables > Script) to get specific base or plus values:
  • base ATK (param ID 2) of actor 1:
    JavaScript:
    $gameActors.actor(1).paramBase(2)
  • plus ATK of actor 1:
    JavaScript:
    $gameActors.actor(1).paramPlus(2)
But plus can be negative, and the overall minimum value for a parameter is 1 (or 0 for MMP). This is why you're ending up with 1 ATK when you add -9999.

I know this.
In fact, as you can see in the first post, I always subtract that 1 point at the end.

The problem is that If I bring back atk value to 1 again (in order to add, then, another variable value) it just stay at 1.

Look the pic in the first post since it all comes from there.

Let's say my actor's atk = 500
Ok.
How is it possibile, then, that if I do Atk -9999 +300(variable value) -1 = 1??? Shouldn't it be 300?

500 - 9999 = 1 (as you said)
1 + 300 = 301
301 - 1 = 300 (my variable value)

There is something I can't understand since for MV the result is 1 instead of 300
(variable value)
you named that variable as "variable" instead of giving it a name that describes what it contains.
In my opinion that is a bad choice, because it might be that you have multiple variables with the same name "variable" - have you checked for that? That you might possible have confused different variables with different contents?
and sorry, my post above was abbreviated due to internet error, I wanted to write more but that part has been handled in other posts above.
you named that variable as "variable" instead of giving it a name that describes what it contains.
In my opinion that is a bad choice, because it might be that you have multiple variables with the same name "variable" - have you checked for that? That you might possible have confused different variables with different contents?
and sorry, my post above was abbreviated due to internet error, I wanted to write more but that part has been handled in other posts above.

No sorry, however it was a name I put there just for the example in the screenshot.
I "fixed" this problem with the following method and it works for me.
Maybe something happens if the param value tries to go negative(?), idk...
That said, I can't understand if this is a real bug or something, I don't have enough knowledge for that.
If it is MV's fault I guess you can replicate it, if not maybe it is a plugin of mine(?).......
Thanks however
Let's say my actor's atk = 500
Ok.
How is it possibile, then, that if I do Atk -9999 +300(variable value) -1 = 1??? Shouldn't it be 300?

500 - 9999 = 1 (as you said)
1 + 300 = 301
301 - 1 = 300 (my variable value)

There is something I can't understand since for MV the result is 1 instead of 300
  1. Actor's ATK = 500 = (base + plus) * rate
    But what is the current value of plus here?
    Let's assume rate is 1, i.e. no traits like ATK * 150%.
    => Actor's ATK = base + plus = 500.

  2. Change Parameter: ATK -9999
    Now plus is 9999 less than in step 1.
    So Actor's ATK = base + (plus - 9999) = 500 - 9999 = -9499
    => Actor's ATK = 1 (minimum value)

  3. Change Parameter ATK +300
    Now plus is 300 more than in step 2.
    So Actor's ATK = base + (plus - 9999 + 300) = -9499 + 300 = -9199
    => Actor's ATK = 1 (minimum value)
This is why you had to subtract the current attack for it to work as you wanted. 🙂
  1. Actor's ATK = 500 = (base + plus) * rate
    But what is the current value of plus here?
    Let's assume rate is 1, i.e. no traits like ATK * 150%.
    => Actor's ATK = base + plus = 500.

  2. Change Parameter: ATK -9999
    Now plus is 9999 less than in step 1.
    So Actor's ATK = base + (plus - 9999) = 500 - 9999 = -9499
    => Actor's ATK = 1 (minimum value)

  3. Change Parameter ATK +300
    Now plus is 300 more than in step 2.
    So Actor's ATK = base + (plus - 9999 + 300) = -9499 + 300 = -9199
    => Actor's ATK = 1 (minimum value)
This is why you had to subtract the current attack for it to work as you wanted. 🙂

Oh! Thank you 😍

Original thread: https://forums.rpgmakerweb.com/threads/cant-update-params.129631/