Making a skill that reduces TP?

Does VX Ace contain any innate functions to reduce TP?
My game has all major encounters play around TP to discourage all-out DPS, but I don't want players to have no reasonable counter to TP, so I want to have a few skills that reduce an enemy's TP.
Is there anything I can do in-engine or do I have to turn to a script.
If I remember correctly (I'm not home right now so I can't check), enemies don't have TP by default.

If you want to use MP, I believe in the skill settings you can change it to MP damage instead of HP.
I messed around with just the general flow of combat (giving an enemy a skill that costs 100 TP and giving it high priority), made an attack to give around 50 TP, attacked twice, and the enemy was able to use it.
I'm unsure if any scripts I have add TP to enemies (I have Yanfly's Battle System as my only battle engine script, but I don't believe it adds enemy TP).
I messed around with just the general flow of combat (giving an enemy a skill that costs 100 TP and giving it high priority), made an attack to give around 50 TP, attacked twice, and the enemy was able to use it.
I'm unsure if any scripts I have add TP to enemies (I have Yanfly's Battle System as my only battle engine script, but I don't believe it adds enemy TP).
Enemies do have TP. They start with a random number at battle start.
So technically the skill should have only been used once.
The enemies do gain tp just like actors. So if the skill recovered 100 tp when used then it would recover all tp after the first atack.
Is the skill set to repeat?
I wasn't really messing around with TP all that much considering I want to get to the bottom of reducing it through a skill. I guess the best way I can put it is doing "TP damage."
I'll probably mess with Yanfly's TP System once I get down to balancing bosses, but I'm at the current roadblock.
But to answer, the skill was not set up to repeat. I can go back and recreate the skill since my example was just to test the whole enemy TP business, so I deleted it from my skill list.
TP can be accessed by script the same way HP and MP can.
So b.tp is the skill target's TP and a.tp is the skill user's TP
With those you can use damage formula coding to change the value on hit.

ATTENTION:
Autobattle messes with damage coding, the code potion would be executed on the test which skill to use even if a different skill is later selected.
And of course the skill has to use one of the HP or MP settings to even enable the damage formula.
But you could use
b.tp+=5; 0
to increase the target TP without doing any other damage or healing as the last number processed in the damage formula is the resulting regular damage/effect.
You can try using this part of a script I wrote for ydoolb.
It is for a dungeon encounters battle system, but it adds in tp control by setting up skills for mp damage and such. I just changed a little bit of code and renamed the script.
Spoiler: TP Damage
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: TP Control system.                     ║  Version: 1.00     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║                                               ╠════════════════════╣
# ║   Control TP damage                           ║    06 Oct 2024     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: nil                                                      ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description:                                                 ║
# ║       Aloow control over TP for actors and enemies                 ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║    Place note tag on skill <physical> or <magical>                 ║
# ║      physical will cause damage to PD first then HP                ║
# ║      magical will cause damage to MD first then HP                 ║
# ║      If a skill has both note tags then PD is used first then MD   ║
# ║                                                                    ║
# ║    Note tag a skill with <tp damage> to cause TP loss              ║
# ║      The skill must be configured for mp damage                    ║
# ║                                                                    ║
# ║    Note tag a skill with <tp drain> to grab TP from the enemy      ║
# ║      The skill must be configured for mp drain                     ║
# ║                                                                    ║
# ║    Note tag a skill with <tp recover> to gain TP                   ║
# ║      The skill must be configured with a feature for mp recovery   ║
# ║        or mp recovery for the damage type                          ║
# ║      The amount of TP recovered will be the amount in the feature  ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 01 Aug 2024 - Script finished                               ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks:                                                ║
# ║   Roninator2                                                       ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║  Follow the original Authors terms of use where applicable         ║
# ║    - When not made by me (Roninator2)                              ║
# ║  Free for all uses in RPG Maker except nudity                      ║
# ║  Anyone using this script in their project before these terms      ║
# ║  were changed are allowed to use this script even if it conflicts  ║
# ║  with these new terms. New terms effective 03 Apr 2024             ║
# ║  No part of this code can be used with AI programs or tools        ║
# ║  Credit must be given                                              ║
# ╚════════════════════════════════════════════════════════════════════╝

# ╔════════════════════════════════════════════════════════════════════╗
# ║                      End of editable region                        ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ■ Module
#==============================================================================
module R2_Skill_PD_MD
  PHYSICAL = /<physical>/i
  MAGICAL = /<magical>/i
  TP_DRAIN = /<tp drain>/i
  TP_DAMAGE = /<tp damage>/i
  TP_RECOVER = /<tp recover>/i
end

# type
# The type of damage.

# 0: None
# 1: HP damage
# 2: MP damage
# 3: HP recovery
# 4: MP recovery
# 5: HP drain
# 6: MP drain
# 7: TP drain
# 8: TP recovery
# 9: TP damage

class RPG::UsableItem::Damage
  def to_tp?
    [7,8,9].include?(@type)
  end
  def drain?
    [5,6,7].include?(@type)
  end
  def recover?
    [3,4,8].include?(@type)
  end
end

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_r2_skill_type load_database; end
  def self.load_database
    load_database_r2_skill_type
    load_notetags_r2_skill_pdmd
    load_notetags_r2_item_pdmd
  end
 
  #--------------------------------------------------------------------------
  # new method: load_notetags_lse
  #--------------------------------------------------------------------------
  def self.load_notetags_r2_skill_pdmd
    for r2skpdmd in $data_skills
      next if r2skpdmd.nil?
      r2skpdmd.load_notetags_r2_skill_pdmd
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: load_notetags_lse
  #--------------------------------------------------------------------------
  def self.load_notetags_r2_item_pdmd
    for r2skpdmd in $data_items
      next if r2skpdmd.nil?
      r2skpdmd.load_notetags_r2_item_pdmd
    end
  end
 
end # DataManager

#==============================================================================
# ■ RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :sk_pd, :sk_md

  #--------------------------------------------------------------------------
  # common cache: load_notetags_lse
  #--------------------------------------------------------------------------
  def load_notetags_r2_skill_pdmd
    @sk_pd = false
    @sk_md = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_Skill_PD_MD::PHYSICAL
        @sk_pd = true
      when R2_Skill_PD_MD::MAGICAL
        @sk_md = true
      when R2_Skill_PD_MD::TP_DRAIN
        self.damage.type = 7 if self.damage.type == 6
      when R2_Skill_PD_MD::TP_DAMAGE
        self.damage.type = 9 if self.damage.type == 2
      when R2_Skill_PD_MD::TP_RECOVER
        self.damage.type = 8 if self.damage.type == 4
        self.effects.each do |ef|
          ef.code = 14 if ef.code == 12
        end
      end
    }
  end
end

#==============================================================================
# ■ RPG::Skill
#==============================================================================

class RPG::Item < RPG::UsableItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :sk_pd, :sk_md

  #--------------------------------------------------------------------------
  # common cache: load_notetags_lse
  #--------------------------------------------------------------------------
  def load_notetags_r2_item_pdmd
    @sk_pd = false
    @sk_md = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_Skill_PD_MD::PHYSICAL
        @sk_pd = true
      when R2_Skill_PD_MD::MAGICAL
        @sk_md = true
      when R2_Skill_PD_MD::TP_DRAIN
        self.damage.type = 7 if self.damage.type == 6
      when R2_Skill_PD_MD::TP_DAMAGE
        self.damage.type = 9 if self.damage.type == 2
      when R2_Skill_PD_MD::TP_RECOVER
        self.damage.type = 8 if self.damage.type == 4
        self.effects.each do |ef|
          ef.code = 14 if ef.code == 12
        end
      end
    }
  end
end

#==============================================================================
# ** Game_ActionResult
#------------------------------------------------------------------------------
#  This class handles the results of battle actions. It is used internally for
# the Game_Battler class.
#==============================================================================

class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :tp_drain                 # TP drain
  #--------------------------------------------------------------------------
  # * Clear Damage Values
  #--------------------------------------------------------------------------
  def clear_damage_values
    @hp_damage = 0
    @mp_damage = 0
    @tp_damage = 0
    @hp_drain = 0
    @mp_drain = 0
    @tp_drain = 0
  end
