Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Figured I give this question its own thread. I'm looking for a script that creates a single TP Bar above the party that shows the total amount of TP accumulated. The bar would look something like the bars from Galv's Battle Favour script, the only difference is that there's only 1 for the party members. https://galvs-scripts.com/2012/11/11/battle-favour/
Along with that, it should be noted I'm using a script for all party members and enemies to share their TP bars, meaning if party member A and B attack on the same turn, instead of both of them having 5 TP for each of them, they now share 10 TP. Then if party member A uses a skill that's worth 7 TP, both members will have 3 TP. Here's the script for that:

Code:
#=============================================================
# Universal TP
# By: TheoAllen
#-------------------------------------------------------------
class Game_Unit
  def max_tp
    return 200 # <-- change maximum here
  end

  def init_tp
    self.tp = rand * 0 # <-- change initial TP here
  end

  def tp
    @tp ||= 0
  end

  def tp=(value)
    @tp = [[value, max_tp].min, 0].max
  end

  alias universal_tp_onbattle_start on_battle_start
  def on_battle_start
    universal_tp_onbattle_start
  end

end

class Game_Battler

  def tp
    friends_unit.tp
  end

  def tp=(value)
    friends_unit.tp = value
  end

  def max_tp
    friends_unit.max_tp
  end

  def tp_rate
    self.tp.to_f / max_tp
  end

  def init_tp
  end

end

Is there any kind of script that would display a single TP Bar above the party instead of each party member having their own TP Bar?
 
Last edited:

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Bump number idk lol I really hope this doesn't get drowned over other threads in 3 seconds lol
I'm really bad at scripting with VX Ace, so that's why I'm askin for help here
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,035
Reaction score
678
First Language
English
Primarily Uses
RMVXA
Try this. Used some code from Galv's favour script.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: TP Bar for Party             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Draws a tp bar for the party      ╠════════════════════╣
# ║                                     ║    16 Mar 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: TheoAllen's Universal TP                       ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Script provides a tp bar showing the tp for the          ║
# ║  party. Uses battle member 0's tp                        ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 16 Mar 2021 - Script finished                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all RPG Maker uses                              ║
# ╚══════════════════════════════════════════════════════════╝
module R2_Group_TP
  BAR_WIDTH = 250
  BAR_HEIGHT = 10
  BAR_Y = 0
  BAR_POSITION = "top"   # Position of the tp bar. Can be "top" or "bottom"
  PARTY_BAR_COLORS = [4,11]
  PARTY_TP_TEXT = "Party TP"
  TEXT_Y = 0
  SHOW_NUMBERS = true
  # The following will work if preserving tp is off
  RANDOM_TP_START = true
  RANDOM_TP_AMOUNT = 20     # number to randomize the starting tp.
  # 20 means a number between 0 and 20 for the starting tp
  GUARANTEE_TP = true
  GUARANTEE_TP_AMOUNT = 10  # will always start with this amount of tp + random
end

#==============================================================================
# ** Game Unit
#------------------------------------------------------------------------------
#  Adding in tp for the party
#==============================================================================

class Game_Unit
  def tp_rate=(value)
    return tp_rate
  end
  def tp_rate
    self.tp.to_f / max_tp
  end
end

#==============================================================================
# ** Window Battle Status
#------------------------------------------------------------------------------
#  removing the tp drawn for each actor
#==============================================================================

class Window_BattleStatus < Window_Selectable
  def draw_gauge_area_with_tp(rect, actor)
    draw_actor_hp(actor, rect.x + 0, rect.y, 72)
    draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  end
end

#==============================================================================
# ** Window Group TP
#------------------------------------------------------------------------------
#  Draw the tp gauge for the party
#==============================================================================
class Window_GroupTP < Window_Base

  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    update_location
    draw_tp_bar
    self.opacity = 0
    self.contents_opacity = 255
  end

  def bar_width
    return R2_Group_TP::BAR_WIDTH
  end

  def update
    self.refresh
  end

  def refresh
    contents.clear
    $game_party.tp = $game_party.battle_members[0].tp.to_i
    draw_tp_bar
  end

  def update_location
    case R2_Group_TP::BAR_POSITION
    when "top"
      self.y = 0
    when "bottom"
      self.y = Graphics.height - 170
    else
      self.opacity = 0
    end
    self.z = 0
  end

  def draw_tp_bar
    draw_party_tp(Graphics.width / 2 - bar_width / 2, 0, bar_width)
  end

  def draw_party_tp(x, y, width)
      draw_tp_gauge(x, y, width, $game_party.tp_rate, text_color(R2_Group_TP::PARTY_BAR_COLORS[0]), text_color(R2_Group_TP::PARTY_BAR_COLORS[1]))
      draw_text(x, y + R2_Group_TP::TEXT_Y, 100, contents.font.size, party_text, 2)
    if R2_Group_TP::SHOW_NUMBERS
      xr = x + width
      draw_text(xr - 100, y + R2_Group_TP::TEXT_Y, 100, contents.font.size, $game_party.tp.to_s, 2)
    end
  end

  def party_text
    R2_Group_TP::PARTY_TP_TEXT
  end

  def draw_tp_gauge(x, y, width, rate, color1, color2)
    fill_w = (width * rate).to_i
    gauge_y = y + line_height - 8 + R2_Group_TP::BAR_Y
    contents.fill_rect(x, gauge_y, width, R2_Group_TP::BAR_HEIGHT, gauge_back_color)
    contents.gradient_fill_rect(x, gauge_y, fill_w, R2_Group_TP::BAR_HEIGHT, color1, color2)
  end

