Technical404

Technical Error
Member
Joined
Apr 8, 2023
Messages
23
Reaction score
1
First Language
Portuguese
Primarily Uses
RMVXA
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)
 

contentdeleted

Regular
Regular
Joined
Jul 19, 2022
Messages
100
Reaction score
82
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

Dev_With_Coffee

Regular
Regular
Joined
Jul 20, 2020
Messages
1,063
Reaction score
553
First Language
PT-BR
Primarily Uses
RM2k3
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
 

kyonides

Reforged is laughable
Regular
Joined
Nov 17, 2019
Messages
1,931
Reaction score
983
First Language
English
Primarily Uses
RMXP
Try this scriptlet without any guarantee! :p

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
 

Technical404

Technical Error
Member
Joined
Apr 8, 2023
Messages
23
Reaction score
1
First Language
Portuguese
Primarily Uses
RMVXA
Im gonna try it out, thanks guys!
 

Milennin

"With a bang and a boom!"
Regular
Joined
Feb 7, 2013
Messages
3,275
Reaction score
2,672
First Language
English
Primarily Uses
RMMV
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.
 

kyonides

Reforged is laughable
Regular
Joined
Nov 17, 2019
Messages
1,931
Reaction score
983
First Language
English
Primarily Uses
RMXP
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!
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Alternative plugins for YEP Weapon Animation is
20/59 maps with the door fix in place. Also knocked a few other bugs out (mostly related to having two banks of the same # too close to each other). Also tweaked the one-way doors slightly so they close with the knobless sprite.
Enemy_MariXimas[Idle].gif
Everyone's getting ready. Mary, in particular, is really mad, why tho?
Well, I've officially filed a complaint against my coworker.
Legit almost killed me twice today.
First time, he was holding a freaking knife straight out and walking down a hallway. I rounded a corner and barely missed it.
Second time, he "handed"(dropped) me a bucket of water while I was trying to adjust the broaster. Not exactly sure what would happen, but water and boiling oil usually don't go well together.

Forum statistics

Threads
136,864
Messages
1,270,855
Members
180,631
Latest member
Kapu
Top