end
#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  EFFECT_RECOVER_TP     = 14              # MP Recovery
  #--------------------------------------------------------------------------
  # * Test Effect
  #--------------------------------------------------------------------------
  def item_effect_test(user, item, effect)
    case effect.code
    when EFFECT_RECOVER_HP
      hp < mhp || effect.value1 < 0 || effect.value2 < 0
    when EFFECT_RECOVER_MP
      mp < mmp || effect.value1 < 0 || effect.value2 < 0
    when EFFECT_RECOVER_TP
      tp < mtp || effect.value1 < 0 || effect.value2 < 0
    when EFFECT_ADD_STATE
      !state?(effect.data_id)
    when EFFECT_REMOVE_STATE
      state?(effect.data_id)
    when EFFECT_ADD_BUFF
      !buff_max?(effect.data_id)
    when EFFECT_ADD_DEBUFF
      !debuff_max?(effect.data_id)
    when EFFECT_REMOVE_BUFF
      buff?(effect.data_id)
    when EFFECT_REMOVE_DEBUFF
      debuff?(effect.data_id)
    when EFFECT_LEARN_SKILL
      actor? && !skills.include?($data_skills[effect.data_id])
    else
      true
    end
  end
  #--------------------------------------------------------------------------
  # * Initialize TP
  #--------------------------------------------------------------------------
  def init_tp
    self.tp = (rand * 25).to_i
  end
  #--------------------------------------------------------------------------
  # * Effect of Skill/Item on Using Side
  #--------------------------------------------------------------------------
  def item_user_effect(user, item)
    user.tp += (item.tp_gain * user.tcr).to_i
  end
  #--------------------------------------------------------------------------
  # * Charge TP by Damage Suffered
  #--------------------------------------------------------------------------
  def charge_tp_by_damage(damage_rate)
    self.tp += (50 * damage_rate * tcr).to_i
  end
  #--------------------------------------------------------------------------
  # * Damage Processing
  #    @result.hp_damage @result.mp_damage @result.hp_drain
  #    @result.mp_drain must be set before call.
  #--------------------------------------------------------------------------
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage.to_i
    self.mp -= @result.mp_damage.to_i
    self.tp -= @result.tp_damage.to_i
    user.hp += @result.hp_drain.to_i
    user.mp += @result.mp_drain.to_i
    user.tp += @result.tp_drain.to_i
  end
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    type = 0
    type = 1 if item.sk_pd
    type = 2 if item.sk_md
    type = 3 if item.sk_md && item.sk_pd
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item, type)
  end
  #--------------------------------------------------------------------------
  # * [TP Recovery] Effect
  #--------------------------------------------------------------------------
  def item_effect_recover_tp(user, item, effect)
    value = (mtp * effect.value1 + effect.value2) * rec
    value *= user.pha if item.is_a?(RPG::Item)
    value = value.to_i
    @result.tp_damage -= value
    @result.success = true if value != 0
    self.tp += value
  end
  #--------------------------------------------------------------------------
  # * Apply Effect
  #--------------------------------------------------------------------------
  def item_effect_apply(user, item, effect)
    method_table = {
      EFFECT_RECOVER_HP    => :item_effect_recover_hp,
      EFFECT_RECOVER_MP    => :item_effect_recover_mp,
      EFFECT_RECOVER_TP    => :item_effect_recover_tp,
      EFFECT_GAIN_TP       => :item_effect_gain_tp,
      EFFECT_ADD_STATE     => :item_effect_add_state,
      EFFECT_REMOVE_STATE  => :item_effect_remove_state,
      EFFECT_ADD_BUFF      => :item_effect_add_buff,
      EFFECT_ADD_DEBUFF    => :item_effect_add_debuff,
      EFFECT_REMOVE_BUFF   => :item_effect_remove_buff,
      EFFECT_REMOVE_DEBUFF => :item_effect_remove_debuff,
      EFFECT_SPECIAL       => :item_effect_special,
      EFFECT_GROW          => :item_effect_grow,
      EFFECT_LEARN_SKILL   => :item_effect_learn_skill,
      EFFECT_COMMON_EVENT  => :item_effect_common_event,
    }
    method_name = method_table[effect.code]
    send(method_name, user, item, effect) if method_name
  end
  #--------------------------------------------------------------------------
  # * Processing at End of Battle
  #--------------------------------------------------------------------------
  def on_battle_end
    @result.clear
    remove_battle_states
    remove_all_buffs
    clear_actions
    appear
  end
  #--------------------------------------------------------------------------
  # * Test Skill/Item Application
  #    Used to determine, for example, if a character is already fully healed
  #   and so cannot recover anymore.
  #--------------------------------------------------------------------------
  def item_test(user, item)
    return false if item.for_dead_friend? != dead?
    return true if $game_party.in_battle
    return true if item.for_opponent?
    return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
    return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
    return true if item.damage.recover? && item.damage.to_tp? && tp < mtp
    return true if item_has_any_valid_effects?(user, item)
    return false
  end
