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.

Combine ZTBS with Mogs TP_System

Hello i?m new and this is my first post so if i do something wrong i apologize!

So my question is: Is there anybody who can combine these two Scripts?

1. ZTBS
I think posting the script is unprofitable because it?s too much and i think everybody has a way to get it! ( I THINK )

2. MOGs TP_System
Code:
module MOG
 
TP_NAME = "TP " 

TP_COST = {
57=>5,    #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 
          }  
#A = ID do personagem.
#B = Quantidade inicial de TP.
INITP = {
1=>50,
2=>70,
7=>15,
8=>20 
         }
#A=>B
#A = ID do personagem.
#B = Quantidade de TP ganho.
TP_EXP = {
1=>6,
2=>8,
7=>3,
8=>2
         }

ITEM_TP_RECOVER = {
1=>10,
2=>999
}   
#-------------------------------------------------------------------------------
end
$mogscript = {} if $mogscript == nil
$mogscript["TP_System"] = true        
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler  
attr_accessor   :tp
attr_accessor   :maxtp
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
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
def maxtp
n = [[@base_tp + maxtp_plus, 1].max, 9999].min
return n
end  
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
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
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
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
#####################
# class Interpreter #
#####################
class Interpreter
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
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
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
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
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
alias mog45_refresh refresh
def refresh
mog45_refresh
if $mogscript["menu_eva"] == true
draw_actor_tp2(@actor, 435, 250)    
else
draw_actor_tp(@actor, 96, 170,0)  
end  
end  
end
########################
# Window_Battle_Status #
########################
class Window_BattleStatus < Window_Base
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
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
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
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
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

What I can say is that the TP_Script has to be inserted above all of the ZTBS stuff.

You will see that if you want to use a skill which is cast by spend TP in the ZTBS, it will not work.Nevertheless the system will spend only SP to cast spells.

Cross cut of Arshes is a skill which will be cast by spending TP you can see it in a normal Battle! But in the ZTBS he will spend only SP.

Many thanks in advance. :)
 

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