Tag Manager

This tag manager is very powerful when it comes to designing your database since you can classify objects anyway you want.  It allows you to assign “tags” to objects.

A tag is simply a single  alphanumeric (A to Z, 0 to 9, some symbols) string with no spaces. Examples of tags include “sword” or “carrot” or “1000eyes”.  Any concept that you can imagine can be reduced to a set of tags that are used to describe the idea:

You can use tags to describe an actor’s gender (“male”, “female”)
You can use tags to describe the rarity of an equip (“common”, “rare”)
You can use tags to describe an actor’s race (“human”, “vampire”, … )

Once tags have been assigned, you can then assign “tag conditions”, which are conditions that must be met in order for an item to be usable. For example, a “collar” might only be equippable by dogs, so you would include a condition that requires an actor to be a “dog” in order to equip it.

Download

Script: download here

Addons

Usage

We start with some basics concepts.
A “tag object” is any ob ject that supports tags. The following objects support tags

  • Actors
  • Classes
  • Skills
  • Items
  • Weapons
  • Armors
  • Enemies
  • States
  • Maps

An actor’s tags is the collection of all tags that are assigned to the actor, her current class, and any equips or states.

Tagging objects

Assign tags to tag objects using the note-tag

<tag: x>
<tag: x y>

For strings x, y. You may have multiple tags in a single note-tag by separating them with the delimiter you have chosen.

Tag Conditions

You can require items or skills to have an effect on the target only when the target has the required tags. Similarly, you can require weapons or armors to be equippable only when all tag conditions are met.

Specify a tag condition using the note-tag

<tag_cond: x>
<tag_cond: x y>

For strings x, y.

All conditions are specified using three basic boolean operators: AND, OR, NOT.
For example,

“a AND b” means an actor must have both tags to meet the condition.
“a OR b” means an actor must have at least one of the tags to meet the condition.
“NOT a” means an actor must not have the tag to meet the condition.

This script does not support parentheses matching, so you will have to use DeMorgan’s laws  to convert them into simpler statements that is recognized by the tag manager.

a AND (b OR c) => (a AND b) OR (a AND c)
NOT (a AND b) =>  (NOT a) OR (NOT b)

This might be tricky at first if you are not familiar with boolean logic but it is not difficult to understand with practice.

Map Conditions

These are the same as tag conditions, except you use them to compare with the current map. Note-tag an object with

<map_cond: x>
<map_cond: x y>

For some strings x, y
You will tag the map as usual with

<tag: x>

Map conditions are used when you require something to be true about the current map. For example, you might have items that are only usable on “world maps”, and this is easily accomplished by adding a map condition for the item and tagging your maps appropriately.

Accessing Tags

Sometimes you would like to explicitly check whether tags exist in your events or other scripts. You can do this by accessing thetags property that is exposed by all Tag Objects.

For example, to access the first actor’s tags, you would say

$game_actors[1].tags

This will return all of the tags that are currently assigned to actor 1.

YOU MAY ALSO LIKE…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s