end

class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Create Damage
  #--------------------------------------------------------------------------
  def make_damage(value, item, type = 0)
    @critical = false if value == 0
    @mp_damage = @tp_damage = 0
    case type
    when 1
      @mp_damage = value
      @mp_damage = [@battler.mp, @mp_damage].min
      value = value - @mp_damage
    when 2
      @tp_damage = value
      @tp_damage = [@battler.tp, @tp_damage].min
      value = value - @tp_damage
    when 3
      @mp_damage = value
      @mp_damage = [@battler.mp, @mp_damage].min
      value = value - @mp_damage
      @tp_damage = value
      @tp_damage = [@battler.tp, @tp_damage].min
      value = value - @tp_damage
    else
      @hp_damage = value if item.damage.to_hp?
      @mp_damage = value if item.damage.to_mp?
      @mp_damage = [@battler.mp, @mp_damage].min
      @tp_damage = value if item.damage.to_tp?
      @tp_damage = [@battler.tp, @tp_damage].min
    end
    @hp_damage = value if item.damage.to_hp?
    @hp_drain = @hp_damage if item.damage.drain?
    @mp_drain = @mp_damage if item.damage.drain?
    @tp_drain = @tp_damage if item.damage.drain?
    @hp_drain = [@battler.hp, @hp_drain].min
    @success = true if item.damage.to_hp? || @mp_damage != 0 || @tp_damage != 0
  end
end
I tried messing around with the script, but I keep getting the following error
1728415865199.png

This is the skill's page
1728415899899.png

Is it possible I have a script confliction? Or am I missing something/not doing something correct within the script itself.
The error means that you called a function that has two arguments - function(a,b) - with three arguments given - function(a,b,c)

unless you personally wrote that line into that TP script this usually means that said script requires another script installed above that redefined said function - usually a missing core or main script.

Since that is also not expected here this means that @Roninator2 needs to bughunt his script
Is it possible I have a script confliction? Or am I missing something/not doing something correct within the script itself.
Put this script lower down the list.
You may still have compatibility issues as I overwrote the make damage for Game_ActionResult.

Maybe I need to look at having that fixed.
Script change above. Should work now
Put this script lower down the list.
You may still have compatibility issues as I overwrote the make damage for Game_ActionResult.

Maybe I need to look at having that fixed.
Script change above. Should work now
That's a wise decision. In case like the one above, the scripter should always prefer to add new parameters at the end of the list, not in the middle of the list, and make them optional by setting default values. OR use @instance variables and set an initial value somewhere in his or her code.

I had been wondering if the OP had removed the final part of the code, namely Game_ActionResult. If that was not the case, script order would matter A LOT here.
I'm noticing some compatibility issues with the Yanfly Battle system, namely the damage number popups not appearing. I went into a fresh project with just those two scripts and it still happens. I'm gonna assume it's something with the Game_ActionResult class (hardly any Ruby knowledge just guessing)? I wouldn't wanna ask to rework the script to work with another unrelated script, but is there anything that works as a quick fix?
but is there anything that works as a quick fix?
Adding in Yanfly battle system I can see the issue.
I'm also overwriting the execute damage and that's where yanfly calls the make popup.
So put my script above yanfly battle engine.
I've found the problematic script. I forget where I got it from (the script doesn't have any names in it either), but it's a script that stores damage taken as a variable. I even had to prune it myself (commenting out certain lines) to make it work with Yanfly. Attached is the version I have with the commented lines.
The TP damage script works perfectly when this one isn't in, however.
Ruby:
ActorDamageIDStart = 1

