Main Menu
  • Welcome to The RPG Maker Resource Kit.

Learn Skill Sound Effect

Started by modern algebra, September 03, 2009, 08:17:27 PM

0 Members and 1 Guest are viewing this topic.

modern algebra

Learn Skill Sound Effect
Version: 1.0
Author: modern algebra
Date: September 3, 2009

Version History




  • <Version 1.0> 09.03.2009 - Original Release

Description



This script will play an SE when levelling if the actor has learned any new skills.

Features


  • Plays an SE of your choice when an actor learns a skill upon levelling up

Instructions

Place this script above Main and below Materials. If you wish to change the SE that plays, scroll down to line 30 and read the instructions located there.

Script



#==============================================================================
#    Learn Skill Sound Effect
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: September 3, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    
#    This script will play an SE when levelling if the actor has learned any
#   new skills.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below Materials.
#
#    If you wish to change the SE that plays, scroll down to line 30 and read
#   the instructions located there.
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constant - LSSE_LEARN_SKILL_SE
#    aliased method - display_level_up
#==============================================================================

class Game_Actor
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Class Constants
 #``````````````````````````````````````````````````````````````````````````
 #  LSSE_LEARN_SKILL_SE - an array holding the name, volume, and pitch of
 # the SE to be played when learning a new skill through level up. The
 # format is:
 #
 #      ["se_name", se_volume, se_pitch]
 #          se_name : the name of the file to be played. This must be there.
 #          se_volume : the volume of the SE to be played. If left blank, it
 #            defaults to 100
 #          se_pitch : the pitch of the SE to be played. If left blank, it
 #            defaults to 100
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 LSSE_LEARN_SKILL_SE = ["Up", 80]
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Show Level Up Message
 #     new_skills : Array of newly learned skills
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias malgb_zero_se_skilllearn_lvlup_8kb3 display_level_up
 def display_level_up(new_skills, *args)
   # Play SE unless no new skills passed
   RPG::SE.new (*LSSE_LEARN_SKILL_SE).play unless new_skills.empty?
   # Run Original Method
   malgb_zero_se_skilllearn_lvlup_8kb3 (new_skills, *args)
 end
end


Credit




  • modern algebra

Thanks


  • Zero2008, for the request

Support



Please post here with suggestions or bug reports.

Known Compatibility Issues

No known compatibility issues

Author's Notes



Kind of minor and useless, but easy and a request, so I figured I'd share. No credit is necessary.




SuperMega

Very cool, and yet simple script!  I've seen a bunch of requests for something like this lately!

EDIT: Hehe, I posted 15 miliseconds before Zero2008.

Zero2008

Thanks man! I've been wanting this script for a long time.
But is it possible to put a little bit of wait time before playing the SE?

modern algebra

It can be done pretty easily if you are willing to use Zeriab's Scheduler.

Make sure that you include the part that binds it to Graphics.update. Once you do that, then replacing the script with the following code will allow you to set the delay for as long as you like:

[spoiler]
#==============================================================================
#    Learn Skill Sound Effect
#    Version: 1.0
#    Author: modern algebra
#    Date: September 3, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#   
#    This script will play an SE when levelling if the actor has learned any
#   new skills.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below Materials.
#
#    If you wish to change the SE that plays, scroll down to line 30 and read
#   the instructions located there.
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constant - LSSE_LEARN_SKILL_SE
#    aliased method - display_level_up
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Class Constants
  #``````````````````````````````````````````````````````````````````````````
  #  LSSE_LEARN_SKILL_SE - an array holding the name, volume, and pitch of
  # the SE to be played when learning a new skill through level up. The
  # format is:
  #
  #      ["se_name", se_volume, se_pitch]
  #          se_name : the name of the file to be played. This must be there.
  #          se_volume : the volume of the SE to be played. If left blank, it
  #            defaults to 100
  #          se_pitch : the pitch of the SE to be played. If left blank, it
  #            defaults to 100
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  LSSE_LEARN_SKILL_SE = ["Up", 80]
  LSSE_SE_DELAY = 30 # Time, in frames, to wait before playing SE
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Show Level Up Message
  #     new_skills : Array of newly learned skills
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgb_zero_se_skilllearn_lvlup_8kb3 display_level_up
  def display_level_up(new_skills, *args)
    # Play SE unless no new skills passed
    proc = Proc.new {RPG::SE.new (*LSSE_LEARN_SKILL_SE).play}
    Scheduler.schedule (LSSE_SE_DELAY, proc) unless new_skills.empty?
    # Run Original Method
    malgb_zero_se_skilllearn_lvlup_8kb3 (new_skills, *args)
  end
end
[/spoiler]