help with healing spell

I want to make a mechanic that when the player has less than 75%, no matter what spell you select, it will be always the healing spell, I don't know how to make a script to make that happen, can someone help?

I've moved this thread to RGSS3 Script Requests. Thank you.

I want to make a mechanic that when the player has less than 75%, no matter what spell you select, it will be always the healing spell, I don't know how to make a script to make that happen, can someone help?
Less than 75% what? HP?

And is this only to apply to *spells* or to *any skill*?
Less than 75% what? HP?

And is this only to apply to *spells* or to *any skill*?
yes, 75% of hp, and I will prefer to only spells, I'll try to puto other types of skills
Well, why would you limit the hero's abilities like that?
What if they've been waiting to deal the final blow to a mobster or mini boss and instead of taking advantage of it, they get cured only moments before the foe reacts killing a fellow hero?
What I mean here is that even you idea, no matter how well intended it might be, gotta have some limitations.

From a gamer's viewpoint, I can tell you I would stop playing the game for ruining the game experience with such a weird and unjustified feature.
Well, why would you limit the hero's abilities like that?
What if they've been waiting to deal the final blow to a mobster or mini boss and instead of taking advantage of it, they get cured only moments before the foe reacts killing a fellow hero?
What I mean here is that even you idea, no matter how well intended it might be, gotta have some limitations.
The way that at this moment the magic works is that is too strong and I want to add that nerf to prevent the spam of using it and for a intended joke in the game
Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
    should_replace = @subject.hp_rate < 0.75 && intended_item.magical?
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
    should_replace = @subject.hp_rate < 0.75 && intended_item.magical?
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
I put it and didn't work
I put it and didn't work
Where did you put it?

Also you need to change 26 in the module to the ID of your heal spell, if you haven't already.
Where did you put it?

Also you need to change 26 in the module to the ID of your heal spell, if you haven't already.
1678302402158.png

Here, and I know that is the base healing spell, but still should work I think
View attachment 255462
Here, and I know that is the base healing spell, but still should work I think
Okay, and when you try to use a spell below 75% HP it doesn't switch to the healing spell? Your actor *has* the spell in their list, yes?
Okay, and when you try to use a spell below 75% HP it doesn't switch to the healing spell? Your actor *has* the spell in their list, yes?
yes
Strange, it works fine on my end. You're not using any other scripts that affect battles are you?
I put it on a brand new project and still didn't work
Strange, it works fine on my end. You're not using any other scripts that affect battles are you?
I put it on a brand new project and still didn't work
Can you show me screenshots of your actor/class with the spell included? Also change the script to this:

Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
puts intended_item
    should_replace = @subject.hp_rate < 0.75 && intended_item.magical?
puts should_replace
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
puts item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end

and screenshot the output from the console for me.
Can you show me screenshots of your actor/class with the spell included? Also change the script to this:

Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
puts intended_item
    should_replace = @subject.hp_rate < 0.75 && intended_item.magical?
puts should_replace
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
puts item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end

and screenshot the output from the console for me.
It wroked! just one last thing that I forgot, I want to add a massage from de Actor when this happen, just add that line
It wroked! just one last thing that I forgot, I want to add a massage from de Actor when this happen, just add that line
...what did you change that made it go from not working to working?

When you say "add a message from the actor" what do you need exactly?
I just put the new script and it worked

And I want that the actor says something like "f*ck that order, I'm gonna heal myself" just before do it
...what did you change that made it go from not working to working?

When you say "add a message from the actor" what do you need exactly?
I just put the new script and it worked

And I want that the actor says something like "f*ck that order, I'm gonna heal myself" just before do it
Do you want a face graphic or anything with it?
Do you want a face graphic or anything with it?
yes please, just a face graphic

Original thread: https://forums.rpgmakerweb.com/threads/help-with-healing-spell.155572/