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.

VX Hide MP Cost in Ability Menu

Hi guys.

I'm not sure how simple this is for an experienced scripter but I really need a script which does the following:

- Hides the MP Cost value that shows up next to the names of skills in the Ability Menu.

Well yeah, that's the only thing. It needs to hide it in the main menu and the battle menu if possible.

My reason for this is that all abilities in my game cost either 1 MP or 0 MP (Field skills). It'd just look more pleasing if I could remove the useless information from the menus.

If any of you could do this for me I would greatly appreciate it! Full credit given of course! :)
 

poccil

Sponsor

That involves modifying the Window_Skill script section.  Delete the following line (line 58):
Code:
      self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
That's it.
 
An alternative would be to hide the MP cost if a skill cost 0 mp, and only show the MP cost if it's higher than 0.(in your case Mp cost = 1) Like this:

Mp Cost - 0  : you can't see the number
Mp Cost - 1  : you can see the number

If you wish to do that, go into the Window_Skill script and replace line 58 with:
Code:
      unless @actor.calc_mp_cost(skill) == 0
        self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
      end


Although this is just a suggestion. If you don't like it, just do what poccil said! :tongue2:

Over and out - Gando
 
EDIT: Hmm it doesn't seem to be working actually... and that's because I'm using  Yoyinde's EquipmentSkills script which overrides WindowSkills with this:

ef draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      mp = @actor.calc_mp_cost(skill)
      cap = @actor.equipment_skills[skill.id]
      map = EquipmentSkills::AP[skill.id]
      string = ''
      if @actor.learned_skills.include?(skill) || map == 0
        string = mp
      else
        if EquipmentSkills::PERCENT_VIEW && $game_temp.in_battle
          string = sprintf("%d (%d%%)", mp, cap * 100 / map)
        else
          string = sprintf("%d (%d/%d)", mp, cap, map)
        end
      end
      self.contents.draw_text(rect, string, 2)
    end
  end
end

It's not as clear as the original was as to which entry I need to delete, though. :(
 
Okay, i'm not sure that this will work, but try to replace the draw_text method in your EquipmentSkills script with this :
Code:
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      cap = @actor.equipment_skills[skill.id]
      map = EquipmentSkills::AP[skill.id]
      string = ''
      if EquipmentSkills::PERCENT_VIEW && $game_temp.in_battle
        string = sprintf("%d (%d%%)", cap * 100 / map)
      else
        string = sprintf("%d (%d/%d)", cap, map)
      end
      self.contents.draw_text(rect, string, 2)
    end
  end

As i said, i'm not sure that it will work, but it should.. ^^

Over and out - Gando
 
Thanks for the help Gando!

Unfortunately we come across another problem. And this started out so simple!

When accessing the ability screen of a character with 'unmastered' skills I get an error message for this line:

string = sprintf("%d (%d/%d)", cap, map)

Saying it has "too few arguments". (The MP entry was deleted leaving 3 not 4).

Bah! The EquipmentSkills script must require 4 values be present in that string variable? Now I have to find a way to tell it that it only needs 3? x_x
 
dontblink88":38biopb4 said:
Thanks for the help Gando!

Unfortunately we come across another problem. And this started out so simple!

When accessing the ability screen of a character with 'unmastered' skills I get an error message for this line:

string = sprintf("%d (%d/%d)", cap, map)

Saying it has "too few arguments". (The MP entry was deleted leaving 3 not 4).

Bah! The EquipmentSkills script must require 4 values be present in that string variable? Now I have to find a way to tell it that it only needs 3? x_x

The %d in those strings mean that they'll be replaced with the arguments. If you remove an argument, you have to remove the appropriate %d from the string, and than it won't require more argument than you have.

Just imagine what you see runtime instead of "%d (%d/%d)", and you'll see (if counted well) the first %d shall be removed, resulting "(%d/%d)"
 
