Hime's Untargetable State script being affected by skills

I'm wondering if there's a way to change the untargetable script to make it so that battlers can still be affected by skills, i.e. being inflicted with states or healing themselves.
For example, I have a battler that becomes untargetable for a few turns, and in that time, it can only use heals on itself. However, the script doesn't allow that. The battler simply doesn't do anything since the heal targets the user, who is currently untargetable.
I have zero experience in changing scripts so I hope someone could help me out with this.
and how would you define which skills should remain targetable and which not?

the computer does not know if the result of a skill is healing or damaging, especially not before the damage formula is even processed.

making the untargetable effect selective is much more complex than simply blocking everything.
and before that can even be attempted, you would have to find a computer-processable definition on which targets should be allowed and which not.
I'm wondering if there's a way to change the untargetable script to make it so that battlers can still be affected by skills, i.e. being inflicted with states or healing themselves.
For example, I have a battler that becomes untargetable for a few turns, and in that time, it can only use heals on itself. However, the script doesn't allow that. The battler simply doesn't do anything since the heal targets the user, who is currently untargetable.
I have zero experience in changing scripts so I hope someone could help me out with this.
Perhaps add some type of burst heal or regeneration to the untargetable state?
*edit
Upon further looking it will take quite some editing to make all possibilities work.
Uhh, quite some time passed since I have done this but...

Here is a little addon for you:
Spoiler
Code:
=begin

- Ignore Untargetable States v1.0
- Made by: Sixth
- Requires: Tsukihime's Untargetable State

- Description:

Allows you to create specific items and skills that can bypass the untargetable
state from Tsukihime's script.

To make an item/skill bypass the untargetable state, use this note-tag on it:

  <ignore_untargetable>
 
Just like that.

- Installation:

Place this script right below Tsukihime's Untargetable State script!

=end

class RPG::UsableItem < RPG::BaseItem

  attr_accessor :ignore_untrg
 
  def ignore_untrg
    init_ignore_untrg if @ignore_untrg.nil?
    return @ignore_untrg
  end
 
  def init_ignore_untrg
    @ignore_untrg = @note =~ /<ignore_untargetable>/i ? true : false
  end
 
end

class Game_Action
    
  alias bypass_untrg5231 make_targets
  def make_targets
    return th_untargetable_state_make_targets if item.ignore_untrg
    return bypass_untrg5231
  end

end

class Game_Battler < Game_BattlerBase

  alias bypass_untrg6351 untargetable_state?
  def untargetable_state?
    return false if BattleManager.actor &&
    BattleManager.actor.current_action.item.ignore_untrg
    return bypass_untrg6351
  end
 
end

# End of script! o.o
This should probably work for you. Probably.
Uhh, quite some time passed since I have done this but...

Here is a little addon for you:
Spoiler
Code:
=begin

- Ignore Untargetable States v1.0
- Made by: Sixth
- Requires: Tsukihime's Untargetable State

- Description:

Allows you to create specific items and skills that can bypass the untargetable
state from Tsukihime's script.

To make an item/skill bypass the untargetable state, use this note-tag on it:

  <ignore_untargetable>
 
Just like that.

- Installation:

Place this script right below Tsukihime's Untargetable State script!

=end

class RPG::UsableItem < RPG::BaseItem

  attr_accessor :ignore_untrg
 
  def ignore_untrg
    init_ignore_untrg if @ignore_untrg.nil?
    return @ignore_untrg
  end
 
  def init_ignore_untrg
    @ignore_untrg = @note =~ /<ignore_untargetable>/i ? true : false
  end
 
end

class Game_Action
   
  alias bypass_untrg5231 make_targets
  def make_targets
    return th_untargetable_state_make_targets if item.ignore_untrg
    return bypass_untrg5231
  end

end

class Game_Battler < Game_BattlerBase

  alias bypass_untrg6351 untargetable_state?
  def untargetable_state?
    return false if BattleManager.actor &&
    BattleManager.actor.current_action.item.ignore_untrg
    return bypass_untrg6351
  end
 
end

# End of script! o.o
This should probably work for you. Probably.
This is exactly what I was looking for and it worked perfectly!
Thank you very much!

Original thread: https://forums.rpgmakerweb.com/threads/himes-untargetable-state-script-being-affected-by-skills.150025/