Using Items in battle cost MP

In my game, battle is simillar to Free Turn Battle.
You can perform actions as long, as you have MP. I would like to make items cost MP to use in battle (ONLY IN BATTLE).
Is there any script that does that? Or could someone script it for me?
Or, if this would be easier: Give the "Items" command in battle a cooldown of 1 turn after using an item.
I just want to prevent player from using too much items in one turn.
For temporary, use Himework's Custom Use Formula and place something like this in your item note box

<use conditions>
formula: a.mp > 12
</use conditions>

And you should probably place a.mp -= 12; 0 in your item's damage formula too.

---

Hm, it is possible to notetag items, so let's see...we make a note tag for "mp cost", change how items are display by adding an mp if tagged, and comparing how skills work with how items work. The pay_skill_cost and skill_cost_payable? are things we want to copy (both methods of Game_BattlerBase)...
I have decided to challenge myself, and I have made Items usable with MP! As the OP requested, the items with the notetag will use that much MP in battle, but will not use MP in the menu.

You will use <item_mp: cost > in your Item's notebox. For example, <item_mp: 24 > will make that item cost 24 MP (and unusable if you don't have enough MP). The Item Cost can also be affected by MCR, or the MP Cost Down state, so if that state's MCR is 25%, it will reduce the item's cost from 24 MP to 6 MP. By default, all items will cost 0 MP.

Code:
=begin
#===============================================================================
 Title: ITEM MP COST
 Author: Hime and Harosata
 Created: 2/26/17

Note:  As this was made with Hime's script as a base,
terms of this Script will follow hers.
--------------------------------------------------------------------------------
This script is was made from Himework's Custom Use Conditions.  Based on a request
to subtract MP when using an item, I figured that I could take the concept
of formula: a.mp >= x and make it subtract MP from an item.
I figured that I could take the concept of formula: a.mp >= x
and make it subtract MP from an item.  This is the notetag:

<item_mp: cost >

Place the notetag in your item and the cost of your MP.

If your character does not have the MP for that item, it will be unusable.
For the request, using an item from the Item Menu will not consume MP.

Also, this script can work separately from Himework's Custom Use Conditions,
though if you use her script, you should place hers above mine due to edited
Window_BattleItem stuff.  The MP cost can also be affected by MCR,
found in the MP Cost Down state!
#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_CustomItemCost"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
  module Custom_itemcost
    Regex = /<item_mp:\s*(\d+)\s>/i
  end
end
#===============================================================================
# ** Rest of Script
#===============================================================================
module RPG
  class UsableItem < BaseItem
  
    def itemcost
      load_notetag_itemcost unless @itemcost
      return @itemcost
    end
  
    def load_notetag_itemcost
    
      res = self.note.match(TH::Custom_itemcost::Regex) 
      @itemcost = res ? res[1].to_i : 0
    end
  
  end
end

class Game_BattlerBase
 
  def custom_itemcost_met?(item)
    true
  end
 

end

class Game_Battler < Game_BattlerBase
  alias :th_itemcost_use_item :use_item
  def use_item(item)
    pay_item_cost(item) if item.is_a?(RPG::Item)
    th_itemcost_use_item(item)
  end
 
  def pay_item_cost(item)
    self.mp -= item_mp_cost(item)
  end
 
  def item_mp_cost(item)
    SceneManager.scene_is?(Scene_Battle) ? (item.itemcost * mcr).to_i : 0
  end
 
end

class Game_Actor < Game_Battler
 
  alias :th_itemcost_usable? :usable?
  def usable?(item)
    bool = th_itemcost_usable?(item)
    return false unless bool
    unless @check_itemcost
      @check_itemcost = true
      bool = custom_itemcost_met?(item)
      @check_itemcost = false
    end
    return bool
  end
 

 
  #-----------------------------------------------------------------------------
  #
  #-----------------------------------------------------------------------------
  alias :th_itemcost_custom_itemcost_met? :custom_itemcost_met?
  def custom_itemcost_met?(item)
    return false unless th_itemcost_custom_itemcost_met?(item)
    return true if self.mp  >= item_mp_cost(item)
    return false
  end
end
 
class Window_BattleItem < Window_ItemList
  def enable?(item)
    BattleManager.actor.usable?(item) #and  BattleManager.actor.mp >= BattleManager.actor.item_mp_cost(item) #$game_party.usable?(item)
  end
def include?(item)
   return ($game_party.item_number(item) > 0 and item.battle_ok?) if item.is_a?(RPG::Item) && !item.key_item?
   return $game_party.usable?(item)
  end
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
      draw_item_cost(rect, item)
      draw_item_number(rect, item)
    end
  end
  def draw_item_cost(rect, item)
    return false if item == nil
    if BattleManager.actor.item_mp_cost(item) > 0
      cx = text_size(BattleManager.actor.item_mp_cost(item)).width
      change_color(mp_cost_color, enable?(item))
      draw_text(rect.x + rect.width - cx - 32, rect.y, rect.width, rect.height, BattleManager.actor.item_mp_cost(item))
      change_color(normal_color, enable?(item))
    end
  end
end
It works when I have only items, but this happens after adding weapons and armors to inventory:
94nqRnC.png
Yeah, I changed the include? because at default, it hides the item, so if you have 99 potions but you don't have 50 MP to spend it, you won't see potions. My rewrite shows the potions even if you don't have the MP, though I didn't know that weapons and armor would affect the script.

Try to replace the include? method in my Window_BattleItem with
Code:
  def include?(item)
    return ($game_party.item_number(item) > 0 and item.battle_ok?) if item.is_a?(RPG::Item)
    return $game_party.usable?(item)
  end

Hopefully, if the item is not an Item (meaning it's a weapon or armor), it'll then go to the original code.

Note: If you don't want Key Items to show up, change the above part to if
item.is_a?(RPG::Item) && !item.key_item?
It works now, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/using-items-in-battle-cost-mp.75288/