I also am looking to remove the 0 mp cost, but am using KGC's MP Cost Alter script.
Could someone aid me please?
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/          â—†     MP Consumption Options - KGC_MPCostAlter   â—† VX â—†
#_/          â—‡              Last update : 2008/02/06               â—‡
#_/          â—†            Translation by Mr. Anonymous             â—†
#_/-----------------------------------------------------------------------------
#_/          This script allows you to alter the way MP is consumed.
#_/=============================================================================
#_/                         â—† Instructions For Usage â—†
#_/  To make use of these functions, you must insert the desired tag into the
#_/   "Notes" box located in the Skills section of the database. For
#_/   example, you want the Flame II skill to consume 24% of the character's
#_/   max MP. You would locate Flame II in the skills tab of the
#_/   database and insert "<MAXMPcost>" (without quotations) in the note box.
#_/   Simple, no?
#_/
#_/                        â—‡ MP Percentile Consumption â—‡
#_/
#_/                           <MPcost> OR <MAXMPcost>
#_/  Examples: <MPcost> MP cost is set to 10, therefore MP cost is 
#_/             actually 10% ofthe character's remaining MP.
#_/            <MAXMPcost> MP cost is set to 25, therefore MP cost is 
#_/             actually 25% ofthe character's total (Max) MP.
#_/
#_/                  â—‡ Damage Proportionate to MP Consumption â—‡
#_/
#_/                               <propMPdamage>
#_/  Example: The skill "Water" has a base damage of 300. Using this tag,
#_/            The base damage becomes a percentile, and the MP cost 
#_/            effectively becomes the base damage.
#_/            Therefore, 300% of 6 MP(the skill's MP cost) would be 18.
#_/                            (3 x 6 = 18)                    
#_/
#_/                        â—‡ HP Consumption for Skills â—‡
#_/
#_/                                 <HPconsume>
#_/  Example: You wish for the skill "Darkness", which normally costs 40
#_/            MP to cost HP instead. You'd simply add <HPconsume> in the
#_/            Notes.
#_/
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#===============================================================================
#                             ★ Customization ★
#===============================================================================

module KGC
module MPCostAlter
  # This toggle allows you to consume HP (using <HPconsume>) all the way to 0.
  #  true  : HP is able to be consumed all the way to 0.
  #  false : Skills that use <HPconsume> cannot be used if HP = 1.
  PERMIT_ZERO_HP = false
  # This toggle is used in conjuction with PERMIT_ZERO_HP
  #  true  : When a skill that uses HP identifies HP as insufficient, the skill
  #           remains usable.
  #  false : When HP is insuffiecient, use of that skill is impossible
  RELEASE_HP_LIMIT = false
end
end

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tags used for "Notes" in database.    #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #

#  Whatever word(s) are after the separator ( | ) in the following lines are 
#   what are used to determine what is searched for in the "Notes" section.

$imported = {} if $imported == nil
$imported["MPCostAlter"] = true

module KGC::MPCostAlter
  # Regular expressions defined.
  module Regexp
    # Base Skill Module
    module Skill
      # Consume HP tag string
      CONSUME_HP = /<(?:CONSUME_HP|HPconsume)>/i
      # MP Cost Rate tag string
      MP_COST_RATE = /<(MAX)?(?:MP_COST_RATE|MPcost)>/i
      # Proportional MP Damage tag string
      MP_PROPORTIONAL_DAMAGE =
        /<(?:MP_PROPORTIONAL_DAMAGE|propMPdamage)>/i
    end
  end
end

#==============================================================================
# â–  RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem
  #--------------------------------------------------------------------------
  # â—‹ Generate MP consumption remodelling cache
  #--------------------------------------------------------------------------
  def create_mp_cost_alter_cache
    @__consume_hp = false
    @__mp_cost_rate = false
    @__max_mp_cost_rate = false
    @__mp_proportional_damage = false

    self.note.split(/[\r\n]+/).each { |prop|
      case prop
      when KGC::MPCostAlter::Regexp::Skill::CONSUME_HP
        # HP Consumption
        @__consume_hp = true
      when KGC::MPCostAlter::Regexp::Skill::MP_COST_RATE
        # MP Cost Rate
        @__mp_cost_rate = true
        @__max_mp_cost_rate = ($1 != nil)
      when KGC::MPCostAlter::Regexp::Skill::MP_PROPORTIONAL_DAMAGE
        # Proportional MP Damage 
        @__mp_proportional_damage = true
      end
    }
  end
  #--------------------------------------------------------------------------
  # â—‹ HP Consumption
  #--------------------------------------------------------------------------
  def consume_hp
    create_mp_cost_alter_cache if @__consume_hp == nil
    return @__consume_hp
  end
  #--------------------------------------------------------------------------
  # â—‹ MP Consumption Ratio
  #--------------------------------------------------------------------------
  def mp_cost_rate
    create_mp_cost_alter_cache if @__mp_cost_rate == nil
    return (@__mp_cost_rate ? self.mp_cost : -1)
  end
  #--------------------------------------------------------------------------
  # â—‹ MaxMP Consumption Ratio
  #--------------------------------------------------------------------------
  def max_mp_cost_rate
    create_mp_cost_alter_cache if @__max_mp_cost_rate == nil
    return @__max_mp_cost_rate
  end
  #--------------------------------------------------------------------------
  # â—‹ Proportional MP Damage Consumption Ratio
  #--------------------------------------------------------------------------
  def mp_proportional_damage
    create_mp_cost_alter_cache if @__mp_proportional_damage == nil
    return @__mp_proportional_damage
  end
end

#==============================================================================
# â–  Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # â—
 

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