Making a skill that reduces TP?

Spoiler: Test images
1728783184481.png

1728783212260.png

After escaping the next round. 114 + 118 = 232

1728783530601.png

I changed this to be exactly like what you have and it still works.

I think what you are trying to do is reflect the damage the actor takes back to the enemy.
The issue is that the unknown script doesn't record damage dealt by the enemies or damage received to the actor, it saves the damage dealt by the actor to the enemies.
The original version of the script does that and my edited one does that.

I will work on changing the unknown script as that seems to be your goal.
Updated in spoiler in my post above.
YES! OH MY GOODNESS IT WORKS!
Thank you so much for your help! I know it was a lot of back and forth, but I appreciate all your help!
This isn't for some super serious project or anything, but it's really therapeutic for me to make, I just kept getting caught up in some script issues. But I can finally continue.
Well
I ran into another issue that was unexpected until I had time to mess around in the game and TP Damage breaks the crystal engine Job Levels script that is already broken in its own right that I had to have someone fix for me. I'll attach the working version to this post.
With the script fixed, it's supposed to level up a character's job when a certain JP threshold is reached. I made sure to mess around with things and, when cutting TP manager, the script works again. But, when it's present, jobs do not level up as they should. I didn't bother bringing it up because I doubted they'd interact in any way shape or form, but here we are.
I'm at a loss at where they even conflict. I thought it might be with Game_Battler and Game_Actor, but my Ruby is surface level in knowledge. Any help would be appreciated.
Code:
#==============================================================================
# Crystal Engine - Job Levels
#------------------------------------------------------------------------------
# Current Version: 1.00
#==============================================================================
$imported = {} if $imported.nil?
$imported["CE-JobLevels"] = true
=begin
in Final Fantasy III, V, and Tactics Jobs had there own level
with this script I duplicated the systems used in FFT and FFIII
every job uses jp to level up it although uses the total number
to level up a job use the script call
$game_actor[id].level_up_job(levels, class_id)
class_id can be left blank and it will use the current class
=end
if  $imported["YEA-JPManager"] # YOU MUST HAVE YEA - JP MANAGER TO USE THIS SCRIPT!
module CRYSTAL
  module JOB_LEVELS
    FFIII_STYLE = false #In this format you need 100jp to level up every level
    
    MAX_LEVEL = 5 #the maximum level a job level can reach
    
    MAX_LEVEL_STRING = "Infinite"
    
    # Warning! The following causes JP to be given  to be given to the subclass
    # every time jp is given to your primary class, be warry
    SUBLCASS_GAIN_JP = 0.50 # the rate for JP gain for subclasses 0.00 no JP.
    
    # the message used for leveling up a job
    # Name, Job
    LEVEL_UP_MESSAGE = "%s leveled up their %s class!"
    
    #--------------------------------------------------------------------------
    # this is the way job level is diplayed in the menu
    # 0 = class
    # 1 = class lv x
    # 2 = class lv x JP y/z
    # 3 = class JP x/y
    #--------------------------------------------------------------------------
    DRAW_JOB_LEVEL_STYLE = 2
    
    FFT_STRUCTURE = []
    #here you set the jp needed to gain a level
    FFT_STRUCTURE[1] = 100
    FFT_STRUCTURE[2] = 400
    FFT_STRUCTURE[3] = 700
    FFT_STRUCTURE[4] = 1100
    FFT_STRUCTURE[5] = 1600
    FFT_STRUCTURE[6] = 2200
    FFT_STRUCTURE[7] = 3000
    FFT_STRUCTURE[8] = "Infinite"
  end
end
#==============================================================================
# Editing beyond this point may cause stone, zombie, mist frenzy, and/or toad,
# so edit at your own risk.
#==============================================================================


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================


