"Roulette" type Skill

Ok, so for my game, i've been trying to do a "Roulette" type of skill that basically is wild magic, but let me explain rq: An attack with various results, that are decided at random.
I have been trying to find a good way to do that for more than 2 hours and failed miserably, is there a way of doing that but less messy?
(Sorry if im asking too many questions at the same time, lol)
EDIT: Oops my answer only works in RMMV sorry! Maybe this is helpful to someone with that version though

You could use the YEP Skill Core plugin as part of https://yanflyengineplugins.itch.io/free-starter-pack-essentials to get eval notetags in your skills and do something like this in the notetag of your rolette skill:

Code:
<After Eval>
let skills = [1,2,3];
let skill = skills[Math.floor((Math.random()*skills.length))];
BattleManager.queueForceAction(user, skill, target);
</After Eval>

This will chose a random skill from the array and cast it on the users target. Where the skills array is a list of skill ids for all your possible actions.
Hello, I'm using RMVXA in English so this will be the reference base:
  • Create a common event called "Wild" or whatever you prefer.
    Leave it in <None> mode.
  • In the list create a randomizer with variables, inside each "Conditional Branch" put a "Force Action":
    RMVXA-Skill_Randon1.png

Create a new Skill, in Effects include a new effect, select the "Common Event" option in tab 4:

RMVXA-Skill_Randon2.png
Try this scriptlet without any guarantee! 😛

Ruby:
# * Skill Roulette ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-04-10

# Stop choosing a skill on your own, let the Skill Roulette do it for you!

# Warning: The scriptlet does not include any GUI of its own at all.

# * Instructions * #

# Pick a skill in the DB and leave a note: <roulette 12 32 43>
# Actually, you can add as many numbers as needed!

module SkillRoulette
  REGEX = /<roulette (.+)>/i
  FAIL_MESSAGE = "Casting of %s skill failed miserably!"
end

class RPG::Skill
  def roulette_note
    SkillRoulette::REGEX
  end

  def skill_pool
    roulette_note
    substring = $1 || ""
    list = substring.scan(/\d+/i)
    list.map{|n_str| n_str.to_i }
  end
end

class Scene_Battle
  def find_roulette_skill_id(item)
    skills = item.skill_pool
    return if skills.empty?
    pos = rand(skills.size)
    skills[pos]
  end

  def use_roulette_skill
    item = @subject.current_action.item
    return unless item.roulette_note
    skill_id = find_roulette_skill_id(item)
    skill = $data_skills[skill_id]
    unless skill
      text = sprintf(SkillRoulette::FAIL_MESSAGE, item.name)
      @log_window.add_text(text)
      return
    end
    @subject.current_action.item = skill
    kyon_skill_roulette_scn_btl_use_item
  end

  alias :kyon_skill_roulette_scn_btl_use_item :use_item
  def use_item
    kyon_skill_roulette_scn_btl_use_item
    use_roulette_skill
  end
end
Im gonna try it out, thanks guys!
Follow the link to my ACE System in my signature. The base system lets you set up a skill like that with no problem. Just create multiples of the same skill that do different things (they should all have the same name and description so they look the same to the player), and then assign one of them to the character each turn at random.
I'm posting the following scriptlet here because I noticed that my previous attempt had a couple of bugs that I still needed to smash at once.

EDIT

I deleted my previous content because it still needed some fixing.

Here's the link to the working demo!

Original thread: https://forums.rpgmakerweb.com/threads/roulette-type-skill.156565/