Reader Functions for Features/Effects

Version 1.4  (4/14/2013)
Script Download

This is a scripter’s tool. This means programming knowledge and Ruby knowledge are required to understand and utilize this script. This script does nothing by itself.

If you are a regular user using this script for another existing script, you don’t need to do anything with this script. Just install it in your script editor and leave it alone.

All RPG::BaseItem objects have an array of RPG::BaseItem::Feature objects that contain all Feature properties defined by the developer in the database. Unfortunately, the way Feature objects is coded makes it not immediately understandable by humans. It requires checking the methods in Game_BattlerBase and Game_Battler to decipher what the values in a Feature mean. This makes trying to display a specific object’s Features difficult to accomplish.

This script is essentially a collection of wrapper functions based off the methods defined in Game_BattlerBase and Game_Battler. This was mostly a copy and paste job and most of the return values are similar to the ones from those original classes.

For example, if you have a $data_items object, you can do

$data_items[id].hp_recovery

to directly get that item’s total hp recovery value. There are many other usable methods.

RPG::UsableItem objects do not have Features, but have a similar inner class called RPG::UsableItem::Effect which have their own reader functions.

This script was made for my own use, but other scripters can use it if they want.

Changelog

  • v1.4
    • Bugfix: Added the Game_Party constants. Oops. (4/14/2013)
  • v1.3
    • Bugfix: “add_debuffs” and “remove_debuffs” now return the correct value instead of an array. (4/06/2013)
  • v1.2
    • “tp_gain” has changed to “tp_recovery”. (9/04/2012)
  • v1.1
    • Bugfix: Arrays no longer return an array of arrays. (8/23/2012)
  • v1.0
    • Initial release.  (8/20/2012)

Methods

The following methods are for any RPG::BaseItem object:

param(param_id)

param_id is a value between 0~7. In general, anything that is not an RPG::EquipItem object will return 0.

param_rate(param_id)

param_id is a value between 0~7. Not to be confused with the standard param methods, this method returns the rate modifier for the given parameter. Param rates start at 1.0 by default.

xparam(xparam_id)

xparam_id is a value between 0~9. Ex-Parameters start at 0.0 by default.

sparam(sparam_id)

sparam_id is a value between 0~9. Sp-Parameters start at 1.0 by default.

# Params
mhp
mmp
atk
def
mat
mdf
agi
luk

In general, anything that is not an RPG::EquipItem object will return 0.

mhp_rate
mmp_rate
atk_rate
def_rate
mat_rate
mdf_rate
agi_rate
luk_rate

Not to be confused with the standard param methods, these methods return the rate modifier for the given parameter. Param rates start at 1.0 by default.

# X-Params
hit
eva
cri
cev
mev
mrf
cnt
hrg
mrg
trg

Ex-Parameters start at 0.0 by default.

# Sp-Params
tgr
grd
rec
pha
mcr
tcr
pdr
mdr
fdr
exr

Sp-Paramters start at 1.0 by default.

dual_wield?
auto_battle?
guard?
substitute?
preserve_tp?
encounter_half?
encounter_none?
cancel_surprise?
raise_preemptive?
gold_double?
drop_item_double?

Returns true if that specified Feature flag is found. Otherwise, false.

get_feature_flags

Returns an array of keys that each represent a Feature flag. If the key is included in the array, it means the flag is true. Possible keys are:

  • :dual_wield
  • :auto_battle
  • :guard
  • :substitute
  • :preserve_tp
  • :encounter_half
  • :encounter_none
  • :cancel_surprise
  • :raise_preemptive
  • :gold_double
  • :drop_item_double

element_rate(element_id)

Returns the element modifier rate for a given element_id. A value of 1.0 means no change.

debuff_rate(param_id)

Returns the debuff modifier rate for a given param_id. A value of 1.0 means no change.

state_rate(state_id)

Returns the state modifier rate for a given state_id. A value of 1.0 means no change.

state_resist_set

Returns an array of resist state ID numbers.

atk_elements

Returns an array of attack element ID numbers.

atk_states

Returns an array of attack state ID numbers.

atk_states_rate(state_id)

Returns the total attack state rate for a given state_id.

atk_speed

Returns the attack speed value.

atk_times_add

Returns the number of consecutive attacks granted.

added_skill_types

Returns an array of added skill type ID numbers.

sealed_skill_types

Returns an array of sealed skill type ID numbers.

added_skills

Returns an array of added skill ID numbers.

sealed_skills

Returns an array of sealed skill ID numbers.

equip_wtypes

Returns an array of granted equip weapon types ID numbers

equip_atypes

Returns an array of granted equip armor types ID numbers

fixed_equips

Returns an array of fixed equipment index numbers. Each index corresponds to an existing equip slot. (0:Weapon, 1:Shield, 2:Helmet, 3:Armor, 4:Accessory)

sealed_equips

Returns an array of sealed equipment index numbers. Each index corresponds to an existing equip slot. (0:Weapon, 1:Shield, 2:Helmet, 3:Armor, 4:Accessory)

action_plus_set

Returns an array of Action Times+ chances.

The following methods are for any RPG::UsableItem object:

hp_recovery

Returns a flat HP recovery value.

hp_recovery_rate

Returns the rate of HP recovery.

mp_recovery

Returns a flat MP recovery value.

mp_recovery_rate

Returns the rate of MP recovery.

tp_recovery

Returns a flat TP recovery value.

add_states

Returns an array of state IDs that are added to the target.

remove_states

Returns an array of state IDs that are removed from the target.

