Need some support with notetags

Discussion in 'Learning Ruby and RGSSx' started by Lowell, Jan 27, 2014.

  1. Lowell

    Lowell The Walking Atelier Veteran

    Messages:
    292
    Likes Received:
    68
    First Language:
    English
    I'm trying to recreate the BP System found in Romancing SaGa: Minstrel's Song and I've got this much of it working already.
     

    #========================================# Initial BP Setting#----------------------------------------# Grabs the Initial BP Value at the# start of battle and on revival.#========================================class Game_Battler < Game_BattlerBase    def init_mp     self.mp = 4 #Note Tag Goes Here    end     #------------------------    # Battle Start Alias    #------------------------    alias lowe_battle_start on_battle_start    def on_battle_start        init_mp    endendWhat I need help with at the moment is implementing Notetags that can be read from Actors, Enemies, and Items. I'm already familiar with writing the REGEXP that grabs the value (it should work according to rubular), just not too familiar with having it load in various environments.
     
    Last edited by a moderator: Jan 27, 2014
    #1
  2. IceDragon

    IceDragon Elder Cookie Dragon Veteran

    Messages:
    73
    Likes Received:
    60
    Location:
    Jamaica
    First Language:
    English
    Primarily Uses:
    N/A
    Code:
    class RPG::Actor  def initial_mp    @note =~ /<initial_mp:\s+(\d+)>/ ? $1 : 4   endend class Game_Actor  def init_mp    actor.initial_mp  endend
     
    #2
  3. Lowell

    Lowell The Walking Atelier Veteran

    Messages:
    292
    Likes Received:
    68
    First Language:
    English
    With a bit of tweaking I got it to work correctly, thanks IceDragon.

    The finish code is

    class RPG::Actor  def initial_mp    @note =~ /<initial[-_ ]?mp:\s*(\d+)\s*>/i ? $1 : 4  endendclass RPG::Enemy  def initial_mp    @note =~ /<initial[-_ ]?mp:\s*(\d+)\s*>/i ? $1 : 4  endendclass Game_Actor  def init_mp    self.mp = actor.initial_mp.to_i  endendclass Game_Enemy  def init_mp    self.mp = enemy.initial_mp.to_i  endend  class Game_Battler < Game_BattlerBase        #------------------------    # Battle Start Alias    #------------------------    alias lowe_battle_start on_battle_start    def on_battle_start        init_mp    endendThis Topic can be locked.
     
    Last edited by a moderator: Jan 27, 2014
    #3
    Zeriab likes this.

Share This Page