end # Window_GroupTP < Window_Base

#==============================================================================
# ** Scene Battle
#------------------------------------------------------------------------------
#  Create tp window
#==============================================================================
class Scene_Battle < Scene_Base

  alias r2_party_tp_start start
  def start
    set_initial_tp
    r2_party_tp_start
  end

  alias r2_party_tp_create_all_windows create_all_windows
  def create_all_windows
    r2_party_tp_create_all_windows
    @party_tp_window = Window_GroupTP.new
  end

  def set_initial_tp
    if !$game_party.battle_members[0].preserve_tp?
    if R2_Group_TP::RANDOM_TP_START
      $game_party.battle_members[0].tp = rand(R2_Group_TP::RANDOM_TP_AMOUNT)
    else
      $game_party.battle_members[0].tp = 0
    end
    if R2_Group_TP::GUARANTEE_TP
      $game_party.battle_members[0].tp += R2_Group_TP::GUARANTEE_TP_AMOUNT
    end
    end
    $game_party.tp = $game_party.battle_members[0].tp
    $game_party.tp_rate = $game_party.battle_members[0].tp_rate
  end

end # Scene_Battle < Scene_Base
 

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Try this. Used some code from Galv's favour script.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: TP Bar for Party             ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Draws a tp bar for the party      ╠════════════════════╣
# ║                                     ║    16 Mar 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: TheoAllen's Universal TP                       ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Script provides a tp bar showing the tp for the          ║
# ║  party. Uses battle member 0's tp                        ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 16 Mar 2021 - Script finished                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all RPG Maker uses                              ║
# ╚══════════════════════════════════════════════════════════╝
module R2_Group_TP
  BAR_WIDTH = 250
  BAR_HEIGHT = 10
  BAR_Y = 0
  BAR_POSITION = "top"   # Position of the tp bar. Can be "top" or "bottom"
  PARTY_BAR_COLORS = [4,11]
  PARTY_TP_TEXT = "Party TP"
  TEXT_Y = 0
  SHOW_NUMBERS = true
  # The following will work if preserving tp is off
  RANDOM_TP_START = true
  RANDOM_TP_AMOUNT = 20     # number to randomize the starting tp.
  # 20 means a number between 0 and 20 for the starting tp
  GUARANTEE_TP = true
  GUARANTEE_TP_AMOUNT = 10  # will always start with this amount of tp + random
end

#==============================================================================
# ** Game Unit
#------------------------------------------------------------------------------
#  Adding in tp for the party
#==============================================================================

class Game_Unit
  def tp_rate=(value)
    return tp_rate
  end
  def tp_rate
    self.tp.to_f / max_tp
  end
end

#==============================================================================
# ** Window Battle Status
#------------------------------------------------------------------------------
#  removing the tp drawn for each actor
#==============================================================================

class Window_BattleStatus < Window_Selectable
  def draw_gauge_area_with_tp(rect, actor)
    draw_actor_hp(actor, rect.x + 0, rect.y, 72)
    draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  end
end

