シンプルなイベント駆動型の製作セッションを管理するプラグイン – SimpleCrafting.js

タイトル
Manages a simple, event-driven crafting session.
作者名
ヘルプ
=== About ===
The Simple Crafting plugin allows you to easily componse a game event
with crafting functionality. Simple crafting involves supplying a series
of game items in a specific sequence and results in acquiring one or more
items. Items supplied as ingredients in the crafing recipie will be removed
from the party inventory as they are added to the crafting session. If the
crafting session fails due to no matching recipie being found, the supplied
ingredients will be returned to the player inventory if the [Return Items]
script parameter is set to 'true'.

There are no ability attributes associated with crafting. The ability to craft
is based solely on access to the required ingredients and knowledge of the
recipe's crafting order (along with access to the event containing the crafting commands).

=== Recipe Data File ===
You'll need to create a new CraftingRecipes.json file in the game's Data folder.
The recipe data format is a simple JSON Array of JSON Objects, following the model of other data files.
A recipe object takes the form of:
{"id":1, "name":"a Striker", "crafts":["Striker"], "ingredients":["Flint", "Iron"]}

==Example CraftingRecipes.json File==
[
null,
{"id":1, "name":"a Striker", "crafts":["Striker"], "ingredients":["Flint", "Iron"]},
{"id":2, "name":"some Sparkpowder", "crafts":["Sparkpowder","Sparkpowder","Sparkpowder"], "ingredients":["Iron", "Sulfur", "Stinger"]},
{"id":3, "name":"a Crude Bomb", "crafts":["Crude Bomb"], "ingredients":["Hide", "Slime Residue", "Striker", "Sparkpowder"]}
]

Each recipe has the following properties:
id # The index number of the recipe; increment this for each new recipe added.
name # The name of the recipe; useful to store in sentence format for display in text messages.
crafts # The array of item names created by the recipe.
ingredients # The array of item names used in the recipe.

=== Crafting Session Event ===
The actual crafting session that the player experiences is presented from an event.
It is suggested that you create a new Common Event for crafting and execute it from
a Map Event on an appropriate crafting-station-looking tile.

The event might begin with a text mesage from the character announcing the beginning of the
crafting session to the player. The first step in crafting is then to call the "SimpleCrafting begin"
Plugin Command. This clears the last crafted recipe name and prepares a new crafting session.
Next you will want to add a Label named something like "CraftingStart" to indicate the point
in the event where the player makes selections. Following this label you may then want to show
the contents of the current crafting session. See the "Text Message Slash Commans" section below
for an example.

The next important step is to add a Show Choices command to the event. The choices in the list
should be "Add Item", "Begin Crafting", and "Cancel" or something similar. Under the "Add Item"
choice you will add a Select Item command and set the selected item to a particular game variable;
pay attention to the Id number of the variable you select. Follow the Select Item command with
the Plugin Command "SimpleCrafting add varId" where "varId" is replaced with the Id number of the
variable you set with the Select Item command. Finally, use a JumpToLabel command to return to
the "CraftingStart" label.

Under the "Begin Crafting" choice you may wish to show some text and/or begin playing sounds
and animations, or shaking the screen to indicate that crafting is underway. The important step
is to call the Plugin Command "SimpleCrafting craft swId" where "swId" is the Id number of a
game switch which holds the result of the crafting attempt. Now you can follow the Plugin command
with an If-Then-Else condition that tests if the specified game switch is on. If the switch is on
the crafting succeeded and the party gained an item. You can display text and sounds to indicate this.
The name of the recipe crafted is available in your text message via a slash command (see below).
If the switch is off then the crafting failed because no matching recipe was found. In this case the
items used in the crafting attempt are returned to the party inventory if the Return Items parameter
is set to true in the plugin. If the Return Items parameter is set to false then the items used
in the crafting attempt are lost when the attempt fails.

Under the "Cancel" choice you can simply place the Plugin Command "SimpleCrafting cancel". This
will return any items which may have already been added to the session.

=== Plugin Commands ===
SimpleCrafting begin # Start a new crafting session
SimpleCrafting add varId # Add the item Id stored in variable # varId to the recipe
SimpleCrafting cancel # End the crafting session without crafting
SimpleCrafting count varId # Place the count of current ingredients in variable # varId
SimpleCrafting craft # Attempt to craft an item with the current ingredients
SimpleCrafting restart # Restarts the session, returning any selected ingredients

=== Text Message Slash Commands ===
\CItem[n] # Display the name of the nth ingredient currently selected.
Returns an empty string if no item has been selected in that slot.

\CCount # Display the number of ingredients currently selected.

\CLast # Display the name of the last successfully crafted recipe.

You can use the slash commands in your crafting event's text messages to display
the currently selected crafting contents. An example would be the text:

\>\CCount Ingredients Selected:
\>\CItem[0] \CItem[1] \CItem[2]
\>\CItem[3] \CItem[4] \CItem[5]
\>\CItem[6] \CItem[7] \CItem[8]

This displays the count of currently selected ingredients along with the
names of up to the first nine items. If an item does not yet exist an
empty string will be returned instead.

If you have recipes with more than nine ingredients you can add a second
text message window inside an If-Then condition. Using the script command
"count" you can get the current count of ingredients set to a variable and
then check that variable value in the If condition.
パラメータ
version 1.0.0
license MIT

param Return Items
desc Return the items used in the crafting attempt if no matching recipe was found.
default true

ライセンス表記
  • MIT License

紹介ページ https://github.com/ReedKimble/RMMV/blob/master/SimpleCrafting.js