add_states_with_rates

Returns a multi-dimensional array where [index][0] is a state_id number and [index][1] is the success rate. [[state_id, rate],[state_id, rate],[state_id, rate], …]. state_id 0 represents ‘Normal Attack’.

remove_states_with_rates

Returns a multi-dimensional array where [index][0] is a state_id number and [index][1] is the remove rate. [[state_id, rate],[state_id, rate],[state_id, rate], …]

add_buffs

Returns an array buffs represented by param_id numbers.

add_debuffs

Returns an array debuffs represented by param_id numbers.

add_buffs_with_turns

Returns a multi-dimensional array where [index][0] is a param_id number and [index][1] is the buff turn duration. [[param_id, turn],[param_id, turn],[param_id, turn], …]

add_debuffs_with_turns

Returns a multi-dimensional array where [index][0] is a param_id number and [index][1] is the debuff turn duration. [[param_id, turn],[param_id, turn],[param_id, turn], …]

remove_buffs

Returns an array of removed buffs represented by param_id numbers.

remove_debuffs

Returns an array of removed debuffs represented by param_id numbers.

escape?

Returns true or false if the skill/item provides escape from battle.

grow(param_id)

Returns the total amount of param growth for the given param_id.

learn_skills

Returns an array of skill IDs that the skill/item teaches.

common_event

Returns a common event ID number. Otherwise, it returns nil.

Compatibility

There are no default method overwrites.

Requests for compatibility with other scripts are welcome.

Terms and Conditions

Please do not repost this script elsewhere without permission.

Free for non-commercial use. For commercial use, contact me first.

Newest versions of this script can be found at https://mrbubblewand.wordpress.com/

Advertisements

13 Responses to Reader Functions for Features/Effects

  1. Pingback: RGSS3: Reader Functions for Features/Effects « Bubble Blog

  2. Pingback: RGSS3: Tactics Ogre PSP Crafting System v1.8 Update « Bubble Blog

  3. estriole says:

    a little question. can we use this script to read what the guest (your guest script) feature. for example if i want it by adding guest to party will have effect such as double exp, etc. and i want to display the feature name below guest face. is that possible?

  4. Mr. Bubble says:

    Hmm, well, it could be used like that.

    Since the guest passive info thing seems to be so popular, I’ll just make a script for it myself. Shouldn’t be hard, but I’ll be on vacation until next week.

  5. estriole says:

    looking forward for the script :D. thx a lot mr. bubble. and a little suggestion when you making the script. don’t create the text below the face graphic. it will increase the size of the window. just overlap the text over the face graphic at bottom position. but it’s up to you. 😀

  6. unimportant guy says:

    Ok so this script gives me one major problem in my game. whenever i use a TP increasing item (like a potion) the person who used the potion and the person affected by the potion both gain the desire amount of TP. For instance if Charater1 uses a TP potion (one that increases TP by 15 points) on Charater2, both Charater1 and Charater2 gains 15 TP. the same thing happens if Character1 just uses the potion on himself/herself; he/she gains double the desire amount. this only affects TP in this matter and i dont like it doing that. i would mess around with it but i dont kno what them numbers represent. other than that this script is fine.

    **fyi i placed this script under all of Yanfly’s scripts and yours but above all compatibility scripts. i’ve even tested this script’s problem on a new project but the results were the same as described above. if u dont have time or cant seem to fix the problem i can work around the TP potions, no big deal. and sorry for writing so much i’ll stop for now. thanks

  7. unimportant guy says:

    hey its me again. so since becoming interested in the said problem with this script, i tested a few TP things with it. i found out that this script also messes with the TP gained by attacking and defend. ideally when ur attacking/defending, ur suppose to gain 5 TP on a successful attack and 4 TP when defending. however when using this script, u gain zero TP for attacking and defending. also when u use a TP increasing skill, u gain a odd amount of TP. for instance take the preset skill Shintou Mekkyaku, its suppose to increase the user’s TP by 30 for the cost of 10 TP. however with this script the user gains 74 to 85 TP with this skill, an odd amount. well thats all i could figure out at the moment.

    **i only tested Shintou Mekkyaku about 5 times so the varied amount may not be accurate.

  8. Mr. Bubble says:

    Guy, please test the script by itself with no other custom scripts. I can’t since I’m on vacation until Sunday. There should be no reason this script should affect TP.

  9. unimportant guy says:

    i already tested this script by itself as posted before. i started a brand new project with ZERO custom scripts except this one but all the problems i posted before still happened. i’ve even done it again can had the same out comes. im in no hurry so its ok. please work at ur own pace and i hope u have a nice vacation 🙂

  10. Mr. Bubble says:

    guy, the TP bugs should be fixed now.

  11. WCouillard says:

    When used with the Crafting System script, if you change the Page Change Sound Effect (in this case, to an imported non-RTP SE file), it will error out and say it cannot find the file, even when there is no mistake in the filename. Tested in new save and loaded game save.

  12. Mr. Bubble says:

    I will look into it.

  13. Sen Kenneth says:

    found a bug that did not show the recovery rate of HP or MP of an item when viewing its info. it does show the flat amount (ex. 500 or 2500) but not the rate (ex. 50% or 100%). the following scripts were used in the following order during testing:

    Info Pages Window v1.01
    Reader Functions for Features/Effects v1.4
    Too Much Information Item Scene v1.01

    *no other scripts were used and all scripts were of the latest version

Leave a Reply here. (Due to a recent increase in comment spam bots, new comments will be moderated unless you have at least one approved comment in the past.)

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