I don't know if I explained well. I'm looking for a script that makes all the party to have only one TP meter. As you know in VX ACE every party member has its own TP gauge, is there a script I can use to achieve what I'm trying to do? I’ve been looking for a while. Anything helps!
Looking for a script that changes the TP bar from one for all party members to only one shared by all the party.
RGSS3 Script RequestsThis should do the job.
I rounded the TP value to prevent float numbers.
I rounded the TP value to prevent float numbers.
Ruby:
module SharedTP
# Maximum value for the shared TP meter
MAX_TP = 100
end
class Game_Party < Game_Unit
alias shared_tp_initialize initialize
def initialize
shared_tp_initialize
@shared_tp = 0
end
def shared_tp
@shared_tp
end
def shared_tp=(value)
@shared_tp = [[value, 0].max, SharedTP::MAX_TP].min
end
def gain_shared_tp(value)
per_member_tp = (value / all_members.size.to_f).round
self.shared_tp += per_member_tp
end
def lose_shared_tp(value)
self.shared_tp -= value
end
end
class Game_Battler < Game_BattlerBase
def gain_tp(value)
$game_party.gain_shared_tp(value)
end
def lose_tp(value)
$game_party.lose_shared_tp(value)
end
def tp
$game_party.shared_tp
end
def tp=(value)
$game_party.shared_tp = value
end
end
class Window_Base < Window
def draw_actor_tp(actor, x, y, width = 96)
draw_gauge(x, y, width, $game_party.shared_tp.to_f / SharedTP::MAX_TP, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
draw_text(x, y, 30, line_height, Vocab::tp_a)
change_color(normal_color)
draw_text(x + width - 42, y, 42, line_height, $game_party.shared_tp.to_i, 2)
end
end
It's very good and it works accordingly, thank you a lot!
I wanted to ask if these two things were possible:
1. First of all, thank you for also including the possibility to modify the MAX TP. It made my work very easy, thanks. Just asking, is there a way to actually control how many TP can you win per action? Since just one hit actually made me win the 10TP instantly, and I wanted it to be very slow. Like 1TP per turn or something?
2. Is there a way to have a single bar that shows the TP for the party? In the game, yes, the party members share their TP, but each party member has a TP Bar that shows the TP remaining even when all of them share the same TP.
This is what I mean, if I did not explained myself correctly. Again thank you for your help.
1. To determine how much TP an action gives, you can set this in the database.
Each skill has it's TP cost and TP gain parameter, adjust them accordingly. 🙂
I did make a mistake in the attribution logic, which should be covered with the updated script.
2. Done!
However, I made this using the default game resolution, higher resolution will probably need adjustments, tell me if you need some adjustments, or you can try and modify them yourself in the
Window_Base class using the margins (for text display) and in Window_BattleStatus class using the shared_tp_width parameter and tp_x and tp_y positioningThis updated version will center the combined TP bar on screen :
Ruby:
module SharedTP
MAX_TP = 1000
end
class Game_Party < Game_Unit
alias shared_tp_initialize initialize
def initialize
shared_tp_initialize
@shared_tp = 0
end
def shared_tp
@shared_tp
end
def shared_tp=(value)
@shared_tp = [[value, 0].max, SharedTP::MAX_TP].min
end
def gain_shared_tp(value)
self.shared_tp += value
end
def lose_shared_tp(value)
self.shared_tp -= value
end
end
class Game_Battler < Game_BattlerBase
def gain_tp(value)
$game_party.gain_shared_tp(value)
end
def lose_tp(value)
$game_party.lose_shared_tp(value)
end
def tp
$game_party.shared_tp
end
def tp=(value)
$game_party.shared_tp = value
end
end
class Window_Base < Window
def draw_shared_tp(x, y, width = 64)
marginX = 50
marginY = 8
draw_gauge(x, y, width, $game_party.shared_tp.to_f / SharedTP::MAX_TP, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
draw_text(x + 4, y - marginY, 30, line_height, Vocab::tp_a)
change_color(normal_color)
draw_text(x + width - marginX, y - marginY, 42, line_height, $game_party.shared_tp.to_i, 2)
end
# Override to hide individual TP bars
def draw_actor_tp(actor, x, y, width = 96)
# Intentionally left blank to hide individual TP bars
end
end
class Window_BattleStatus < Window_Selectable
# Redefine the draw_item method to include shared TP gauge
alias shared_tp_draw_item draw_item
def draw_item(index)
shared_tp_width = 75 # Adjust TP width size to your needs
shared_tp_draw_item(index)
if index == 0 # Draw the shared TP bar only once
tp_x = 325 # Adjust position X to your needs
#Center Y position of TP bar
tp_y = (contents_height / 2) - (line_height / 2)
draw_shared_tp(tp_x, tp_y, shared_tp_width)
end
end
end
It's much better, thank you! And also thanks for explaining me the TP cost and TP gain thing xD I forgot! I think this is what I'm going to be using for my project.
It's easy to forget the software can actually handle alot of things. ^^