増補の要件を指定したり、付加する対象にタグを付与するプラグイン – Kaos_AugmentRequirements.js

タイトル
Allows specification of requirements for augments, andthe ability to grant tags to whatever they attach to.
作者名
ヘルプ
============================================================================
Introduction
============================================================================

This plugin is designed to streamline the process of allowing augments of
the same slot type to have different requirement tags which must be present
on an independent item for them to attach successfully. A rejection string
will be displayed in the item's description window if the player attempts to
attach an augment when the requirement tag(s) are not present on the target
item. Augments can also be set to grant tags to the item they are attached
to through notetags.

YEP_X_AttachAugments.js, YEP_X_EquipCustomize, all their pre-requisites, and
NeMV_Tags.js are required for this plugin to work. Place this plugin under
all three of the above named plugins in the plugin manager.

============================================================================
Usage - Notetags
============================================================================
YEP_X_AttachAugments & NeMV_Tags pre-requisites ----------------------------

An item must be declared an augment type and the target item/weapon/armor it
can be attached to must have one or more slots declared for that type. The
valid notetags for these declarations can easily be found in
YEP_X_AttachAugments.js.

The target item/weapon/armor that the augment will attach to must then have
the required tag declared via the valid notetag found in NeMV_Tag.js.

Example:
Augment Item Notetag ->
<Augment: Gun Software>
AGI: +5%
</Augment: Gun Software>

Target Item Notetag ->
<Augment Slots>
Gun Software
</Augment Slots>
<Tags: canFullAuto>

See either respective.js file for more help on this step if needed.

Requirements ---------------------------------------------------------------

Once the augment and target item/weapon/armor are properly declared, it is
time to set the augment to look for the required tag(s). Multiple entries
can be separated by whitespace or commas, but all requirements must be met
for the augment to successfully attach. These are not case sensitive.

Examples:
Augment Item Notetag ->
<Augment Requires Tags: canFullAuto>
... or ...
<Augment Requires Tags: canFullAuto, submachinegun>

Rejection String -----------------------------------------------------------

If the player attempts to attach an agument to a target item/weapon/armor
that does not have the tag(s) it requires, a rejection string will display
in the window that would normally show the description of the
item/weapon/armor in the Equip->Customize description window at the top of
the screen (YEP_X_EquipCustomize.js).

Only a single rejection string can be specified, and all RMMV text codes,
including those from YEP_MessageCore.js if you have it installed, will take
effect.

Examples:
Augment Item Notetag ->
<Augment Rejection String: Software Rejected!>
... or ...
<Augment Rejection String: \ii[183] \C[2]Software Failure:\C[0] Only
Thompson & Flavell weapons are vulnerable to this software hack.>

Results:
Software Rejected!
... or ...
[red ]
[Icon and name of item183] Software Failure: Only Thompson & Flavell
weapons are vulnerable to this software hack.

There is currently no way to specify multiple rejection strings attached to
multiple requirements.

Granted Tags ---------------------------------------------------------------

When an augment with granted tag(s) attaches to an item/weapon/armor, it
will add those tags, along with the prefix "aug_", to the item/weapon/armor.
When the augment is removed, the tag(s) are removed as well. Multiple
entries can be separated by whitespace or commas and are not case sensitive.

Examples:
Augment Item Notetag ->
<Augment Grants Tags: illegalUFM>
... or ...
<Augment Grants Tags: illegalUFM, hacked>

============================================================================
Usage - JavaScript
============================================================================
Independent Item Checks ----------------------------------------------------

Kaos.Augment.hasTag(item, tag, [returnIndex]);

Returns either true (default) or the index of the specified tag if the
independent item/weapon/armor has it, returns false if it does not.
Although this can be used on non-independent items, I would recommend using
Nekoyoubi's [Object].hasTag("plant") instead, from NeMV_Tags.js.
An asterisk can be used to do a partial check, e.g. "illegal".

item == The independent item/weapon/armor you wish to check.
tag == The tag you are searching for (remember granted tags are given the
prefix "aug_" so they can be removed easily later, e.g.: "hacked"
would become "aug_hacked".)
returnIndex == Optional boolean value (true or false), default false. When
set to false, the function will return true if the tag is
present, false if it is not. When set to true, the function
will return the index number of the tag if it is present, and
will still return false if it is not.

Examples:
Kaos.Augment.hasTag($gameActors.actor(1).equips()[0], "aug_hacked");
... or ...
var itemToCheck = $gameActors.actor(3).equips()[3];
var index = Kaos.Augment.hasTag(itemToCheck, "radioactive", true);

The second example would return the index of the "radioactive" tag, and
setting the variable index to that number.

Party Wide Requirement Check -----------------------------------------------

Kaos.Augment.partyItemsWithReq(req);
Returns true if any augments are found that contain the specified req.

req == The requirement you are checking all your augments for.

Example: Kaos.Augment.partyItemsWithReq("canFullAuto");

Script Calls to Install or Remove Augments (USE AT YOUR OWN RISK) ----------

I managed to put these two functions together that seem to follow the
necessary steps to install and remove the augments on command. I am using
them in my own game so that I can use events to add and remove augments, but
I don't want to guarantee them yet.

Kaos.Augment.installAugmentToSlot(item, effectItem, slotId, [gain]);
Kaos.Augment.removeAugmentFromSlot(item, slotId, [gain]);

Installs the specified augment to the specified slot on the specified item.
This will fail if the augment doesn't meet the requirements, or if the slot
types are not set up correctly on either the augment or the target.

item == Target item/weapon/armor with the correct slot type.
effectItem == Augment item.
slotId == Slot ID on the item, starts at 0.
gain == Modify whether the augment is consumed on installation, and
how many you get back on removal, defaults to 0, resulting in
one being removed on installation and one being returned on
removal.

Examples:
Kaos.Augment.installAugmenttoSlot($gameParty.items()[5],
$gameParty.items()[2], 0);
... or ...
Kaos.Augment.removeAugmentFromSlot($gameActors.actor(1).equips()[2], 1);

Result:
Attempts to install the third item in the party inventory into the first
slot on the sixth item.
... or ...
Remove the augment from the second slot on the first actor's third equipped
item.

Modifying Requirements, Grants, or the Rejection String --------------------

Any of these can be used to check or modify an augment. They will not work
on any weapons or armors, nor any independent items.

[object].hasReq(req);
[object].removeReq(req);
[object].addReq(req);
[object].hasGrant(grant);
[object].removeGrant(grant);
[object].addGrant(grant);
[object].removeReject();
[object].replaceReject(reject);

============================================================================
Changelog
============================================================================

Version 1.0.0:
- initial plugin
パラメータ
( なし )
ライセンス表記
  • GNU Lesser General Public License v3.0

紹介ページ https://github.com/Audorn/RMMV_Plugins/blob/master/Kaos_AugmentRequirements.js