[XP] Two separate MP meters

Started by Duckaiser, March 10, 2011, 08:16:56 am

Previous topic - Next topic

Duckaiser

What I'm looking for is a script that will enable me to give characters two MP meters. The most obvious use would be one for techniques and one for spells.

Let's call the technique MP, "TP". And the spell MP, "SP".

So, every character would have TP and SP. Right by their HP. The script would need to make the second MP meter function like the normal one, just use a different "pool" of MP. One example of this would be the PS1 RPG, SaGa Frontier, every character has WP and JP, the in-world equivalent of my proposal for TP and SP. Techniques, such as martial arts, sword techniques, as well as monster attacks consume WP. Various spells, such a healing magic, attack magic, and support magic consume JP. This gives you more options, if you run out of JP using spells, you still have WP left to use techniques. But not every character would have the same ratio of JP to WP, so...even if two characters have the same moves, they will still function differently.

There'd have to be script calls that increase the second MP stat, mainly for level gaining. There would need to be a way to signal with the script which techniques consume which MP. And there would have to be a way to "heal" or "damage" the second MP too. Also, various menus would have to be adjusted to accommodate for the extra meters. The battle menu for one, but also the status menu screen, and the individual status screen. I seem to think other menus show your current MP, but I don't have XP on hand to confirm.

