Jump to content
Szibes

Calculating skill MP cost AFTER using skill

Recommended Posts

I apologize for any missused words or grammatical errors.

In my project there's a mechanic (which uses Yanfly LPP Empower) that lowers character's stats depending on how much MP they have left. 

It means that, for example, if character has 50% of MP, their ATK is decreased by 50%.

 

The problem is, by default engine takes MP from pool BEFORE performing a skill, which means that evrytime an character uses a skill that costs MP, 

they will be always using skills with lower stats than normal. 

Because my project uses very small numbers (Every actor or enemy has 10 max MP) this change is very noticable, especially with costly skills,

effectively making evry skill in the game deal less damage than they should.

 

So, my question is, can I change base script, so that MP is taken from the MP pool AFTER using a skill?

Share this post


Link to post
Share on other sites

It's just a matter of moving the use item down below the invoke item for the damage.

class Scene_Battle < Scene_Base
  
  def use_item
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
#~     @subject.use_item(item)
#~     refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
    @subject.use_item(item)
    refresh_status
  end
  
end

 

Share this post


Link to post
Share on other sites
15 hours ago, Szibes said:

Enemies still use up their MP before performing skill.

Then you need to put this at the bottom of your script list.

Something else is overwriting this function probably. In my tests it worked exactly as requested.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted