RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RGSS3] Log Horizon Experience Pot System Script

0 Members and 1 Guest are viewing this topic.

*
Scripter
Rep:
Level 40
Crownless King
[RGSS3] Log Horizon Experience Pot System Script
Version: 1
Author: SoulPour777

Description


This script enables the party members lower than Level 30 to gain experience pots, an item that gives them boost on experience and fighting abilities. This is a script based on a system mentioned from the Japanese Animation Log Horizon.

Features

  • Experience Gain through Items
  • HP Regen
  • MP Regen
  • TP Regen

Instructions

Instructions:
- Place the script below Materials above Main.

Usage:

On your Items in the database, place this note tag on the item:

<ExpPot: n>

n means the value of the experience you will give to your item user.

Example:

<ExpPot: 1000>

This means that when your item user uses that item, he or she will gain 1000 experience.

According to Log Horizon, it says that not only would the player gain experience but also battle enhancements, so I added some HP, MP and TP regen as well for the item.



Script


Code: [Select]
=begin
#==============================================================================
# Log Horizon - Experience Pot System Script
# Author: SoulPour777
** Web URL: infinitytears.wordpress.com

#------------------------------------------------------------------------------
# Description: This script enables the party members lower than Level 30 to
# gain experience pots, an item that gives them boost on experience and
# fighting abilities. This is a script based on a system mentioned from the
# anime Log Horizon.

Instructions:
 - Place the script below Materials above Main.
 
Usage:

On your Items in the database, place this note tag on the item:

<ExpPot: n>

n means the value of the experience you will give to your item user.

Example:

<ExpPot: 1000>

This means that when your item user uses that item, he or she will gain 1000
experience.

According to the Log Horizon anime, it says that not only would the player
gain experience but also battle enhancements, so I added some HP, MP and TP
regen as well for the item.

How to Set Up the Item Correctly:

- Make sure to remove the On Use Effect on the item. This is because the item
won't be used whenever you place anything on it.

Terms of Use:
 - Preserve the Script Banner.
 - Credit SoulPour777 for the script.
 - You are allowed to share this script in a community, as long as SoulPour777
 remains the author of the script.
 - Don't claim this script as your own.
 - You are free to modify the script, but credits is necessary.
#==============================================================================
=end

module LHExperiencePot
  # Experience Pot Variables
  # -------------------------------------
  EXP_POT_SE = "Item3"
  EXP_POT_SE_PITCH = 100
  EXP_POT_SE_VOL = 100
  EXP_POT_ITEM_ID = 1
  EXP_POT_ITEM_AMOUNT = 1
  # -------------------------------------
 
  def experience_pot_activate
    experience_pot
  end
 
  # -------------------------------------
  # This performs the action for the experience pot
  # -------------------------------------
  def experience_pot_action
    RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    $game_party.members.each do |actor|
      if actor.level <= 30
        $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
      end
    end
  end
 
end

class Game_Actor < Game_Battler
 
  # we have to include the LHExperiencePot module to have our other methods
  # working in place.
  include LHExperiencePot
  #------------------------------------------------------------------------#
  # New Level Up Method
  # **this contains the experience pot. Everytime the level of an actor
  # is below level 30, an experience pot item comes.
  # -----------------------------------------------------------------------#
 
  alias experience_pot_and_level_up level_up
  def level_up
    experience_pot
    @level += 1
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end 
 
  def experience_pot
    experience_pot_action
  end
 
  alias exp_pot_game_actor_item_apply        item_apply
  alias exp_pot_game_actor_item_test        item_test
 
  #--------------------------------------------------------------------------
  # * Aliased Method: Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(*args)
    item = args[1]                                            # Get Item from arguments
    if item.is_a?(RPG::Item)                                  # Since this method is used for both Item & Skills, check to make sure the Item is actually an Item
      if $data_items[item.id].note =~ /<ExpPot:\s?(\d+)>/i   # Only the Data_Item contains the notetag, not the item itself. So  use the item id to get the database item and then check the notetag against the Regex. If matched, continue.
        new_exp = self.exp + $1.to_i                          # Get New Experience Points   
        self.change_exp(new_exp, false)                       # Gain Exp, simple as that.
        self.add_state(14) #HP Regen
        self.add_state(15) #MP Regen
        self.add_state(16) #TP Regen
      end
    end
    exp_pot_game_actor_item_apply(*args)                   # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Aliased Method: Test Skill/Item Application
  #--------------------------------------------------------------------------
  def item_test(*args)
    return true if $data_items[args[1].id].note =~ /<ExpPot:\s?(\d+)>/i  # Allow Item to be used no matter what if it contains this notetag
    return exp_pot_game_actor_item_test(*args)                        # Otherwise Call Original Method
  end
 