class Game_Battler < Game_BattlerBase

  # Make these available to be read by anyone (and set too just in case)
  attr_accessor :hp_damage_last, :hp_damage_turn, :hp_damage_battle
 
  alias :initialize_remember_damage :initialize unless $@
  alias :execute_damage_remember_damage_actor :execute_damage unless $@
  def initialize(*args)
    initialize_remember_damage(*args)
     #Set our last damage taken arguments to zero
    @hp_damage_last = @hp_damage_turn = @hp_damage_battle = 0
  end
 
  # When the battler takes damage remember that HP damage
  alias :execute_damage_remember_damage :execute_damage unless $@
  def execute_damage(user)
    # Call the original method
    execute_damage_remember_damage(user)
       
    # We want to record damage only, not healing
    return if @result.hp_damage <= 0
    # Remember this actor's last damage taken, override last value
    @hp_damage_last = @result.hp_damage
    # Add to the cumulative turn damage here
    @hp_damage_turn += @result.hp_damage
    # And add to the battle cumulative damage here
    @hp_damage_battle += @result.hp_damage    
  end

 
#class Game_Actor < Game_Battler

 
  def execute_damage(user)
    # Call the original method so hp damage is applied correctly
    execute_damage_remember_damage_actor(user)
   
    # We want to record damage only, not healing
    return if @result.hp_damage <= 0
   
    # We want to remember the damage taken in variables too, do so here
    #index = (@actor_id - 1) * 3 + ActorDamageIDStart
    # Remember this actor's last damage taken, override last value
    $game_variables[583] = @hp_damage_last * 0.50
    # Add to the cumulative turn damage here
    $game_variables[index + 1] = @hp_damage_turn
    # And add to the battle cumulative damage here
    $game_variables[index + 2] = @hp_damage_battle
  end
 
end

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # * Battle Start
  #--------------------------------------------------------------------------
  alias :battle_start_remember_damage :battle_start unless $@
  def battle_start
    # Call the original method
    battle_start_remember_damage
    # And wipe everybody's battle-scope damage
    $game_party.members.each { |member| member.hp_damage_battle = 0 }
    $game_troop.members.each { |member| member.hp_damage_battle = 0 }
  end
  #--------------------------------------------------------------------------
  # * Start Turn
  #--------------------------------------------------------------------------
  alias :turn_start_remember_damage :turn_start unless $@
  def turn_start
    # Call the original method
    turn_start_remember_damage
    # And wipe everybody's turn-scope damage
    $game_party.members.each { |member| member.hp_damage_turn = 0 }
    $game_troop.members.each { |member| member.hp_damage_turn = 0 }
  end
 
end
The reason is very simple: your nameless script overwrites Game_Battler's execute_damage method. This means the tp control script gets ignore during that part of the damage processing.
The TP damage script works perfectly when this one isn't in, however.
I remember you talking about this script.
It looks a lot messier now than it did before. But I honestly don't see why it causes an issue as it is still aliasing.
But really you have the method in twice and it will never do the first one.

But if there really is a problem, then add in the unique code to my script and it should keep working after you delete all of the execute_damage methods in that script.
Ruby:
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage.to_i
    self.mp -= @result.mp_damage.to_i
    self.tp -= @result.tp_damage.to_i
    user.hp += @result.hp_drain.to_i
    user.mp += @result.mp_drain.to_i
    user.tp += @result.tp_drain.to_i
    # We want to record damage only, not healing
    return if @result.hp_damage <= 0
 
    # We want to remember the damage taken in variables too, do so here
    #index = (@actor_id - 1) * 3 + ActorDamageIDStart
    # Remember this actor's last damage taken, override last value
    $game_variables[583] = @hp_damage_last * 0.50
    # Add to the cumulative turn damage here
    $game_variables[index + 1] = @hp_damage_turn
    # And add to the battle cumulative damage here
    $game_variables[index + 2] = @hp_damage_battle
  end

