Feature ManagerThis is a plugin-based scripting system that allows you to quickly define features and add them to RPG::BaseItem objects. Then you define the behavior of the feature and then tag your database objects.
DownloadGet it at
Hime WorksExamplesA couple scripts I've written for samples
Add_Param:
http://db.tt/gXcsbbSw. Allows you to increase basic parameters using a constant value rather than using percents.
Add_Equip:
http://db.tt/SATgIdx8. Allows you to specify which weapons/armors your actor can equip, by database ID
UsageFour step process
Step 1Register your feature. Choose a name that will unique identify your feature
You can also pass in a version number if your script requires a specific version of the script.
You can check the version of the feature manager in the "import" line. It probably will be 1.0 for awhile so you can just omit it.
CODE
FeatureManager.register(IDSTRING, api_version=1.0)
Step 2Define an "add_feature" method for your plugin. You will need to tell the feature manager how you want to setup your RPG::Feature. Keep in mind that all data ID's and values must be integers. For now, features only support integer values.
CODE
class RPG::BaseItem
def add_feature_IDSTRING(code, data_id, args)
data_id = args[0].to_i
value = args[1].to_i
add_feature(code, data_id, value)
end
end
Step 3Define the behavior of your feature.
You will probably be aliasing methods defined in Game_BattlerBase, Game_Battler, Game_Actor, or Game_Enemy.
Step 4Write instructions for tagging your database objects
The format of the note tag is as follows
CODE
<ft: IDSTRING arg1 arg2 arg3 ...>
Where IDSTRING is the name of your plugin you registered and a list of args that you will ask your users to give you.
NotesFor now I am simply following what the default scripts do.
I am releasing this now because I feel this is something that would be developed much more effectively if there are people actually using it and trying to implement their ideas.
If you have an idea for a feature but my system does not allow you to write it (for example, if you want to use string values or something), just describe how you are planning to use it and I will see whether I want to make the values less restrictive.
Similarly, if you need more ways of checking whether your actor has a particular feature or not, just describe it. I have added two methods that I think are essential
CODE
# Returns a set of all values for the given feature code
def features_value_set(code)
features(code).inject([]) {|r, ft| r |= [ft.data_id] }
end
# Returns a set of all values for the given feature code, filtered by data ID
def features_value_set_with_id(code, data_id)
features_with_id(code, data_id).inject([]) {|r, ft| r |= [ft.value]}
end
About API version...
By default the api version required is 1.0, which means it should be compatible with any version of the library.
Now...I just need to figure out a way to manage version control on my end. But I don't expect there to be any significant changes so even if I add new stuff it would still be 1.0 unless I'm really changing the interface or something
Though that's probably not how version numbers work lol
This post has been edited by Tsukihime: Mar 19 2013, 10:20 AM