class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :jp_total                     # JP
  attr_accessor :job_level                    # Level
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias job_setup setup
  def setup(actor_id)
    job_setup(actor_id)
    @jp_total = []
    @job_level = []
    for i in 1..$data_classes.size
      @job_level[i] = 1
      @jp_total[i] = 0
    end
  end
  #--------------------------------------------------------------------------
  # new method: gain_jp
  #--------------------------------------------------------------------------
  def gain_jp(jp, class_id = nil)
    init_jp if @jp.nil?
    class_id = @class_id if class_id.nil?
    @jp[class_id] = 0 if @jp[class_id].nil?
    @jp_total[class_id] = 0 if @jp[class_id].nil?
    @jp[class_id] += jp.to_i
    @jp_total[class_id] += jp.to_i
    @jp[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @jp_total[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @battle_jp_earned = 0 if @battle_jp_earned.nil? && $game_party.in_battle
    @battle_jp_earned += jp.to_i if $game_party.in_battle
    if @subclass_id > 0 && class_id = @class_id
      @jp[@subclass_id] = 0 if @jp[@subclass_id].nil?
      @jp_total[@subclass_id] = 0 if @jp[@subclass_id].nil?
      jp *= CRYSTAL::JOB_LEVELS::SUBCLASS_GAIN_JP
      @jp[@subclass_id] += jp.to_i
      @jp_total[@subclass_id] += jp.to_i
      @jp[@subclass_id] = [[@jp[@subclass_id], YEA::JP::MAX_JP].min, 0].max
      @jp_total[@subclass_id] = [[@jp[@subclass_id], YEA::JP::MAX_JP].min, 0].max
      determine_job_level(@subclass_id)
    end
  end
  #---------------------------------------------------------------------------
  # determines if the class can level up
  #---------------------------------------------------------------------------
def determine_job_level(class_id)
  return if @job_level[class_id] >= CRYSTAL::JOB_LEVELS::MAX_LEVEL


  # Determine the amount of JP needed for the next level
  jp_needed = if CRYSTAL::JOB_LEVELS::FFIII_STYLE
                100 * @job_level[class_id]
              else
                CRYSTAL::JOB_LEVELS::FFT_STRUCTURE[@job_level[class_id]]
              end


  # Check if the total JP is sufficient for leveling up
  if @jp_total[class_id] >= jp_needed
    @job_level[class_id] += 1


    # Show level up message
    $game_message.add(sprintf(CRYSTAL::JOB_LEVELS::LEVEL_UP_MESSAGE, @name, $data_classes[class_id].name))
  end
end
  #---------------------------------------------------------------------------
  # Level_up_a_job
  #---------------------------------------------------------------------------
  def level_up_job(levels, class_id)
    if @job_level[class_id] < CRYSTAL::JOB_LEVELS::MAX_LEVEL
      @job_level[class_id] += levels
      fmt = CRYSTAL::JOB_LEVELS::LEVEL_UP_MESSAGE
      text = sprintf(fmt, @name, $data_classes[class_id].name)
      $game_message.add(text)
      if CRYSTAL::JOB_LEVELS::FFIII_STYLE
        unless @jp_total[class_id] >= 100 * @job_level[class_id]
          @jp_total[class_id] = 100 * @job_level[class_id]
        end
      else
        unless @jp_total[class_id] >= CRYSTAL::JOB_LEVELS::FFT_STRUCTURE[@job_level[class_id]]
          @jp_total[class_id] = CRYSTAL::JOB_LEVELS::FFT_STRUCTURE[@job_level[class_id]]
        end
      end
    end
  end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a super class of all windows within the game.
#==============================================================================


class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Class
  #--------------------------------------------------------------------------
  def draw_actor_class(actor, x, y, width = 112)
    change_color(normal_color)
    case CRYSTAL::JOB_LEVELS::DRAW_JOB_LEVEL_STYLE
    when 0
      string = actor.class.name
    when 1
      string = "#{actor.class.name} Lv #{actor.job_level[actor.class_id]}"
    when 2
      if CRYSTAL::JOB_LEVELS::FFIII_STYLE
        if actor.job_level[actor.class_id] < CRYSTAL::JOB_LEVELS::MAX_LEVEL
          jp_needed = 100 * actor.job_level[actor.class_id]
        else
          jp_needed = CRYSTAL::JOB_LEVELS::MAX_LEVEL_STRING
        end
      else
        jp_needed = CRYSTAL::JOB_LEVELS::FFT_STRUCTURE[actor.job_level[actor.class_id]]
      end       
      string = "#{actor.class.name} Lv #{actor.job_level[actor.class_id]} #{YEA::JP::VOCAB} #{actor.jp_total[actor.class_id]}/#{jp_needed}"
    when 3
      string = "#{actor.class.name} #{YEA::JP::VOCAB} #{actor.jp_total[actor.class_id]}/#{jp_needed}"
    end
    if $imported["CE-BasicModule"]
      draw_text(x + CRYSTAL::BASIC::MOVE_CLASS_NAME_OVER, y, width, line_height, string)
    else
      draw_text(x, y, width, line_height, string)
    end
  end
end
if $imported["YEA-ClassSystem"]
#==============================================================================
# ■ Window_ClassList
#==============================================================================


class Window_ClassList < Window_Selectable
  #--------------------------------------------------------------------------
  # draw_class_level
  #--------------------------------------------------------------------------
  def draw_class_level(item, rect)
    return if !YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
    return if @actor.nil?
    level = @actor.job_level[item.id]
    contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
    text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
    draw_text(rect, text, 2)
  end
end
end
if $imported["YEA-ClassSystem"] && $imported["YEA-ClassUnlockLevel"] && YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # check_level_unlocked_classes
  #--------------------------------------------------------------------------
  def check_level_unlocked_classes
    for item in $data_classes
      next if item.nil?
      next if unlocked_classes.include?(item.id)
      next if item.level_unlock == {}
      next unless class_unlock_level_requirements_met?(item)
      unlock_class(item.id)
    end
  end
 
  #--------------------------------------------------------------------------
  # class_unlock_level_requirements_met?
  #--------------------------------------------------------------------------
  def class_unlock_level_requirements_met?(item)
    for key in item.level_unlock
      class_id = key[0]
      level_req = key[1]
      return false if class_level(class_id) < level_req
    end
    return true
  end
end
end
else
  msgbox("YEA - JP Manager is needed to use this script.")
  exit
end
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
short answer they do not interact with each other.
You must have another script that is interacting with job levels which is affected by tp damage somehow.
I need to know what your scripts are, or just send me your scripts.rvdata2 file.
I believe this is it. It's mainly a bunch of Yanfly stuff plus or minus some other miscellaneous scripts.
Edit: Oops, just found out I can't post it. Ignore.

The three/four scripts that dictate job levels and things in that realm are as follows:
-Yanfly Engine: Class System
-Yanfly Engine: JP Manager
-Crystal Engine: Job Levels (specifically the edited script above)
-Yanfly Learn Skill Engine (This one doesn't interact with any of the others in a meaningful way, but it is pulling job levels from the Class System script in its evals).
So nothing to do with my script. The Crystal Engine is the problem. It was a reported issue back in 2013 and never fixed it seems.
Put this below Crystal Engine Job Levels
Ruby:
module CRYSTAL
  module JOB_LEVELS
    FFIII_INC = 150 # points required to level up for FFIII style
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # new method: gain_jp
  #--------------------------------------------------------------------------
  def gain_jp(jp, class_id = nil)
    init_jp if @jp.nil?
    class_id = @class_id if class_id.nil?
    @jp[class_id] = 0 if @jp[class_id].nil?
    @jp_total[class_id] = 0 if @jp[class_id].nil?
    @jp[class_id] += jp.to_i
    @jp_total[class_id] += jp.to_i
    @jp[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @jp_total[class_id] = [[@jp[class_id], YEA::JP::MAX_JP].min, 0].max
    @battle_jp_earned = 0 if @battle_jp_earned.nil? && $game_party.in_battle
    @battle_jp_earned += jp.to_i if $game_party.in_battle
    determine_job_level(class_id)
    if @subclass_id > 0 && class_id = @class_id
      @jp[@subclass_id] = 0 if @jp[@subclass_id].nil?
      @jp_total[@subclass_id] = 0 if @jp[@subclass_id].nil?
      jp *= CRYSTAL::JOB_LEVELS::SUBCLASS_GAIN_JP
      @jp[@subclass_id] += jp.to_i
      @jp_total[@subclass_id] += jp.to_i
      @jp[@subclass_id] = [[@jp[@subclass_id], YEA::JP::MAX_JP].min, 0].max
      @jp_total[@subclass_id] = [[@jp[@subclass_id], YEA::JP::MAX_JP].min, 0].max
      determine_job_level(@subclass_id)
    end
  end
  #---------------------------------------------------------------------------
  # determines if the class can level up
  #---------------------------------------------------------------------------
  def determine_job_level(class_id)
    if @job_level[class_id] < CRYSTAL::JOB_LEVELS::MAX_LEVEL
      if CRYSTAL::JOB_LEVELS::FFIII_STYLE
        if @jp_total[class_id] >= CRYSTAL::JOB_LEVELS::FFIII_INC * @job_level[class_id]
          @job_level[class_id] = (@jp_total[class_id] / CRYSTAL::JOB_LEVELS::FFIII_INC).to_i + 1
        end
      elsif @jp_total[class_id] >= CRYSTAL::JOB_LEVELS::FFT_STRUCTURE[@job_level[class_id]]
        CRYSTAL::JOB_LEVELS::FFT_STRUCTURE.each_with_index { |value, key|
        next if value == nil
        next if key < @job_level[class_id]
          @job_level[class_id] = key.to_i if value.is_a?(Integer) && value <= @jp_total[class_id]
          @job_level[class_id] += 1 if value.is_a?(String)
        }
      end
    end
  end
end
Yup, it all works. Thanks so much!
That should be all for this thread.
You've been a huge help!
This thread is closed due to being indicated as solved. If you need it reopened, report the thread to let us know. Thank you!

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