Crafting/Synthesis While in Combat

Hey everyone.

I'm interested in finding a script that allows a character to craft an item while in combat, and then use the item against the enemy next turn.  These would be simple items like potions, bombs, etc, and would use just two or three ingredients.  This was inspired by The Last Of Us, as you can craft an item in the middle of an encounter and then use it right away.

I have scoured the internet for such a system, and I just have not been able to find anything so far.  I was wondering if there was something I was missing, if there is some combination of scripts that exist that could get the job done, or if I may just be out of luck.  Thanks in advance for the help!
Why do you want to use scripts?


Why not use simple common events and skills?


You need to use a skill anyway to make it an action during combat, no matter how you go at it otherwise.


The first step would be removing the component items from inventory. That is the most problematic step.


Do you want the crafting skill be only available if the components are available? Then you have to implement one of the skill cost scripts available at the master script list and make the skill costing those items.


Without scripts, the components need to be removed by a common event that is executed by the skill, which can result in the loss of an action or a decision if the components are not in inventory.


The second step would be using a common event to add the new item to inventory. That would be done in both cases.


You have to make the common event for the crafting skill differently depending on wether the components are removed by skill cost or by the event.


If they are removed by the event, then you need conditional branches to check if everything is available and remove the components from inventory if all conditions are met. If the conditions are not met, you might use force action to give the crafter a basic attack as replacement, or you can declare that the crafter fails his crafting and has no replacement action.


If the item was crafted correctly you simply add it to inventory by the item commands at the end of the common event.


You need one skill for each possible item to craft, or you need a rather complex common event asking the player to choose recipe (in which case you have to remove the different components by the event and don't need to bother with skill costs.


Having a true crafting screen made by a script AND called during combat might be problematical. There are crafting systems on the master script list, but it would be pure luck if one of them is compatible to several battlescripts (the chances are higher if you're using default battle system)
I appreciate the fast response! I suppose I knew I could use that method already, but there were a few other things that I had not mentioned earlier.

It'd be nice if the player could choose "Craft" from the battle menu and a list of known recipes would appear. Then the player would choose one, and if they had the ingredients for it then the item would be added to their inventory.

If this can be done with just events then that'd be awesome, and until I get it all figured out I will give your method a try Andar. Thanks again!
You can still use CE for that... Just use Yanfly's command manager to add the crafting skill to the actor command window...
Ok, I will definitely give this a go.  I don't have much experience with common events, so we'll see if I can do it.  Thanks!
If you are using a custom crafting scene that script may need a patch so that you can control things like only being able to craft one item (even if it fails), taking up a turn to perform the crafting, etc.


I can write that if you are using a crafting script, but it will be based on my command manager since I want to test something.

Original thread: https://forums.rpgmakerweb.com/threads/crafting-synthesis-while-in-combat.16968/