end

Credit


  • SoulPour777
  • DP3 - For the big help of note tag reading for item usage.

Thanks

  • Log Horizon
  • DP3

Support


If any questions, suggestions or script conflicts about this script, please don't hesitate to mail me on my website or PM me here at RMRK. I will answer you as soon as I get your message.

Known Compatibility Issues

- None

Author's Notes


Being inspired with the Japanese Animation Log Horizon, I was able to make this script.

Terms of Use


- Preserve the Script Banner.
- Credit SoulPour777 for the script.
- You are allowed to share this script in a community, as long as SoulPour777
remains the author of the script.
- Don’t claim this script as your own.
- You are free to modify the script, but credits is necessary.


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
Rep:
Level 52
RMRK Junior
"According to Log Horizon, it says that not only would the player gain experience but also battle enhancements, so I added some HP, MP and TP regen as well for the item."

You are also re-writing the level_up method to play new sounds, it also gives a lot of limits to the developer. Seeing as how I just wrote this script, you should check out how I did it there's a lot more options. V's Item Experience
Spoiler for "More About Vindaca":

Spoiler for "General Prices":
You can also build packages containing multiple resources. (Package prices are not included.)


Music

Basic Songs = $20 - $50 USD
Advanced Songs = $100+


Graphics
32 x 32, 4 Directional Sprite = $7 USD each / $50 USD per sheet
64 x 32, 4 Directional Sprite = $10 USD each / $60 USD per sheet
Backgrounds = $10 - $40 USD
Tilesets = $5 each / $20 - $50 USD per group
(depending on types of tilesets)
Iconset = $5 each / $35 - $80 if buying more then 10
(depending on quantity)
Windowskins = $7 each


Animations
Titles = $20+ USD (Depending on complexity)
Backgrounds= $20+ USD (Depending on complexity)
Regular Evented Scenes = $40+ USD each (Depending on complexity)
Parallax Scenes = $60+ USD each (Depending on complexity)
CG  = $300+ USD (Depending on complexity)
Maps

Basic Map Design = $7 USD each
Advanced Map Design = $10+ USD (Depending on complexity)
Scripts

Basic Custom Menu Script = $60 - $100 USD
More Advanced Menu Script = $120 - $300 USD (Animated, ext.)
Mini-games = $100 - $300 USD (Depending on complexity)
I am willing to build a custom card game if specifications are given Commissioned out E.T.A. 3 - 6 months
Battle Systems = $100 - $300 USD (Depending on complexity) Commissioned out E.T.A. 3 - 6 months
Others Scripts = $80 - $300 USD (Depending on complexity)

We are also willing to build games for you with as little or as much direction as you want. (Prices vary depending on complexity of game)
If you want to use your resources in multiple titles there is an additional charge of half the cost of the resource. (Prices vary depending on packages)
I require half of the total cost of any projects up front and the other half before completion.
If a project is finished and not picked up within 1 month of notification,
your resources will be resold and no money will be refunded.


*
Scripter
Rep:
Level 40
Crownless King
I based the limitation of the script and what it actually does on Log Horizon. I might check up removing the rename for the using of item, but since LH only gives regen and exp boost, that's how it is.  ^-^


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
I thought this thread was going to be about marijuana....

I'm sure the script makes things much easier, but couldn't this be done with common events instead?

(Making the point for non-scripters)
:tinysmile:

*
Rep:
Level 52
RMRK Junior
@Evilmoos~

 Yes it can, but it is not always easy to find the people that are using items/ targets(for non-scripters). The purpose of the script is to make it easier on the developer.

@SoulPour777~

First of let me say this. Sorry for the abrupt welcoming. It's really nice to see other programmers here, it has been a while since anyone else has put up a new script. With that said nice job putting out so many too. I hope I don't come off as a jerk, I am only trying to help out.

My only point was that yes you based it on the limitation of a game, but you still gave options to change aspects of the system. Even to the point of controlling how many the player get when they receive the item. If you are going to go that far, you should have just made it limitless(in a sense). This script could have been used for more then just 1 item and lots of different features easily. And your Level_up sound mesh can be a whole new script all together.

A few tips to shorten the script more too. These two methods can be combined. The first one is not needed at all and is just taking up bytes.
Code: [Select]

  def experience_pot_activate
    experience_pot
  end
 
  def experience_pot_action
    RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    $game_party.members.each do |actor|
      if actor.level <= 30
        $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
      end
    end
  end


Like so...
Code: [Select]

  def experience_pot_activate
     RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    $game_party.members.each do |actor|
      if actor.level <= 30
        $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
      end
    end
  end

 

This will save you from having to rewrite more of the script.
You should also make the Item gain at level up optional and maybe an option to change the level they stop being received.

Side note~

Some advice as a fellow programmer take it or leave it. Don't create so many limits on something easy like that. Let the developer create there own limits for there own game and it could be used by a lot more people.

It is ok to be inspired by a game, but you should always try to be better then not equal too.
Spoiler for "More About Vindaca":

Spoiler for "General Prices":
You can also build packages containing multiple resources. (Package prices are not included.)


Music

Basic Songs = $20 - $50 USD
Advanced Songs = $100+


Graphics
32 x 32, 4 Directional Sprite = $7 USD each / $50 USD per sheet
64 x 32, 4 Directional Sprite = $10 USD each / $60 USD per sheet
Backgrounds = $10 - $40 USD
Tilesets = $5 each / $20 - $50 USD per group
(depending on types of tilesets)
Iconset = $5 each / $35 - $80 if buying more then 10
(depending on quantity)
Windowskins = $7 each


Animations
Titles = $20+ USD (Depending on complexity)
Backgrounds= $20+ USD (Depending on complexity)
Regular Evented Scenes = $40+ USD each (Depending on complexity)
Parallax Scenes = $60+ USD each (Depending on complexity)
CG  = $300+ USD (Depending on complexity)
Maps

Basic Map Design = $7 USD each
Advanced Map Design = $10+ USD (Depending on complexity)
Scripts

Basic Custom Menu Script = $60 - $100 USD
More Advanced Menu Script = $120 - $300 USD (Animated, ext.)
Mini-games = $100 - $300 USD (Depending on complexity)
I am willing to build a custom card game if specifications are given Commissioned out E.T.A. 3 - 6 months
Battle Systems = $100 - $300 USD (Depending on complexity) Commissioned out E.T.A. 3 - 6 months
Others Scripts = $80 - $300 USD (Depending on complexity)

We are also willing to build games for you with as little or as much direction as you want. (Prices vary depending on complexity of game)
If you want to use your resources in multiple titles there is an additional charge of half the cost of the resource. (Prices vary depending on packages)
I require half of the total cost of any projects up front and the other half before completion.
If a project is finished and not picked up within 1 month of notification,
your resources will be resold and no money will be refunded.


*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
I agree with Vindaca

This is something you should leave for the user:
Code: [Select]
if actor.level <= 30
  $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
end


instead could be:
Code: [Select]
if actor.level <= User_Define_Level
  $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
end
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Scripter
Rep:
Level 40
Crownless King
I did it as a global variable, so you can change it anytime. Please do tell me if version 2 is much better:

Spoiler for:

Code: [Select]
=begin
#==============================================================================
# Log Horizon - Experience Pot System Script
# Author: SoulPour777
** Web URL: infinitytears.wordpress.com

#------------------------------------------------------------------------------
# Description: This script enables the party members lower than Level 30 to
# gain experience pots, an item that gives them boost on experience and
# fighting abilities. This is a script based on a system mentioned from the
# anime Log Horizon.

Instructions:
 - Place the script below Materials above Main.
 
Usage:

On your Items in the database, place this note tag on the item:

<ExpPot: n>

n means the value of the experience you will give to your item user.

Example:

<ExpPot: 1000>

This means that when your item user uses that item, he or she will gain 1000
experience.

According to the Log Horizon anime, it says that not only would the player
gain experience but also battle enhancements, so I added some HP, MP and TP
regen as well for the item.

How to Set Up the Item Correctly:

- Make sure to remove the On Use Effect on the item. This is because the item
won't be used whenever you place anything on it.

Terms of Use:
 - Preserve the Script Banner.
 - Credit SoulPour777 for the script.
 - You are allowed to share this script in a community, as long as SoulPour777
 remains the author of the script.
 - Don't claim this script as your own.
 - You are free to modify the script, but credits is necessary.
#==============================================================================
=end

module LHExperiencePot
  # Experience Pot Variables
  # -------------------------------------
  EXP_POT_SE = "Item3"
  EXP_POT_SE_PITCH = 100
  EXP_POT_SE_VOL = 100
  EXP_POT_ITEM_ID = 1
  EXP_POT_ITEM_AMOUNT = 1
  $exp_pt_level_max = 30
  # -------------------------------------
 
end

class Game_Actor < Game_Battler
 
  # we have to include the LHExperiencePot module to have our other methods
  # working in place.
  include LHExperiencePot
  #------------------------------------------------------------------------#
  # New Level Up Method
  # **this contains the experience pot. Everytime the level of an actor
  # is below level 30, an experience pot item comes.
  # -----------------------------------------------------------------------#
 
  alias experience_pot_and_level_up level_up
  def level_up
     RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    $game_party.members.each do |actor|
      if actor.level <= $exp_pt_level_max
        $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
      end
    end
    @level += 1
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end 
 
  alias exp_pot_game_actor_item_apply        item_apply
  alias exp_pot_game_actor_item_test        item_test
 
  #--------------------------------------------------------------------------
  # * Aliased Method: Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(*args)
    item = args[1]                                            # Get Item from arguments
    if item.is_a?(RPG::Item)                                  # Since this method is used for both Item & Skills, check to make sure the Item is actually an Item
      if $data_items[item.id].note =~ /<ExpPot:\s?(\d+)>/i   # Only the Data_Item contains the notetag, not the item itself. So  use the item id to get the database item and then check the notetag against the Regex. If matched, continue.
        new_exp = self.exp + $1.to_i                          # Get New Experience Points   
        self.change_exp(new_exp, false)                       # Gain Exp, simple as that.
        self.add_state(14) #HP Regen
        self.add_state(15) #MP Regen
        self.add_state(16) #TP Regen
      end
    end
    exp_pot_game_actor_item_apply(*args)                   # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Aliased Method: Test Skill/Item Application
  #--------------------------------------------------------------------------
  def item_test(*args)
    return true if $data_items[args[1].id].note =~ /<ExpPot:\s?(\d+)>/i  # Allow Item to be used no matter what if it contains this notetag
    return exp_pot_game_actor_item_test(*args)                        # Otherwise Call Original Method
  end
 
end



If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
Rep:
Level 52
RMRK Junior
You should just do it like this

Code: [Select]
if actor.level <= User_Define_Level
  $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
end

$global_vars take up more space and should be used sparingly. But it's a good start.  :)
Spoiler for "More About Vindaca":

Spoiler for "General Prices":
You can also build packages containing multiple resources. (Package prices are not included.)


Music

Basic Songs = $20 - $50 USD
Advanced Songs = $100+


Graphics
32 x 32, 4 Directional Sprite = $7 USD each / $50 USD per sheet
64 x 32, 4 Directional Sprite = $10 USD each / $60 USD per sheet
Backgrounds = $10 - $40 USD
Tilesets = $5 each / $20 - $50 USD per group
(depending on types of tilesets)
Iconset = $5 each / $35 - $80 if buying more then 10
(depending on quantity)
Windowskins = $7 each


Animations
Titles = $20+ USD (Depending on complexity)
Backgrounds= $20+ USD (Depending on complexity)
Regular Evented Scenes = $40+ USD each (Depending on complexity)
Parallax Scenes = $60+ USD each (Depending on complexity)
CG  = $300+ USD (Depending on complexity)
Maps

Basic Map Design = $7 USD each
Advanced Map Design = $10+ USD (Depending on complexity)
Scripts

Basic Custom Menu Script = $60 - $100 USD
More Advanced Menu Script = $120 - $300 USD (Animated, ext.)
Mini-games = $100 - $300 USD (Depending on complexity)
I am willing to build a custom card game if specifications are given Commissioned out E.T.A. 3 - 6 months
Battle Systems = $100 - $300 USD (Depending on complexity) Commissioned out E.T.A. 3 - 6 months
Others Scripts = $80 - $300 USD (Depending on complexity)

We are also willing to build games for you with as little or as much direction as you want. (Prices vary depending on complexity of game)
If you want to use your resources in multiple titles there is an additional charge of half the cost of the resource. (Prices vary depending on packages)
I require half of the total cost of any projects up front and the other half before completion.
If a project is finished and not picked up within 1 month of notification,
your resources will be resold and no money will be refunded.


*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Since I'm here, allow me to critique the entire script.

