I am currently working on a game project and have took a step back to see what scripts I can create/implement on my own. I am trying not to use custom scripts if it can be helped. In my current project, I am using "Victor Saint - MP Level" scripts to provide MP type levels as seen in games like the first Final Fantasy, Suikoden and Grandia. But, I have taken a stab at my own implementation to simulate this script.
The issue I am running into is once each individual skill usage reaches "0", it needs to disabled from being used from the menu and in battle. I have my current in progress script below to take a look at. Yes, I understand my approach may not be the best and I am sure it can be approved on. Feel feel to modify and show me a better way.
But, I ultimately just want to correctly disable the skill once it reaches a usage of "0".
*I am also using "Hime - Tag Manager" script to help with this implementation and my project as a whole.
Script referenced...
=> Victor Saint - MP Level: https://victorenginescripts.wordpress.com/rpg-maker-vx-ace/mp-level/
Script being used in my script below...
=> Hime - Tag Manager: https://himeworks.com/2013/03/tag-manager/
*I have attached a demo project to work with to make these a bit more simple. The following below are the steps to get to where I am at now:
The issue I am running into is once each individual skill usage reaches "0", it needs to disabled from being used from the menu and in battle. I have my current in progress script below to take a look at. Yes, I understand my approach may not be the best and I am sure it can be approved on. Feel feel to modify and show me a better way.
But, I ultimately just want to correctly disable the skill once it reaches a usage of "0".
*I am also using "Hime - Tag Manager" script to help with this implementation and my project as a whole.
Script referenced...
=> Victor Saint - MP Level: https://victorenginescripts.wordpress.com/rpg-maker-vx-ace/mp-level/
Script being used in my script below...
=> Hime - Tag Manager: https://himeworks.com/2013/03/tag-manager/
*I have attached a demo project to work with to make these a bit more simple. The following below are the steps to get to where I am at now:
- Start game and select the chest box to open and gain items + variable changes.
- Attach the magic "Fire" armor to either the slot "FH., RW., or LW." and you will gain the fire skills "fire" and "fire II".
- Before going to the skill scene, run around a little to have your party hurt by poison so you can be healed by the "fire" skill.
- Go into the skill scene and select an actor to use the skill to heal HP. You will notice, once the skill reaches "0", the MP Level 1 magic will turn 0 as well from being used.
- At this point, when the usage is at "0"... the skill should become inactive and disabled from being used until the MP Level 1 has been recovered to max mp. Currently, it keeps allowing you to based on the "original mp" setup. This is the part of my script that needs to be tweaked.
Ruby:
=begin
#===============================================================================
# Title: JRPG MP Levels
# Author: FamilyGamer7
# Date: ??????
#===============================================================================
# ** Description |
# ----------------
# The ability to avoid using external scripts and manipulate the default engine
# and variables to simulate MP Levels from the class jRPG games.
# (Script is still work in progress)
#===============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * As is script - For Advanced Users
# * No credit Needed
#===============================================================================
=end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles parties. Information such as gold and items is included.
# Instances of this class are referenced by $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * New Methods: Creates Actor MP level (Ex: 0 / 0 / 0 / 0)
#--------------------------------------------------------------------------
# Actor 1 - Sets up MP Level in an array (With Variables)
def actor_mp_levels_actor1
return [$game_variables[900], $game_variables[901], $game_variables[902], $game_variables[903]]
end
# Actor 2 - Sets up MP Level in an array (With Variables)
def actor_mp_levels_actor2
return [$game_variables[904], $game_variables[905], $game_variables[906], $game_variables[907]]
end
# Actor 3 - Sets up MP Level in an array (With Variables)
def actor_mp_levels_actor3
return [$game_variables[908], $game_variables[909], $game_variables[910], $game_variables[911]]
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw MP
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 124)
# Check if Actor 1 - Draws MP Levels
if actor.id == 1
draw_text(x + 18, y, 350, line_height, $game_party.actor_mp_levels_actor1[0])
draw_text(x + 51, y, 350, line_height, $game_party.actor_mp_levels_actor1[1])
draw_text(x + 85, y, 350, line_height, $game_party.actor_mp_levels_actor1[2])
draw_text(x + 118, y, 350, line_height, $game_party.actor_mp_levels_actor1[3])
end
# Check if Actor 2 - Draws MP Levels
if actor.id == 2
draw_text(x + 18, y, 350, line_height, $game_party.actor_mp_levels_actor2[0])
draw_text(x + 51, y, 350, line_height, $game_party.actor_mp_levels_actor2[1])
draw_text(x + 85, y, 350, line_height, $game_party.actor_mp_levels_actor2[2])
draw_text(x + 118, y, 350, line_height, $game_party.actor_mp_levels_actor2[3])
end
# Check if Actor 3 - Draws MP Levels
if actor.id == 3
draw_text(x + 18, y, 350, line_height, $game_party.actor_mp_levels_actor3[0])
draw_text(x + 51, y, 350, line_height, $game_party.actor_mp_levels_actor3[1])
draw_text(x + 85, y, 350, line_height, $game_party.actor_mp_levels_actor3[2])
draw_text(x + 118, y, 350, line_height, $game_party.actor_mp_levels_actor3[3])
end
draw_text(x + 36, y, 350, line_height, "/")
draw_text(x + 69, y, 350, line_height, "/")
draw_text(x + 103, y, 350, line_height, "/")
draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
draw_text(x, y, 30, line_height, Vocab::mp_a)
end
end
#==============================================================================
# ** Window_SkillList
#------------------------------------------------------------------------------
# This window is for displaying a list of available skills on the skill window.
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# * Get Activation State of Selection Item
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
# I am stuck here. I know this controls the actual skill/item to disable
# it from being used.
end
#--------------------------------------------------------------------------
# * Display Skill in Active State?
#--------------------------------------------------------------------------
def enable?(item)
@actor && @actor.usable?(item)
# I am stuck here as well. I know this controls the color of its active
# state to appear disabled.
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if skill
rect = item_rect(index)
rect.width -= 4
draw_item_name(skill, rect.x, rect.y, enable?(skill))
draw_skill_cost(rect, skill)
end
end
#--------------------------------------------------------------------------
# * Draw Skill Use Cost
#--------------------------------------------------------------------------
def draw_skill_cost(rect, skill)
# Check if Actor 1
if @actor.id == 1
# Checks for Skill Tag "Lv1"
if skill.tags[0] != nil && skill.tags[0].include?("lv1")
draw_text(rect, $game_party.actor_mp_levels_actor1[0], 2)
end
# Checks for Skill Tag "Lv2"
if skill.tags[0] != nil && skill.tags[0].include?("lv2")
draw_text(rect, $game_party.actor_mp_levels_actor1[1], 2)
end
# Checks for Skill Tag "Lv3"
if skill.tags[0] != nil && skill.tags[0].include?("lv3")
draw_text(rect, $game_party.actor_mp_levels_actor1[2], 2)
end
# Checks for Skill Tag "Lv4"
if skill.tags[0] != nil && skill.tags[0].include?("lv4")
draw_text(rect, $game_party.actor_mp_levels_actor1[3], 2)
end
end
# Check if Actor 2
if @actor.id == 2
# Checks for Skill Tag "Lv1"
if skill.tags[0] != nil && skill.tags[0].include?("lv1")
draw_text(rect, $game_party.actor_mp_levels_actor2[0], 2)
end
# Checks for Skill Tag "Lv2"
if skill.tags[0] != nil && skill.tags[0].include?("lv2")
draw_text(rect, $game_party.actor_mp_levels_actor2[1], 2)
end
# Checks for Skill Tag "Lv3"
if skill.tags[0] != nil && skill.tags[0].include?("lv3")
draw_text(rect, $game_party.actor_mp_levels_actor2[2], 2)
end
# Checks for Skill Tag "Lv4"
if skill.tags[0] != nil && skill.tags[0].include?("lv4")
draw_text(rect, $game_party.actor_mp_levels_actor2[3], 2)
end
end
# Check if Actor 3
if @actor.id == 3
# Checks for Skill Tag "Lv1"
if skill.tags[0] != nil && skill.tags[0].include?("lv1")
draw_text(rect, $game_party.actor_mp_levels_actor3[0], 2)
end
# Checks for Skill Tag "Lv2"
if skill.tags[0] != nil && skill.tags[0].include?("lv2")
draw_text(rect, $game_party.actor_mp_levels_actor3[1], 2)
end
# Checks for Skill Tag "Lv3"
if skill.tags[0] != nil && skill.tags[0].include?("lv3")
draw_text(rect, $game_party.actor_mp_levels_actor3[2], 2)
end
# Checks for Skill Tag "Lv4"
if skill.tags[0] != nil && skill.tags[0].include?("lv4")
draw_text(rect, $game_party.actor_mp_levels_actor3[3], 2)
end
end
end
end
#==============================================================================
# ** Scene_ItemBase
#------------------------------------------------------------------------------
# This class performs common processing for the item screen and skill screen.
#==============================================================================
class Scene_ItemBase < Scene_MenuBase
#--------------------------------------------------------------------------
# * Actor [OK]
#--------------------------------------------------------------------------
def on_actor_ok
if item_usable?
use_item
# Checks for Actor 1 to use skill
if @actor.id == 1
# Checks for Skill Tag "Lv1"
if item.tags[0].include?("lv1")
$game_variables[900] -= 1
end
# Checks for Skill Tag "Lv2"
if item.tags[0].include?("lv2")
$game_variables[901] -= 1
end
# Checks for Skill Tag "Lv3"
if item.tags[0].include?("lv3")
$game_variables[902] -= 1
end
# Checks for Skill Tag "Lv4"
if item.tags[0].include?("lv4")
$game_variables[903] -= 1
end
end
# Checks for Actor 1 to use skill
if @actor.id == 2
# Checks for Skill Tag "Lv1"
if item.tags[0].include?("lv1")
$game_variables[904] -= 1
end
# Checks for Skill Tag "Lv2"
if item.tags[0].include?("lv2")
$game_variables[905] -= 1
end
# Checks for Skill Tag "Lv3"
if item.tags[0].include?("lv3")
$game_variables[906] -= 1
end
# Checks for Skill Tag "Lv4"
if item.tags[0].include?("lv4")
$game_variables[907] -= 1
end
end
# Checks for Actor 1 to use skill
if @actor.id == 3
# Checks for Skill Tag "Lv1"
if item.tags[0].include?("lv1")
$game_variables[908] -= 1
end
# Checks for Skill Tag "Lv2"
if item.tags[0].include?("lv2")
$game_variables[909] -= 1
end
# Checks for Skill Tag "Lv3"
if item.tags[0].include?("lv3")
$game_variables[910] -= 1
end
# Checks for Skill Tag "Lv4"
if item.tags[0].include?("lv4")
$game_variables[911] -= 1
end
end
else
Sound.play_buzzer
end
end
end