RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Hide 0 MP Cost

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 76
RMRK Junior
Hide 0 MP Cost
Version: 1.0
Author: JFace
Date: June 19, 2010



Description

This script hides the MP cost of a skill when the cost is 0. This is particularly useful if a character has physical attack type skills, and MP should not be displayed. This cleans up the skill list in both the battle and main menus.



Screenshots


The skill "Meditate" is a 0 MP skill. The MP cost is not displayed.



Instructions

Follow the instructions at the top of the script. 
 

 

Script

Code: [Select]
#===============================================================================
#
# Hide 0 MP Cost - By JFace
# July 19, 2010

# This script hides the MP cost of a skill when the cost is 0. This is
# particularly useful if a character has physical attack type skills, and
# MP should not be displayed. This cleans up the skill list in both the battle
# and main menus.
#
#
# Instructions
# -----------------------------------------------------------------------------
# To use this script, place this script anywhere below ? Materials
# but above ? Main. Save your game.
#
# This script has no customizable features.
# ==============================================================================

class Window_Skill
  #--------------------------------------------------------------------------
  # * 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)
      if @actor.calc_mp_cost(skill) != 0
        self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
      end
    end
  end
end



« Last Edit: July 20, 2010, 12:29:56 AM by JFace »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
It's a neat idea, but there is absolutely no reason to reproduce the entire Window_Skill class.

The following code would do the same thing:

Code: [Select]
class Window_Skill
  #--------------------------------------------------------------------------
  # * 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)
      if @actor.calc_mp_cost(skill) != 0
        self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
      end
    end
  end
end

The methods you don't overwrite are kept the same, and for compatibility reasons it's really sloppy to overwrite methods when it's unnecessary.

Otherwise, fairly good work.

**
Rep: +0/-0Level 76
RMRK Junior
It's a neat idea, but there is absolutely no reason to reproduce the entire Window_Skill class.


The methods you don't overwrite are kept the same, and for compatibility reasons it's really sloppy to overwrite methods when it's unnecessary.

Otherwise, fairly good work.

Thanks for the tip. The script has been trimmed up, and my lesson learned  :-[

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
well, you do still need to have the line:
Code: [Select]
class Window_Skill
at the top and another end at the bottom.

**
Rep: +0/-0Level 76
Tyaela is always here.
This is cool.  ;D