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.

Protect Script help.

Aufeis

Member

Okay, i was using a script I found on this site and had adapted it to my game. It ran smoothly in a test-battle, but as soon as I tried to actually play test the game, it gave me an error. Then, when I tried to test-battle again, it would not work, giving me the same error. Am I stupid and missing something obvious, or is there something wrong with the script?

Original Topic: http://www.rmxp.org/forums/index.php?topic=7226.0


Error:
http://img399.imageshack.us/img399/1583/errorgd4.jpg[/img]

The only thing I changed was the name "protector" to "paladin"?

Help, Please?
 
Yes, that's an XP Script.
Also, don't forget that script support topics goes in the RGSS Support forum, not script request. ;)

To make Seph script work, you'll have to change a couple of things.

First of all, at line 14 and 34, you'll find this
Code:
$game_party.actors.each do |actor|
Change these lines for
Code:
$game_party.members.each do |actor|

Next, at line 18 and 38, you'll find this
Code:
actor.damage_pop = true
Simply remove that or put an # in front of the line to comment it.

Finally, change this
Code:
class Scene_Battle
  alias seph_protector_scnbtl_sp2 start_phase2
  def start_phase2
    $game_party.actors.each do |actor|
      actor.protector = false
      actor.protected = false
    end
    seph_protector_scnbtl_sp2
  end
end
for that
Code:
class Scene_Battle < Scene_Base
  alias seph_protector_scnbtl_sp2 start_party_command_selection
  def start_party_command_selection
    $game_party.members.each do |actor|
      actor.protector = false
      actor.protected = false
    end
    seph_protector_scnbtl_sp2
  end
end

I can't test it because I'm at work, but it whould do the trick.
Hope it helps!

-Dargor
 

Aufeis

Member

Okay, the old problem is gone now and it will run the game fine until I try to use the skill in battle. Then it gives me this.
http://img53.imageshack.us/img53/4694/errored5.jpg[/img]

This is what the code looks like now, I think I edited everything correctly. I triple checked.

Code:
class Game_Battler
  Protect_Skill_ID = 141
  attr_accessor :protected
  attr_accessor :paladin
  alias seph_protector_gmbtlr_ae attack_effect
  alias seph_protector_gmbtlr_se skill_effect
  def attack_effect(attacker)
    seph_protector_gmbtlr_ae(attacker)
    if self.protected
      return unless self.damage > 0
      damage = self.damage
      self.hp += self.damage
      self.damage = nil
      $game_party.members.each do |actor|
        if actor.paladin
          actor.damage = damage
          actor.hp -= damage
        end
      end
    end
  end
  def skill_effect(user, skill)
    seph_protector_gmbtlr_se(user, skill)
    if skill.id == Protect_Skill_ID
      user.paladin = true
      self.protected = true
    end
    if self.protected
      return unless self.damage > 0
      damage = self.damage
      self.hp += self.damage
      self.damage = nil
      $game_party.members.each do |actor|
        if actor.paladin
          actor.damage = damage
          actor.hp -= damage
        end
      end
    end
  end
end

class Scene_Battle < Scene_Base
  alias seph_protector_scnbtl_sp2 start_party_command_selection
  def start_party_command_selection
    $game_party.members.each do |actor|
      actor.paladin = false
      actor.protected = false
    end
    seph_protector_scnbtl_sp2
  end
end

Also, how would I move the topic? I'll put it where it is supposed to be. Sorry for being a noob at scripting.
 
Your topic is in the right place. And only Mods and admins can move topics.

Add attr_accessor :hp_damage right below Protect_Skill_ID = 141 and try changing every self.damage for @hp_damage.
 

Aufeis

Member

Okay, so I declared the damage entity, and it worked this morning. I came back after the day was over and tried to test battle. Now I'm getting a syntax error on this line...


Code:
class Game_Battler
  def damage
 ******* Protect_Skill_ID = 141 ************
  attr_accessor :hp_damage
  attr_accessor :protected
  attr_accessor :paladin
  alias seph_protector_gmbtlr_ae attack_effect
  alias seph_protector_gmbtlr_se skill_effect
  def attack_effect(attacker)
    seph_protector_gmbtlr_ae(attacker)
    if self.protected
      return unless @hp_damage > 0
      damage = @hp_damage
      self.hp += @hp_damage
      @hp_damage = nil
      $game_party.members.each do |actor|
        if actor.paladin
          actor.damage = damage
          actor.hp -= damage
        end
      end
    end
  end
  def skill_effect(user, skill)
    seph_protector_gmbtlr_se(user, skill)
    if skill.id == Protect_Skill_ID
      user.paladin = true
      self.protected = true
    end
      if self.protected
      return unless @hp_damage > 0
      damage = @hp_damage
      self.hp += @hp_damage
      @hp_damage = nil
      $game_party.members.each do |actor|
        if actor.paladin
          actor.damage = damage
          actor.hp -= damage
        end
      end
    end
  end
end

class Scene_Battle < Scene_Base
  alias seph_protector_scnbtl_sp2 start_party_command_selection
  def start_party_command_selection
    $game_party.members.each do |actor|
      actor.paladin = false
      actor.protected = false
    end
    seph_protector_scnbtl_sp2
  end
end

I don't understand what the error is. It used to work but now.....
 

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