[Resolved][XP]Quick edit of this Healing Armor mini script

Started by Simon Greedwell, September 16, 2017, 05:10:30 pm

Previous topic - Next topic

Simon Greedwell

September 16, 2017, 05:10:30 pm Last Edit: September 16, 2017, 07:34:14 pm by Simon Greedwell
This mini script allows the creation of a weapon/shield/armor/accessory that recovers HP while walking on the map.  I'd like a edit that allows the same for SP as well as one that recovers both HP/SP. I tried to make the edit myself but it didn't quite work.  :^_^\':

#==============================================================================
    # ** [XP] Wecoc's Tips & Tricks Battle Collection
    #------------------------------------------------------------------------------
    # 78. Healing Mail
    #------------------------------------------------------------------------------
    # Armadura que por cada paso que haces por el mapa llevándola, cura un poco
    # al que la lleva y sube un poco su inteligencia
    # Nota: El personaje que la lleva tiene que estar vivo
    #==============================================================================

    class Game_Party
      alias healing_mail_steps increase_steps unless $@
      def increase_steps
        healing_mail_steps
        for actor in @actors
          next if actor.dead?
          if actor.armor3_id == 17 # ID de la armadura Healing Mail
            #-------- Efecto al andar --------------------------------------------
            actor.hp += actor.maxhp / 10
            if @steps % 10 == 0
              actor.int += 1
            end
            #---------------------------------------------------------------------
          end
        end
      end
    end


Thanks in advance.
Bury with my...money!

LiTTleDRAgo


            #-------- Efecto al andar --------------------------------------------
            actor.hp += actor.maxhp / 10
            if @steps % 10 == 0
              actor.int += 1         #<<<<<< Why int?
            end
            #---------------------------------------------------------------------


If you want to recover sp, shouldn't it be actor.sp += actor.maxsp / 10 instead of actor.int +=1 ?

KK20

@Drago:
That's how the script actually is. Link: http://www.mundo-maker.com/t13459p25-xp-coleccion-de-tips-tricks-de-wecoc#103669

@Simon:
I've made it so that it checks all the actor's equipped armors. The script only shows using armor3_id, which would be the actor's body armor. I didn't include a check for weapon, though that's easy to do. Also removed the increased INT bit too.

module HealMailConfig
  def self.heal_ability(id)
    case id
    #==============================================================================
    # Configure the HP and SP amounts healed with every step.
    # Format:
    #  when ARMOR_ID then [HP_HEAL_AMOUNT, SP_HEAL_AMOUNT]
    #==============================================================================
    #---------------------------------------------------------------- BEGIN CONFIG
    when 1  then [1, 0] # Bronze Shield
    when 16 then [10, 5] # Mythril Armor
    when 28 then [0, 20] # Ring of Intelligence
    #---------------------------------------------------------------- END CONFIG
    else
      [0, 0]
    end
  end
end

class Game_Party
  alias healing_mail_steps increase_steps unless $@
  def increase_steps
    healing_mail_steps
    for actor in @actors
      next if actor.dead?
      [actor.armor1_id, actor.armor2_id, actor.armor3_id, actor.armor4_id].each do |armor_id|
        next if armor_id.nil? || armor_id == 0
        heal = HealMailConfig.heal_ability(armor_id)
        actor.hp += heal[0]
        actor.sp += heal[1]
      end
    end
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Simon Greedwell

I tested it and works just perfectly.

Changed the tittle to reflect that.
Bury with my...money!