Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Feature Manager
Tsukihime
post Oct 11 2012, 09:57 PM
Post #1


Level 25
Group Icon

Group: Revolutionary
Posts: 560
Type: None
RM Skill: Undisclosed
Rev Points: 25




Feature Manager

This 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.

Download

Get it at Hime Works

Examples

A 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

Usage

Four step process

Step 1

Register 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 2

Define 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 3

Define the behavior of your feature.
You will probably be aliasing methods defined in Game_BattlerBase, Game_Battler, Game_Actor, or Game_Enemy.

Step 4

Write 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.

Notes

For 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


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 12:38 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker