MV WAY_EvalText - Display % Chances?

The description of the plugin states

Inside a description or message box, you can put any JavaScript Code

between ${}. It will replace that later with the result of your entered

JavaScript code.



a - references the current selected actor

p - game party

s - game switches

v - game variables

p - game party

item , skill - refers to the actual item or skill you are in.

(If you are inside the description box of skill or item)

My idea is to change how LUCK works (Using YEP_BaseParam) with effecting status effects so that it just increases the chance of landing status effects (Removing the defense part of it)

Something like user.luk / 1000 meaning you get 25% additional chance at 255 (max) Luck (I think?)

So with 0 luck a skill that has 25% chance to poison has 25%, but with 255 Luck it has 50%.

Is is possible to display a skills % chance with this or another plugin?

Like a JS code to display this as you would write a.atk to display your attack stat.

status.png
You can update your scene to calculate and display the new percentage. (RPG Maker MV used here)

Sounds like you want to get:
  • a skill's inflicted state and skill's effect value
    • By referencing the actor (actor 4 in example, taking the first skill the actor has and the skill's second effect):
      • $gameActors._data[4].skills()[0].effects[1].dataId
      • $gameActors._data[4].skills()[0].effects[1].value1
    • or by referencing the skill directly (skill 49 in example):
      • $dataSkills[49].effects[1].dataId
      • $dataSkills[49].effects[1].value1
  • and the actor's luck (actor 4 in example)
    • $gameActors._data[4].luk

Then do your calculation:
  • $gameActors._data[4].skills()[0].effects[1].value1 + $gameActors._data[4].luk / 100
1678543671513.png
You can update your scene to calculate and display the new percentage. (RPG Maker MV used here)

Sounds like you want to get:
  • a skill's inflicted state and skill's effect value
    • By referencing the actor (actor 4 in example, taking the first skill the actor has and the skill's second effect):
      • $gameActors._data[4].skills()[0].effects[1].dataId
      • $gameActors._data[4].skills()[0].effects[1].value1
    • or by referencing the skill directly (skill 49 in example):
      • $dataSkills[49].effects[1].dataId
      • $dataSkills[49].effects[1].value1
  • and the actor's luck (actor 4 in example)
    • $gameActors._data[4].luk

Then do your calculation:
  • $gameActors._data[4].skills()[0].effects[1].value1 + $gameActors._data[4].luk / 100
View attachment 255616

By update scene, do you mean adding it to rmmz.scenes.js? (Changed to MZ format ofc, I am using MZ, just using YEP with FOSSIL due to compatibility issues.) or add to a new plugin?

And will this work if the spell can be learned by any character?

Like if character 1 with 0 luck has the spell, it's 25%.
But character 2 with 255 luck, it says 50%.

(I suppose its luk / 10 for 25.5% not /1000 xD)
I haven't tested any of this, but here's my thinking:
  1. Like @TESTOSTERONE indicated, you can get the chance for an Add State effect like this:

    item.effects[0].value1
  2. If 255 LUK grants +25.5% chance, then 1 LUK grants +0.1%. Plus 100% of the default chance:

    item.effects[0].value1 * (100 + a.luk / 10)
  3. Let's round to 1 decimal place for display (multiply by 10, round to integer, divide by 10):

    Math.round(item.effects[0].value1 * (100 + a.luk / 10) * 10) / 10
  4. Then include that in the item's description, e.g.

    ${Math.round(item.effects[0].value1 * (100 + a.luk / 10) * 10) / 10}% chance to apply Slow.
Notes:
  • If the Add State effect is not the first one in the item's effects list, replace 0 in step 1 with the correct index (1 for the second effect, 2 for the third, etc).

  • This will not account for a potential target's State Rate (what target?).
I haven't tested any of this, but here's my thinking:
  1. Like @TESTOSTERONE indicated, you can get the chance for an Add State effect like this:

    item.effects[0].value1

  2. If 255 LUK grants +25.5% chance, then 1 LUK grants +0.1%. Plus 100% of the default chance:

    item.effects[0].value1 * (100 + a.luk / 10)

  3. Let's round to 1 decimal place for display (multiply by 10, round to integer, divide by 10):

    Math.round(item.effects[0].value1 * (100 + a.luk / 10) * 10) / 10

  4. Then include that in the item's description, e.g.

    ${Math.round(item.effects[0].value1 * (100 + a.luk / 10) * 10) / 10}% chance to apply Slow.

Notes:
  • If the Add State effect is not the first one in the item's effects list, replace 0 in step 1 with the correct index (1 for the second effect, 2 for the third, etc).

  • This will not account for a potential target's State Rate (what target?).

It works! It shows 25% with 0 luck and 31.4% with 255 😀

Chanceshow.png

2.55 gives it a nice round feel at 255. Doubling your chance to inflict a status should make the stat desirable I would think 😛

Thank you @caethyril and @TESTOSTERONE !
Oops, nice catch! 😊 Yea, a.luk / 2.55 is 100 at 255 LUK, for double the chance.

Good to see you figured it out, happy RPG Making! 👋

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/way_evaltext-display-chances.155706/