#==============================================================================
# ** Window Group TP
#------------------------------------------------------------------------------
#  Draw the tp gauge for the party
#==============================================================================
class Window_GroupTP < Window_Base

  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    update_location
    draw_tp_bar
    self.opacity = 0
    self.contents_opacity = 255
  end

  def bar_width
    return R2_Group_TP::BAR_WIDTH
  end

  def update
    self.refresh
  end

  def refresh
    contents.clear
    $game_party.tp = $game_party.battle_members[0].tp.to_i
    draw_tp_bar
  end

  def update_location
    case R2_Group_TP::BAR_POSITION
    when "top"
      self.y = 0
    when "bottom"
      self.y = Graphics.height - 170
    else
      self.opacity = 0
    end
    self.z = 0
  end

  def draw_tp_bar
    draw_party_tp(Graphics.width / 2 - bar_width / 2, 0, bar_width)
  end

  def draw_party_tp(x, y, width)
      draw_tp_gauge(x, y, width, $game_party.tp_rate, text_color(R2_Group_TP::PARTY_BAR_COLORS[0]), text_color(R2_Group_TP::PARTY_BAR_COLORS[1]))
      draw_text(x, y + R2_Group_TP::TEXT_Y, 100, contents.font.size, party_text, 2)
    if R2_Group_TP::SHOW_NUMBERS
      xr = x + width
      draw_text(xr - 100, y + R2_Group_TP::TEXT_Y, 100, contents.font.size, $game_party.tp.to_s, 2)
    end
  end

  def party_text
    R2_Group_TP::PARTY_TP_TEXT
  end

  def draw_tp_gauge(x, y, width, rate, color1, color2)
    fill_w = (width * rate).to_i
    gauge_y = y + line_height - 8 + R2_Group_TP::BAR_Y
    contents.fill_rect(x, gauge_y, width, R2_Group_TP::BAR_HEIGHT, gauge_back_color)
    contents.gradient_fill_rect(x, gauge_y, fill_w, R2_Group_TP::BAR_HEIGHT, color1, color2)
  end

end # Window_GroupTP < Window_Base

#==============================================================================
# ** Scene Battle
#------------------------------------------------------------------------------
#  Create tp window
#==============================================================================
class Scene_Battle < Scene_Base

  alias r2_party_tp_start start
  def start
    set_initial_tp
    r2_party_tp_start
  end

  alias r2_party_tp_create_all_windows create_all_windows
  def create_all_windows
    r2_party_tp_create_all_windows
    @party_tp_window = Window_GroupTP.new
  end

  def set_initial_tp
    if !$game_party.battle_members[0].preserve_tp?
    if R2_Group_TP::RANDOM_TP_START
      $game_party.battle_members[0].tp = rand(R2_Group_TP::RANDOM_TP_AMOUNT)
    else
      $game_party.battle_members[0].tp = 0
    end
    if R2_Group_TP::GUARANTEE_TP
      $game_party.battle_members[0].tp += R2_Group_TP::GUARANTEE_TP_AMOUNT
    end
    end
    $game_party.tp = $game_party.battle_members[0].tp
    $game_party.tp_rate = $game_party.battle_members[0].tp_rate
  end

end # Scene_Battle < Scene_Base
I went on and added the script in, but the bar hasn't showed up. Been using Battle Tests to see if it appears but it hasn't. I have "Display TP Bars" on, and all the party members have "Preserve TP" on their classes. I also changed the settings a tiny bit. I set RANDOM_TP_START and GENERATE_TP to false, and set bar_position to "bottom"
I think it has to do with the Battle UI I'm using, the Yanfly engine to be specific. Tried to send a picture of it but the server wouldn't send it.
 

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
I went on and added the script in, but the bar hasn't showed up. Been using Battle Tests to see if it appears but it hasn't. I have "Display TP Bars" on, and all the party members have "Preserve TP" on their classes. I also changed the settings a tiny bit. I set RANDOM_TP_START and GENERATE_TP to false, and set bar_position to "bottom"
I think it has to do with the Battle UI I'm using, the Yanfly engine to be specific. Tried to send a picture of it but the server wouldn't send it.
Oh wait! I tried running the game and the bar showed up! I'm not sure why it wouldn't show up before, but it's here now. I'll update this thread if I have any problems.
 

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Ok so I fiddled around with the script and noticed something. The skills I use for TP require 2 or more party members. For example, when the Bar reaches 200 TP, Members A and B could use a TP skill that attacked the enemy with high damage. However, what I noticed was that the script decreases the amount of TP based on not only the skill cost, but how many people are using the still. So if you had 250 TP, and you used a 200 TP skill that required 2 party members, onstead of the bar setting back to 50, it will try to deplete itself by 400, but since the max amount of TP I've set up is 300, it simply sets the value to 0.
It's not too big of an issue, but if anyone or maybe Roninator could help out to fix this glitch I'd appreciate it.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,143
Reaction score
14,648
First Language
English
Primarily Uses
RMMV

@Dunkle_G , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.



I suggest you take some time to read through the forum rules, which you can find via the link provided, or the Help link at the top of every forum page.
 

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
So, you have been providing very limited information.