Code: [Select]
module LHExperiencePot
  # Experience Pot Variables
  # -------------------------------------
  EXP_POT_SE = "Item3"
  EXP_POT_SE_PITCH = 100
  EXP_POT_SE_VOL = 100
  EXP_POT_ITEM_ID = 1
  EXP_POT_ITEM_AMOUNT = 1
  $exp_pt_level_max = 30
  # -------------------------------------
 
end
This all looks fine until I hit the $exp_pt_level_max variable. You've already created it inside of a module, and as far as I can tell this variable will always remain the same value throughout the entire game, so why is it a global variable instead of a Constant like the other variables?

Change it to a Constant: EXP_POT_LEVEL_MAX = 30.



Code: [Select]
class Game_Actor < Game_Battler
 
  # we have to include the LHExperiencePot module to have our other methods
  # working in place.
  include LHExperiencePot
This is not recommended. Game_Actor is a default class, by including a module like this you are opening your variable names to conflict with other scripts people may use in their games. In this case it's not very likely there will be another script in a project with the variable name: EXP_POT_SE. However you still need to take that into consideration

Allow me to elaborate
Code: [Select]
module Module1
  SoundName = "Battle1"
end

module Module2
  SoundName = "Battle2"
end


class Game_System
  include Module1
  include Module2

  def play_sound
    RPG::BGM.new(SoundName, 100, 100).play    # Inconsistency, SoundName has been defined twice, so the one you want to hear may not be heard.
  end
end


Alternatively you may use it like this instead:
Code: [Select]
module Module1
  SoundName = "Battle1"
end

module Module2
  SoundName = "Battle2"
end


class Game_System
  def play_sound
    RPG::BGM.new(Module1::SoundName, 100, 100).play # Now the Compiler knows which variable you actually meant
  end
end



You can feel free to use include when using your own custom class, but I recommend you avoid it when dealing with any default classes.



Code: [Select]
alias experience_pot_and_level_up level_up
  def level_up
     RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    $game_party.members.each do |actor|
      if actor.level <= $exp_pt_level_max
        $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
      end
    end
    @level += 1
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end 

You have not actually used the alias properly here. You've instead overwritten the method completely.

Fixed:
Code: [Select]
alias experience_pot_and_level_up level_up
  def level_up
    RPG::SE.new(EXP_POT_SE, EXP_POT_SE_VOL, EXP_POT_SE_PITCH).play
    if actor.level <= $exp_pt_level_max
      $game_party.gain_item($data_items[EXP_POT_ITEM_ID], EXP_POT_ITEM_AMOUNT) # ID of the Exp. Item
    end
    experience_pot_and_level_up # Call Original Method
  end 



Code: [Select]
  alias exp_pot_game_actor_item_apply        item_apply
  alias exp_pot_game_actor_item_test        item_test
 
  #--------------------------------------------------------------------------
  # * Aliased Method: Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(*args)
    item = args[1]                                            # Get Item from arguments
    if item.is_a?(RPG::Item)                                  # Since this method is used for both Item & Skills, check to make sure the Item is actually an Item
      if $data_items[item.id].note =~ /<ExpPot:\s?(\d+)>/i   # Only the Data_Item contains the notetag, not the item itself. So  use the item id to get the database item and then check the notetag against the Regex. If matched, continue.
        new_exp = self.exp + $1.to_i                          # Get New Experience Points 
        self.change_exp(new_exp, false)                       # Gain Exp, simple as that.
        self.add_state(14) #HP Regen
        self.add_state(15) #MP Regen
        self.add_state(16) #TP Regen
      end
    end
    exp_pot_game_actor_item_apply(*args)                   # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Aliased Method: Test Skill/Item Application
  #--------------------------------------------------------------------------
  def item_test(*args)
    return true if $data_items[args[1].id].note =~ /<ExpPot:\s?(\d+)>/i  # Allow Item to be used no matter what if it contains this notetag
    return exp_pot_game_actor_item_test(*args)                        # Otherwise Call Original Method
  end

Just a preferential thing, I don't mind you copying my code, but the coding style just looks inconsistent with the rest of the script; just saying.
Feel free to modify any snippets I give you in future.






So, with that said, here's how I would have written the script.
Spoiler for:
Code: [Select]
=begin
#==============================================================================
# Log Horizon - Experience Pot System Script
# Author: SoulPour777
** Web URL: infinitytears.wordpress.com

#------------------------------------------------------------------------------
# Description: This script enables the party members lower than Level 30 to
# gain experience pots, an item that gives them boost on experience and
# fighting abilities. This is a script based on a system mentioned from the
# MLP fetish porn Log Horizon.

