Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Blue Mage

problem: if the enemy uses a skill that isn't defined as blue magic, i get an error:

Script 'Blue_Magic' line 23: NoMethodError occurred
undefined method 'include?' for nil:NilClass

I'm using the one for defending to learn the skill.
 
Hi, XD u can give me an explanation about how to show an message window tath indicate you tath learn the skil?


(I don't speak very good english, i speak better spanish XD)
 
You can try this if you want:
Code:
class Game_Actor < Game_Battler
  
  def skill_effect(user, skill)
    super(user, skill)
    if $game_party.icd_blue_mages.include?(self.id)
      unless $game_party.icd_blue_mages_all_skills == true
        if $game_party.icd_blue_mages_skills.include?(skill.id)
          self.learn_skill(skill.id)
          self.damage = self.damage.to_s + ' + Learned Skill'
        end
      else
        self.learn_skill(skill.id)
        self.damage = self.damage.to_s + ' + Learned Skill'
      end
    end
  end
  
end
 
Use this as the script:
Code:
#==============================================================================
# Individual Character Development - Blue Mage by Fomar0153
#==============================================================================
class Game_Party

  attr_accessor :icd_blue_mages
  attr_accessor :icd_blue_mages_all_skills
  attr_accessor :icd_blue_mages_skills
  
  alias fomar_icd_blue_mage_initialize initialize
  def initialize
    fomar_icd_blue_mage_initialize
    @icd_blue_mages = []
    @icd_blue_mages_all_skills = false
    @icd_blue_mages_skills = []
  end
end
class Game_Actor < Game_Battler
  
  def skill_effect(user, skill)
    super(user, skill)
    if $game_party.icd_blue_mages.include?(self.id)
      unless $game_party.icd_blue_mages_all_skills == true
        if $game_party.icd_blue_mages_skills.include?(skill.id)
          self.learn_skill(skill.id)
          self.damage = self.damage.to_s + ' + Learned Skill'
        end
      else
        self.learn_skill(skill.id)
        self.damage = self.damage.to_s + ' + Learned Skill'
      end
    end
  end
  
end
 
Ah, very cool. Thanks Fomar...

EDIT:

Hey.. I was thinking about this script, what about skills that would never touch the actor themselves? As far as healing skills and defensive skills (Pearl Wind(healing spell) and Mighty Guard(various buffs/protections) come to mind) Is there a way to make it so that the blue mage can also learn those skills another way, like viewing them? Because the way it is set up now you could only have a blue mage with offensive skills, right? =\
 
In the traditional days of RPGs confusion helped you learn those skills but now confusion makes enemies attack their allies, I may have a solution though, i'll probably do it in a bit.
 
cool thanks.

Maybe you could do something like if the enemy casts it, the blue mage has a chance to learn it, rather than make it automatic? something like

if enemy casts blue_mage_skill then... random 1~100
if random equal to or less than (percentage) then skill is learned

or something like that?
 
Here:
Code:
class Scene_Battle
  
  Advanced_Confuse = 17
  
  def make_basic_action_result
    # If attack
    if @active_battler.current_action.basic == 0
      # Set anaimation ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # If action battler is enemy
      if @active_battler.is_a?(Game_Enemy)
#        if @active_battler.restriction == 3 EDIT
        if @active_battler.restriction == 3 or @active_battler.states.include?(Advanced_Confuse)
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # If action battler is actor
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # Set array of targeted battlers
      @target_battlers = [target]
      # Apply normal attack results
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end
    # If guard
    if @active_battler.current_action.basic == 1
      # Display "Guard" in help window
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # If escape
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # Display "Escape" in help window
      @help_window.set_text("Escape", 1)
      # Escape
      @active_battler.escape
      return
    end
    # If doing nothing
    if @active_battler.current_action.basic == 3
      # Clear battler being forced into action
      $game_temp.forcing_battler = nil
      # Shift to step 1
      @phase4_step = 1
      return
    end
  end
  
  def set_target_battlers(scope)
    # If battler performing action is enemy
#    if @active_battler.is_a?(Game_Enemy) EDIT
    if @active_battler.is_a?(Game_Enemy) and (not @active_battler.states.include?(Advanced_Confuse))
      # Branch by effect scope
      case scope
      when 1  # single enemy
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 2  # all enemies
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
      when 3  # single ally
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 4  # all allies
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 5  # single ally (HP 0) 
        index = @active_battler.current_action.target_index
        enemy = $game_troop.enemies[index]
        if enemy != nil and enemy.hp0?
          @target_battlers.push(enemy)
        end
      when 6  # all allies (HP 0) 
        for enemy in $game_troop.enemies
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        end
      when 7  # user
        @target_battlers.push(@active_battler)
      end
    end
    # If battler performing action is actor
#    if @active_battler.is_a?(Game_Actor) EDIT
    if @active_battler.is_a?(Game_Actor) or @active_battler.states.include?(Advanced_Confuse)
      # Branch by effect scope
      case scope
      when 1  # single enemy
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 2  # all enemies
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 3  # single ally
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 4  # all allies
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
      when 5  # single ally (HP 0) 
        index = @active_battler.current_action.target_index
        actor = $game_party.actors[index]
        if actor != nil and actor.hp0?
          @target_battlers.push(actor)
        end
      when 6  # all allies (HP 0) 
        for actor in $game_party.actors
          if actor != nil and actor.hp0?
            @target_battlers.push(actor)
          end
        end
      when 7  # user
        @target_battlers.push(@active_battler)
      end
    end
  end
end
Just put the state you want to use for confuse and then they can use their skills when confused but they will help you still, e.g. Archangels will use Greater Heal on your team.
 
Cool, thanks a lot Fomar. I'll try this out!

EDIT: Doesn't work.. I even tried this in a fresh project with no other scripts to interfere, gives me the same message:

Script 'BlueMagePatch' line 144: SyntaxError occurred.
 

Rune

Member

Is there a way to show a message whenever someone learns a Blue Magic Skill?
i.e. Bob learned Bad Breath
 
I see you neglected to read page 3.

Fomar0153;184721 said:
Use this as the script:
Code:
#==============================================================================
# Individual Character Development - Blue Mage by Fomar0153
#==============================================================================
class Game_Party

  attr_accessor :icd_blue_mages
  attr_accessor :icd_blue_mages_all_skills
  attr_accessor :icd_blue_mages_skills
  
  alias fomar_icd_blue_mage_initialize initialize
  def initialize
    fomar_icd_blue_mage_initialize
    @icd_blue_mages = []
    @icd_blue_mages_all_skills = false
    @icd_blue_mages_skills = []
  end
end
class Game_Actor < Game_Battler
  
  def skill_effect(user, skill)
    super(user, skill)
    if $game_party.icd_blue_mages.include?(self.id)
      unless $game_party.icd_blue_mages_all_skills == true
        if $game_party.icd_blue_mages_skills.include?(skill.id)
          self.learn_skill(skill.id)
          self.damage = self.damage.to_s + ' + Learned Skill'
        end
      else
        self.learn_skill(skill.id)
        self.damage = self.damage.to_s + ' + Learned Skill'
      end
    end
  end
  
end

You can try that if you want.

@ Silencher which line is it (sorry for the delay edits don't show up as a new post)
 

Rune

Member

That just says 'Person Learned Skill'
How do I get it so it displays the name of the skill they learned instead of just 'Skill'?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top