Kread-EX Glimmer script smoool modification

Simply put, this script adds to the game the ability to learn new skills randomly and when this happens it displays a message in battle (well, like in the Saga series of games).

It seems to me that in addition to the message, it is worth turning on some kind of sound when the skill is learned (well, like in the Saga series of games). So this is my little request.

Here is the script https://github.com/Archeia/RMVXA-Sc...ad-Ex/RGSS3 Scripts/Battle Scripts/Glimmer.rb
Coded for SE sounds
In the note tags add on <sound: name of file>

<glimmer: 1>
<ID: 14, 15>
<%: 100, 40>
<sparkers: 1, 8>
<sound: barrier>
</glimmer>

Ruby:
module KRX

    module REGEXP
        GLIMMER_SOUND = /<sound:[ ](\w+(?:[, ]*\w*)*)>/i
  end
end

#===========================================================================
# ■ Game_Enemy
#===========================================================================

class Game_Enemy < Game_Battler
    #--------------------------------------------------------------------------
    # ● Loads the note tags
    #--------------------------------------------------------------------------
    def load_glimmer_notetags
        actor = nil
        write_glimmer = false
        enemy.note.split(/[\r\n]+/).each do |line|
            case line
            when KRX::REGEXP::GLIMMER_START
                @glimmer_data[$1.to_i] = [[], [], []]
                actor = $1.to_i
                write_glimmer = true
            when KRX::REGEXP::GLIMMER_END
                write_glimmer = false
            when KRX::REGEXP::GLIMMER_IDS
                if write_glimmer
                    $1.scan(/\d+/).each do |i|
                        @glimmer_data[actor][0].push(i.to_i)
                    end
                end
            when KRX::REGEXP::GLIMMER_PER
                if write_glimmer
                    $1.scan(/\d+/).each do |i|
                        @glimmer_data[actor][1].push(i.to_i)
                    end
                end
            when KRX::REGEXP::GLIMMER_SPARKERS
                if write_glimmer
                    $1.scan(/\d+/).each do |i|
                        @glimmer_data[actor][2].push(i.to_i)
                    end
                end
            when KRX::REGEXP::GLIMMER_SOUND
                @glimmer_data[actor][3] = $1.to_s
            end
        end
    end
    #--------------------------------------------------------------------------
    # ● Returns the skills that can spark a glimmer
    #--------------------------------------------------------------------------
    def glimmer_sound(key)
        @glimmer_data[key][3]
    end
end

#===========================================================================
# ■ Scene_Battle
#===========================================================================

class Scene_Battle < Scene_Base
    #--------------------------------------------------------------------------
    # ● Checks for a glimmer and performs it if any
    #--------------------------------------------------------------------------
    def glimmer_effect
        item = @subject.current_action.item
        return unless item
        targets = @subject.current_action.make_targets.compact
        targets.delete_if do |target|
            !target.is_a?(Game_Enemy) ||
            !target.glimmer_ok? ||
            !target.glimmer_actors.include?(@subject.id) ||
            !target.glimmer_sparkers(@subject.id).include?(item.id) ||
            target.glimmer_useless?(@subject.id)
        end
        return if targets.nil? || targets.empty?
        target = targets[rand(targets.size)]
        target.glimmers(@subject.id).each do |id|
            next if @subject.skill_learn?($data_skills[id])
            if (rand(100) + 1) < target.glimmer_chance(@subject.id, id)
                @log_window.add_text(KRX::VOCAB::GLIMMER_TEXT)
                @subject.current_action.set_skill(id)
                @subject.learn_skill(id)
                RPG::SE.new(target.glimmer_sound(@subject.id)).play if
                  target.glimmer_sound(@subject.id) != nil
                return
            end
        end
    end
end
everything works perfectly! thank you!

Original thread: https://forums.rpgmakerweb.com/threads/kread-ex-glimmer-script-smoool-modification.169953/