If anything needs clarifying, let me know. If this has already been made, I apologize (I tried searching, but part of the problem was that I didn't know what to search for, what would someone else call this kind of script?) Any help would be greatly appreciated.

Duckaiser

This is a bump (not that that's really necessary, I mean, second topic and all), but I'm also adding more information.

I don't know much about scripting, but I'd imagine that this would be set up to interact with each tab in the Database.

Actors - Set up what each characters secondary MP base and growth is.
Items - Set which items restore or damage the secondary MP.
Skills - Set which skills consume the secondary MP option. The possibility of skills that consume both MPs would be nice, but certainly not necessary.
Monsters - Set each monsters starting secondary MP.
States - Set which states alter your secondary MP and by how much.

Again, I have no idea how hard this would be to implement. I feel though that this script would add an interest layer to some games. Any help would be greatly appreciated. I might even be able to offer something in return...A simple picture maybe? Maybe a simple sprite (by simple, I mean human-sized without any super unique hair or whatever)

chaucer

March 25, 2011, 05:44:23 pm #2 Last Edit: March 26, 2011, 03:05:08 am by Blizzard
Spoiler: ShowHide
#_______________________________________________________________________________
# MOG TP System V2.1        
#_______________________________________________________________________________
# By Moghunter            
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Troca o custo de SP por TP, ou seja, é possível definir
#que certas habilidades tenham o custo de TP no lugar do SP,
# O sistema é útil quando quisermos, por exemplo, que habilidades
#físicas não gastem SP mas outro parâmetro.
#_______________________________________________________________________________
module MOG
#Definição do nome do TP (Talent Points).  
TP_NAME = "SP "
#NOTA - Para mudar o nome do SP basta entrar no banco
#de dados na parte de System e mudar o nome de SP para outro
#nome, por exemplo, MP.
#-------------------------------------------------------------------------------
#Definição de quais habilidades terão o custo de TP.
#
#TP_COST = {A=>B, A=>B, ...}
#
#A = ID of SKILL.
#B = Cost of TP.
TP_COST = {
57=>500,    #Cross Cut
58=>12,   #Feint Attack
59=>26,   #Hurricane
60=>40,   #Spiral Blade
61=>7,    #Leag Sweep
62=>15,   #Beast Slayer
63=>32,   #Thunder Pierce
64=>50,   #Screw Thrust
65=>6,    #Power Break
66=>13,   #Mind Break
67=>28,   #Aqua Buster
68=>32,   #Rolling Axe
73=>10,   #Bird Killer
74=>15    #Mute Arrow
         }  
#-------------------------------------------------------------------------------          
#Definição da quantidade inicial de TP.
#(Caso não especificado TP inicial igual a 1)
#
#A=>B
#
#A = ID do personagem.
#B = Quantidade inicial de TP.
INITP = {
1=>1000,
2=>70,
7=>15,
8=>20
        }
#-------------------------------------------------------------------------------
#Definição da quantidade de TP ganho ao fazer LV-UP.
#(Caso não especificado TP ganho igual a 1)
#
#A=>B
#
#A = ID do personagem.
#B = Quantidade de TP ganho.
TP_EXP = {
1=>0,
2=>0,
7=>0,
8=>0
        }
#-------------------------------------------------------------------------------
#Itens que recuperam o TP.
#A=>B
#
#A = ID do Item
#B = Quantidade de TP recuperado.
ITEM_TP_RECOVER = {
1=>10,
2=>999
}  
#-------------------------------------------------------------------------------
end

#===============================================================================
# Game_Actor
#===============================================================================
class Game_Actor < Game_Battler  
 attr_accessor   :tp
 attr_accessor   :maxtp
#--------------------------------------------------------------------------
# Setup
#--------------------------------------------------------------------------
 alias mog45_setup setup
 def setup(actor_id)
   mog45_setup(actor_id)  
   @maxtp = 0
   @maxtp_plus = 0
   @tp_exp = MOG::TP_EXP[actor_id]
   ini_tp = MOG::INITP[actor_id]
   if ini_tp != nil
     @base_tp = ini_tp
   else
     @base_tp = 0
   end
   if @tp_exp != nil
     tpx = (@tp_exp * @level) - @tp_exp
   else
     tpx = 1
   end
   @tp = @base_tp + tpx
 end
#--------------------------------------------------------------------------
# maxtp_plus
#--------------------------------------------------------------------------  
 def maxtp_plus
   if @tp_exp != nil and @level > 1  
     cal =  @tp_exp * @level
     return @maxtp_plus + cal - @tp_exp
   else
     return @maxtp_plus
   end
 end
#--------------------------------------------------------------------------
# maxtp
#--------------------------------------------------------------------------
 def maxtp
   n = [[@base_tp + maxtp_plus, 1].max, 9999].min
   return n
 end  
#--------------------------------------------------------------------------
# TP
#--------------------------------------------------------------------------
 def tp=(tp)
   @tp = [[tp, maxtp].min, 0].max
 end
end

#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler
 alias mog45_skill_can_use? skill_can_use?  
 def skill_can_use?(skill_id)
   tp_cost = MOG::TP_COST[skill_id]
   if tp_cost != nil and self.is_a?(Game_Actor)
     if tp_cost > self.tp
       return false
     end
   else
     if $data_skills[skill_id].sp_cost > self.sp
       return false
     end
   end
   if dead?
     return false
   end
   if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
     return false
   end
   occasion = $data_skills[skill_id].occasion
   if $game_temp.in_battle
     return (occasion == 0 or occasion == 1)
   else
     return (occasion == 0 or occasion == 2)
   end
   return
   mog45_skill_can_use?(skill_id)    
 end
end

#===============================================================================
# Scene_Battle
#===============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# update_phase4_step5
#--------------------------------------------------------------------------  
 alias mog45_update_phase4_step5 update_phase4_step5
 def update_phase4_step5
   mog45_update_phase4_step5
   item_tp_recover_id = MOG::ITEM_TP_RECOVER[@item.id]
   if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.kind == 2 and @item =! nil
     for target_tp in @target_battlers    
   if target_tp.is_a?(Game_Actor) and item_tp_recover_id != nil  
     target_tp.tp += item_tp_recover_id
     target_tp.damage = MOG::TP_NAME.to_s + item_tp_recover_id.to_s
     target_tp.damage_pop = true
   end  
   end
   end  
 end
#--------------------------------------------------------------------------
# make_skill_action_result
#--------------------------------------------------------------------------
 alias mog45_make_skill_action_result make_skill_action_result
 def make_skill_action_result
   @skill = $data_skills[@active_battler.current_action.skill_id]
   unless @active_battler.current_action.forcing
     unless @active_battler.skill_can_use?(@skill.id)
       $game_temp.forcing_battler = nil
       @phase4_step = 1
       return
     end
   end
   tp_cost = MOG::TP_COST[@skill.id]
   if tp_cost != nil and @active_battler.is_a?(Game_Actor)
     @active_battler.tp -= tp_cost
   else
     @active_battler.sp -= @skill.sp_cost
   end
   @status_window.refresh
   @help_window.set_text(@skill.name, 1)
   @animation1_id = @skill.animation1_id
   @animation2_id = @skill.animation2_id
   @common_event_id = @skill.common_event_id
   set_target_battlers(@skill.scope)
   for target in @target_battlers
     target.skill_effect(@active_battler, @skill)
   end
   return
   mog45_make_skill_action_result
 end
end  

#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# item_effect
#--------------------------------------------------------------------------  
 alias mog45_item_effect item_effect
 def item_effect(item)
   if $game_temp.in_battle == false  
   item_tp_recover = MOG::ITEM_TP_RECOVER[item.id]
   if item_tp_recover != nil
     if self.tp < self.maxtp
       self.tp += item_tp_recover
       return true
     else  
       return false
     end
       return false
     end
   end
   mog45_item_effect(item)
 end
end

#===============================================================================
# Interpreter
#===============================================================================
class Interpreter
#--------------------------------------------------------------------------
# command_314
#--------------------------------------------------------------------------    
 alias mog45_command_314 command_314
 def command_314
   mog45_command_314
   for i in 0...$game_party.actors.size
     actor = $game_party.actors[i]
     actor.tp = actor.maxtp
   end
   return true
 end
end

#===============================================================================
# Window_Base
#===============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# draw_actor_tp
#--------------------------------------------------------------------------      
 def draw_actor_tp(actor, x, y,type)
   self.contents.font.color = system_color  
   self.contents.draw_text(x, y, 32, 32, MOG::TP_NAME)
   self.contents.font.color = normal_color
   case type
   when 0
     self.contents.draw_text(x - 40, y, 198, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
   when 1
     self.contents.draw_text(x - 70, y, 198, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
   when 2
       self.contents.draw_text(x + 40, y, 80, 32, actor.tp.to_s,2)
   when 3
     self.contents.draw_text(x - 20, y, 150, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
   when 4
     self.contents.font.name = "Georgia"
     self.contents.draw_text(x - 55, y, 130, 32, actor.tp.to_s, 2)
   end  
 end
#--------------------------------------------------------------------------
# draw_actor_tp2
#--------------------------------------------------------------------------
 def draw_actor_tp2(actor, x, y)
   self.contents.font.name = "Georgia"
   back = RPG::Cache.picture("STBAR_Back")    
   cw = back.width  
   ch = back.height
   src_rect = Rect.new(0, 0, cw, ch)    
   self.contents.blt(x + 86, y - ch + 40, back, src_rect)  
   meter = RPG::Cache.picture("STBAR.png")    
   cw2 = meter.width * actor.tp / actor.maxtp
   ch2 = meter.height
   src_rect2 = Rect.new(0, 0, cw2, ch2)    
   self.contents.blt(x + 86, y - ch + 40, meter, src_rect2)  
   self.contents.font.color = normal_color  
   self.contents.draw_text(x - 40, y, 198, 32, MOG::TP_NAME + actor.tp.to_s, 2)
 end
end

#===============================================================================
# Window_Help
#===============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# set_actor
#--------------------------------------------------------------------------        
 alias mog45_set_actor set_actor
 def set_actor(actor)
   if actor != @actor
     self.contents.clear
     draw_actor_name(actor, 4, 0)
     draw_actor_hp(actor, 110, 0)
     draw_actor_sp(actor, 460, 0)
     draw_actor_tp(actor, 284, 0,0)
     @actor = actor
     @text = nil
     self.visible = true
   end
   return
   mog45_set_actor(actor)
 end
end

#===============================================================================
# Window_SkillStatus
#===============================================================================
class Window_SkillStatus < Window_Base
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------        
 alias mog45_refresh refresh
 def refresh
   self.contents.clear
   draw_actor_name(@actor, 4, 0)
   draw_actor_hp(@actor, 110, 0)
   draw_actor_sp(@actor, 460, 0)
   draw_actor_tp(@actor, 284, 0,0)
   return
   mog45_refresh
 end
end  

#===============================================================================
#  Window_Status
#===============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------        
 alias mog45_refresh refresh
 def refresh
   mog45_refresh
   if $mog_rgss_Scene_Status != nil
     draw_actor_tp2(@actor, 435, 250)    
   else
     draw_actor_tp(@actor, 96, 170,0)  
   end  
 end  
end

#===============================================================================
#  Window_BattleStatus
#===============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------        
 alias mog45_refresh refresh
 def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     actor = $game_party.actors[i]
     actor_x = i * 160 + 4
     draw_actor_name(actor, actor_x, 0)
     draw_actor_hp(actor, actor_x, 24, 120)
     draw_actor_sp(actor, actor_x, 48, 120)
     draw_actor_tp(actor, actor_x, 72,2)
     if @level_up_flags[i]
       self.contents.font.color = normal_color
       self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
     else
       draw_actor_state(actor, actor_x, 96)
     end
   end
 end  
end

#===============================================================================
#  Window_MenuStatus
#===============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------        
 alias mog45_refresh refresh
 def refresh
   self.contents.clear  
   mog45_refresh
   for i in 0...$game_party.actors.size
     x = 64
     y = i * 116
     actor = $game_party.actors[i]
     draw_actor_tp(actor, x + 236, y,1 )
   end
 end
end

#===============================================================================
# Window_Target
#===============================================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------        
 alias mog45_refresh refresh
 def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     x = 4
     y = i * 116
     actor = $game_party.actors[i]
     draw_actor_name(actor, x, y)
     draw_actor_level(actor, x + 8, y + 32)
     draw_actor_state(actor, x + 8, y + 64)
     draw_actor_hp(actor, x + 152, y + 0)
     draw_actor_tp(actor, x + 152, y + 32,3)
     draw_actor_sp(actor, x + 152, y + 64)
   end
   return
   mog45_refresh  
 end
end

#===============================================================================
# Window_Skill
#===============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------        
 alias mog45_draw_item draw_item
 def draw_item(index)
   skill = @data[index]
   if @actor.skill_can_use?(skill.id)
     self.contents.font.color = normal_color
     else
     self.contents.font.color = disabled_color
     end
     x = 4 + index % 2 * (288 + 32)
     y = index / 2 * 32
     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
     bitmap = RPG::Cache.icon(skill.icon_name)
     opacity = self.contents.font.color == normal_color ? 255 : 128
     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
     tp_cost = MOG::TP_COST[skill.id]
     if tp_cost != nil
       self.contents.font.color = Color.new(50,250,150,255)
       self.contents.draw_text(x + 180, y, 48, 32,MOG::TP_NAME, 2)
       self.contents.font.color = Color.new(255,255,255,255)
       self.contents.draw_text(x + 232, y, 48, 32,tp_cost.to_s, 2)
     else
       self.contents.font.color = Color.new(250,150,50,255)  
       self.contents.draw_text(x + 180, y, 48, 32,$data_system.words.sp, 2)
       self.contents.font.color = Color.new(255,255,255,255)
       self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)  
   end
   return
   mog45_draw_item(index)
 end
end

#===============================================================================
# Scene_Skill
#===============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# update_target
#--------------------------------------------------------------------------        
 alias mog45_update_target update_target
 def update_target
   if Input.trigger?(Input::C)
   unless @actor.skill_can_use?(@skill.id)
     $game_system.se_play($data_system.buzzer_se)
     return
   end
   if @target_window.index == -1
     used = false
     for i in $game_party.actors
       used |= i.skill_effect(@actor, @skill)
     end
   end
   if @target_window.index <= -2
     target = $game_party.actors[@target_window.index + 10]
     used = target.skill_effect(@actor, @skill)
   end
   if @target_window.index >= 0
     target = $game_party.actors[@target_window.index]
     used = target.skill_effect(@actor, @skill)
   end
   if used
     $game_system.se_play(@skill.menu_se)
     tp_cost = MOG::TP_COST[@skill.id]
     if tp_cost != nil  
       @actor.tp -= tp_cost
     else
       @actor.sp -= @skill.sp_cost
     end        
     @status_window.refresh
     @skill_window.refresh
     @target_window.refresh
     if $game_party.all_dead?
       $scene = Scene_Gameover.new
       return
     end
     if @skill.common_event_id > 0
       $game_temp.common_event_id = @skill.common_event_id
       $scene = Scene_Map.new
       return
     end
     end
     unless used
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
   mog45_update_target    
 end
end

$mog_rgss_TP_System = true

Script is by moghunter you cant set the monsters TP but it has everything else you asked :) hope this helps

Duckaiser

Thank you very much!

TP System huh? Doesn't sound too farfetched, but I don't think I would of thought of that still. And I've heard of Moghunter before, but all anyone else ever seemed to mention were the custom menu scripts (which are cool, admittedly)

It does look like what I'm looking for. Not being able to give it to monsters is kind of a drag, but most RPGs make monsters use different stats a bit anyway...My only worry is how much it might interfere with other scripts...(I mean, if it DOES show up on the menus, then...it would probably interfere with some other scripts...hmm...) I guess I'll find out once I test it out (unfortunately, I can't now)