But I played with that script a bit and this worked better for me.
Spoiler: unknown
Ruby:
ActorDamageIDStart = 1
EnemyDamageIDStart = 80

class Game_Battler < Game_BattlerBase

  alias :execute_damage_remember_damage_actor :execute_damage unless $@
  def execute_damage(user)
    # We want to record damage only, not healing
    if @result.hp_damage > 0# && user.is_a?(Game_Actor)
      
      # We want to remember the damage taken in variables too, do so here
      index = (user.id - 1) * 3 + ActorDamageIDStart if user.is_a?(Game_Actor)
      index = (user.enemy_id - 1) * 3 + EnemyDamageIDStart if user.is_a?(Game_Enemy)
      # Remember this actor's last damage taken, override last value
      $game_variables[index + 0] = @result.hp_damage
      # Add to the cumulative turn damage here
      $game_variables[index + 1] += @result.hp_damage
      # And add to the battle cumulative damage here
      $game_variables[index + 2] += @result.hp_damage
    end
    # Call the original method so hp damage is applied correctly
    execute_damage_remember_damage_actor(user)
  end
  
end

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # * Battle Start
  #--------------------------------------------------------------------------
  alias :battle_start_remember_damage :battle_start unless $@
  def battle_start
    # Call the original method
    battle_start_remember_damage
    # And wipe everybody's battle-scope damage
    $game_party.members.each { |m| ($game_variables[(m.id - 1) * 3 + ActorDamageIDStart + 1] = 0) }
    $game_troop.members.each { |m| ($game_variables[(m.enemy_id - 1) * 3 + EnemyDamageIDStart + 1] = 0) }
  end
  #--------------------------------------------------------------------------
  # * Start Turn
  #--------------------------------------------------------------------------
  alias :turn_start_remember_damage :turn_start unless $@
  def turn_start
    # Call the original method
    turn_start_remember_damage
    # And wipe everybody's turn-scope damage
    $game_party.members.each { |m| ($game_variables[(m.id - 1) * 3 + ActorDamageIDStart + 2] = 0) }
    $game_troop.members.each { |m| ($game_variables[(m.enemy_id - 1) * 3 + ActorDamageIDStart + 2] = 0) }
  end
  
end
Now to test it in the project with my TP damage script.
--- yep seems to work ok.
Script order
TP Damage
Yanfly Battle
This (whatever it is) script
Everything works in the order you provided, thank you.
The unnamed script is meant to store damage taken as a variable. I used this because I have a character with a counter effect, but I didn't want him countering a whole attack's worth of damage. So, I'd store the damage he'd taken, multiply it by 50%, and set it to the damage to be reflected back using Tsukihime's Thorn Armor Script.
The reason I had to prune it before is because, when used with Yanfly, the variable would never store properly and would remain zero. I actually just went and tested everything in the test project I have and the variable is still being stored as zero rather than the damage taken. I might just have to cut my losses and try and find another work around for the counter character or just give him a new gimmick entirely.
Unless there's some script hidden away on the far corners of the internet I don't know about.
Regardless, thank you all very much for your help.
VX Ace doesn't have, a built-in function to reduce TP directly. You’ll need a script for that.I’d suggest checking out Yanfly's TP Manager, it allows for TP reduction through skills and more control over TP in general.It's quite flexible and should solve your issue. Alternatively, you could increase TP skill costs instead of reducing TP directly.That way, players are still forced to manage their TP wisely😉.
The reason I had to prune it before is because, when used with Yanfly, the variable would never store properly and would remain zero.
Did you try the version I just posted? or was that with your version?
The script I just posted (nameless script) is working in a test project for me.
I used the one you posted. Lemme gather my screenshots.
1728701403519.png
1728701454820.png
1728701549403.png
1728701585730.png


I have both the variable in the damage and in the battle processing just to check if it'd be stored.
Could I possibly see what you did? I may just be missing something or have a small clerical error.

Original thread: https://forums.rpgmakerweb.com/threads/making-a-skill-that-reduces-tp.172334/