Instructions:
 - Place the script below Materials above Main.
 
Usage:

On your Items in the database, place this note tag on the item:

<ExpPot: n>

n means the value of the experience you will give to your item user.

Example:

<ExpPot: 1000>

This means that when your item user uses that item, he or she will gain 1000
experience.

According to the Log Horizon MLP fetish porn, it says that not only would the player
gain experience but also battle enhancements, so I added some HP, MP and TP
regen as well for the item.

How to Set Up the Item Correctly:

- Make sure to remove the On Use Effect on the item. This is because the item
won't be used whenever you place anything on it.

Terms of Use:
 - Preserve the Script Banner.
 - Credit SoulPour777 for the script.
 - You are allowed to share this script in a community, as long as SoulPour777
 remains the author of the script.
 - Don't claim this script as your own.
 - You are free to modify the script, but credits is necessary.
#==============================================================================
=end

module LHExperiencePot
  #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  #                 Editable Region        ////            ==
  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
  ItemID      = 1     # Item ID of the Exp Pot. ie Item to receive upon level up.
  Quantity    = 1     # Quantity of Said Item
  MaxLevel    = 30    # Actor's Level when they stop receiving Exp Pots
 
                # Filename, Volume, Pitch
  SoundEffect = [ "Item3",    100,   100 ]    # Sound Effect to play upon receiving EXP Pot
 
  #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  #             End Editable Region        ////            ==
  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
  Regex       = /<ExpPot:\s?(\d+)>/i
 
end




class Game_Actor < Game_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # *= Alias Listings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias sp_experience_pot_and_level_up             level_up
  alias sp_exp_pot_game_actor_item_apply           item_apply
  alias sp_exp_pot_game_actor_item_test            item_test
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: New Level Up Method
  #--------------------------------------------------------------------------
  # This contains the experience pot. Everytime the level of an actor
  # is below level 30 (Default), an experience pot item is given.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def level_up(*args)
    pot_given = false
    pot_item = $data_items[LHExperiencePot::ItemID]
    $game_party.members.each do |actor|
      if actor.level <= LHExperiencePot::MaxLevel
        pot_given = true
        $game_party.gain_item(pot_item, LHExperiencePot::Quantity)
      end
    end
    RPG::SE.new(*LHExperiencePot::SoundEffect).play   if pot_given
    sp_experience_pot_and_level_up(*args)
  end 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Apply Effect of Skill/Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_apply(*args)
    item = args[1]                                            # Get Item from arguments
    if item.is_a?(RPG::Item)                                  # Since this method is used for both Item & Skills, check to make sure the Item is actually an Item
      if $data_items[item.id].note =~ LHExperiencePot::Regex  # Only the Data_Item contains the notetag, not the item itself. So  use the item id to get the database item and then check the notetag against the Regex. If matched, continue.
        new_exp = self.exp + $1.to_i                          # Get New Experience Points 
        self.change_exp(new_exp, false)                       # Gain Exp, simple as that.
        self.add_state(14) #HP Regen
        self.add_state(15) #MP Regen
        self.add_state(16) #TP Regen
      end
    end
    sp_exp_pot_game_actor_item_apply(*args)                   # Call Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Test Skill/Item Application
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_test(*args)
    return true if $data_items[args[1].id].note =~ LHExperiencePot::Regex # Allow Item to be used no matter what if it contains this notetag
    return sp_exp_pot_game_actor_item_test(*args)                         # Otherwise Call Original Method
  end
end
« Last Edit: February 02, 2014, 12:58:05 PM by D&P3 »
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Scripter
Rep:
Level 40
Crownless King
Ohhh, that sums up what I've started. To be honest, I got that idea include from someone, and I thought doing that is easier since you don't have to call up the module name and just the functions instead. Now I know that has some conditions before doing it.

As for the alias, I seem to get something very important here. When I did my other scripts aside from this, I never called the original method.

I went ahead and aliased it without calling the original method >__<

Anyways, Vindaca and DiamondandPlatinum3, that was a nice lesson I learned from both of you. I got new things:

 - Use includes unless its not a default class
 - when you alias, call the original method
 - global variables are not to be used when inside a module


PS EDIT:

does anyone know why the word [a.n.i.m.e.] (without the square brackets and dots) is automatically changed to something different? That's why I am using the word Animation instead o.O
« Last Edit: February 02, 2014, 01:22:39 PM by SoulPour777 »


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h