Different escape problem

So I want the Escape skill to use a Smoke Bomb in the inventory. Is that possible?
Do you also want it to be unavailable if the player has no smoke bomb?
Yes.
I remember I tried to do something like that whereby there would be a smoke bomb in the party's inventory. When I used it, it would cause the party to escape from battle. I tied this escape skill to a common event through the skill database (I think I made use of a common event script for when in battle scenes) and when used aborted the player from battle. It didn't show an actual smoke bomb effect but it did trigger an escape when the item, smoke bomb, was used.
I can present a couple solutions. But depending on how many skills use items, it might be worth reconsidering how you setup the game.


A ) Band-aid eventing solution:
1. Setup a common event in the skill to reduce the number of smoke bombs by one and abort battle.
2. Setup a dummy duplicate skill with a "Never" occasion immediately before / after the actual skill.
3. Setup a second common event. This CE2 has an if-then-else conditional based on the number of smoke bombs in inventory.

If smoke bomb > 0, Then learn actual skill and forget dummy skill, Else learn dummy skill and forget actual skill.

4. For all of your troop pages, have: 1) a tab that runs on turn 0; and 2) a tab that runs at the end of each turn. Add the CE2 to both tabs so that the CE2 can recheck whether the skill is available each turn.


B ) Script solution:
Yanfly's Skill Cost Manager. But I don't know if Yanfly will clash with what you're using.


PS: I'd add a variable in the skill description to show the number of smoke bombs in the inventory.​
Another script that could help is Hime's Custom Use Conditions. The skill will only be usable when there is at least one bomb in inventory (you'd have to set up the notetag with a formula, e.g. what I used in my project: "formula: $game_party.item_number($data_items[ID]) > 0"). You'd have to have a common event that would decrease the number of smoke bombs in inventory, like the13thsecret says.

I also agree that it's a good idea to add how many smoke bombs are left in the skill description (you'd need to update the variable in the common event after the bomb is subtracted, and use "\V[n]" in the item description window, jsut like you would use in the message window).
So I want the Escape skill to use a Smoke Bomb in the inventory. Is that possible?
Change the effects for the escape skill to call a common event not special effect: escape
then in the common event do a check for the item in inventory. conditional branch
If item exists run script command BattleManager.process_escape for the chance to escape or
BattleManager.process_abort for 100% escape.
else show a message ($game_message.add("this message")
@the13thsecret I have Yanfly Skill Cost Manager but it only seems to work on HP, MP, TP, and Gold. @EntangledPear It says it works on items but I don't see a way to add items for a skill. Just weapons, armor, actor's class, state, and skill. @Roninator2 I tried your way but it just abruptly exit the battle with no escape effect.
@Roninator2 I tried your way but it just abruptly exit the battle with no escape effect.
Maybe tailor it so that an animation plays and a message shows saying that you escaped.
plus you will probably have to subtract a smoke bomb from the inventory.
I thought you want to have a skill that only works when you have an item and consumes that item, not that the item is used and has a certain effect. Did I misunderstand?
@the13thsecret I have Yanfly Skill Cost Manager but it only seems to work on HP, MP, TP, and Gold.​

One of the images on Yanfly's page showed the custom notetags required to make a skill paid for in potions. Just change a couple numbers and tada!

#For skill display during battle
<custom cost: 3x> #display letters / numbers for cost requirement (you'll change to 1x)
<custom cost colour: 0> #change color for custom cost letters / numbers
<custom cost size: 16> #change font for custom cost letters / numbers
<custom cost icon: 192> #display an icon (you'll change to smoke bomb icon ID)

#Checks whether a skill should be available or grayed out
<custom cost requirement>
$game_party.item_number($data_items[1])>= 3 #you'll change [1] to [smoke bomb item ID]; and >= 3 to >= 1 since you only need 1 smoke bomb.
</custom cost requirement>

#Executes the command when skill is performed
<custom cost perform>
$game_party.lose_item(($data_items[1]), 3) #you'll change [1] to [smoke bomb item ID]; and , 3 to , 1 since you only need 1 smoke bomb.
</custom cost perform>​
@EntangledPear Yes, I want a skill that uses up a smoke bomb item. But there doesn't seem to be one for items. Unless it's the formula one. Anyways I just did the one the13thsecret said.
@the13thsecret Thanks. Got it to work.

Original thread: https://forums.rpgmakerweb.com/threads/different-escape-problem.152413/