What battle scripts do you have? that includes anything to do with battle like your skills that require two actors.
Right sorry bout that. The battle engine I'm using is Yanfly's Ace Battle Engine, which you can find here: https://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/

The script I'm using for the unison skills is DoubleX's RMVXA Unison Skills/Items script, which you can find here: https://rpgmaker.net/scripts/374/code/

If you need me to elaborate anything else, let me know!

[dpost]@Dunkle_G [/dpost]

I suggest you take some time to read through the forum rules, which you can find via the link provided, or the Help link at the top of every forum page.

Ah, sorry about that! I'll keep that in mind when I post in the future, and I'll be sure to read over the rules when I can. Sorry for the inconvenience!
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,035
Reaction score
678
First Language
English
Primarily Uses
RMVXA
the unison skills is DoubleX's RMVXA Unison Skills/Items script
Then it's a issue with the Unison skills script.
There may be two options.
but I think the best way to rewrite a part of DoubleX's script
On line 412 you need to change that line to this
Ruby:
    item.unison_actor_id.each { |a_id|
    if $game_party.battle_members[0].id == a_id
      $game_actors[a_id].pay_skill_cost(item)
    end
    }
Actually that won't work. Mp cost will only ever come from battle member 0 then.
so try this as an addon
Ruby:
class Game_BattlerBase
  def pay_skill_cost(skill)
    self.mp -= skill_mp_cost(skill)
    self.tp -= skill_tp_cost(skill) if $game_party.battle_members[0]
  end
end

Looking at it more that won't work either.

Try this.
DoubleX's script line 412
item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost(item) }
change to
Ruby:
    if item.tp_cost > 0 && item.mp_cost > 0
      item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost_mp(item) }
      $game_party.battle_members[0].pay_skill_cost_tp(item)
    elsif item.tp_cost > 0
      $game_party.battle_members[0].pay_skill_cost_tp(item)
    else
      item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost(item) }
    end
then put this as an addon
can go above or below
Ruby:
class Game_BattlerBase
  def pay_skill_cost_tp(skill)
    $game_party.battle_members[0].tp -= skill_tp_cost(skill)
  end
  def pay_skill_cost_mp(skill)
    self.mp -= skill_mp_cost(skill)
  end
end
 
Last edited:

Dunkle_G

The Meming Trash Man
Veteran
Joined
Jan 15, 2021
Messages
34
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Then it's a issue with the Unison skills script.
There may be two options.
but I think the best way to rewrite a part of DoubleX's script
On line 412 you need to change that line to this
Ruby:
    item.unison_actor_id.each { |a_id|
    if $game_party.battle_members[0].id == a_id
      $game_actors[a_id].pay_skill_cost(item)
    end
    }
Got it. I'll put that in once I'm out of school!

EDIT: Just tried the new script you added out, but it did not work. Here's lines 406-424 after I put in your code:
Code:
  alias use_item_unison_item use_item
  def use_item(item)
    # Rewritten to pay unison skill cost
    unless item.is_a?(RPG::Skill) && item.unison_item
      return use_item_unison_item(item)
    end
    if item.tp_cost > 0 && item.mp_cost > 0
      item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost_mp(item) }
      $game_party.battle_members[0].pay_skill_cost_tp(item)
    elsif item.tp_cost > 0
      $game_party.battle_members[0].pay_skill_cost_tp(item)
    else
      item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost(item) }
    end
    item.effects.each { |effect| item_global_effect_apply(effect) }
    #
  end # use_item

end # Game_Battler

As for the add on, I put it in a new script below the Unity script page, so there's nothing in that script besides the add on code you gave me

If I did something wrong, let me know.

EDIT 2: Ok so the script DOES work don't worry. Turns out trying to test scripts in the Battle Test in the Database doesn't work lol. Idk why. But now it works like a charm, so thanks! You really saved my bacon!
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

How funny would it be if one of us remade "The Town With No Name" in RPG Maker?
I miss my friends from the work experience program... maybe once I move, I'll have a little party with them. I'll even show them my games and perhaps my puppets. Did you know I make working puppets?
Episode 18 is here. We're still making a game in RPG Maker MZ. This week, let's make that cliff map look awesome with the new tiles we made last week! Join us live, now!

I just watched the CG movie HARLOCK: Space Pirate, a retelling of the anime Harlock story. It was pretty awesome, and has given me some inspiration for my space game, at least for parts of it.
How comes, when you are fearful to log anywhere, that somebody close passed from COVID and you learn too late, you suddenly are mortified that others who almost share BDay dates didn't answer the art you made for them?

Forum statistics

Threads
111,218
Messages
1,059,345
Members
144,476
Latest member
Kikiko
Top