RNG on item help

2 question in one
-----
need help on this creating the formula RNG.
I wanna create an item that can cure any state debuff, but can only 1 state.
so for example: actor have 3 debuff states: poison, confuse, and blind. with the item, it will cure one of the states random.

the problem is how. can't use common event cause target is random(b), so can't lock to who.
Untitled.png

as you can see. rng var for limit, will keep looping till cure one state or reach the target number. (prevent infinity loop when use on actor with no debuff state)
if in formula item note, how I may ask? or with a plugin if possible.

Untitled-g.jpg

as for this, an extended one. cure 3 states.

-----
yep phys and magic.
for this one, a question. how to know if the skill use phys or magic? damage core, armor scale, lifesteal, etc.
yep plugin divide into 2 element, phys & magic. no need to talk about physical (cause even if slash, blunt, or shot, the final result are also physical. there are no other physical... are they?), but about magic.
my magic is divided into multiple elements. how to know if the element set magical?

you can ignore this. miss the hit type that available in skill/items invocation.
Untitled1.png
bump

@tyranzero , please do not bump your topic unless it has been 24 hours later since your last post. You can review our forum rules here. Thank you.


Also, in the future, please do not post 2 questions in the same thread, as these questions really belong in different forums (MV Support for the first questions, Plugin Support for the second one). But since it seems you figured the second one out, we'll leave this as is for now.

Original thread: https://forums.rpgmakerweb.com/threads/rng-on-item-help.130181/