[Review]DoubleX RMVXA Item Triggers

Purpose
Sets some skills/items to trigger effects before and/or after being used

Notetag
  1. #  * Skill/Item Notetags:                                                      |
  2. #    1. <timing item trigger: itcx, itax>                                      |
  3. #       - Sets a skill/item to trigger itax when timing and itcx are met       |
  4. #       - It only works in battles using the default battle scene(Scene_Battle)|
  5. #       - timing can be pre, post or custom timings set by you                 |
  6. #       - pre means right before using the skill/item                          |
  7. #       - post means right after using the skill/item                          |
  8. #       - timing must only consist of alphanumeric characters                  |
  9. #       - itcx can be set in Item Trigger Condition Notetag Values             |
  10. #       - itax can be set in Item Trigger Action Notetag Values                |
Expand to see the code.

  1.    #--------------------------------------------------------------------------|
  2.     #  Item Trigger Condition Notetag Values                                   |
  3.     #  - Setups itcx used by <timing item trigger: itcx, itax>                 |
  4.     #--------------------------------------------------------------------------|
  5.     # itcx are used at:
  6.     # 1. Scene_Battle
  7.     #    - it.send(trigger[1], self) if it.send(trigger[0], self) in
  8.     #      exec_item_triggers
  9.     # itcx are strings of names of methods under DoubleX_RMVXA::Item_Triggers
  10.     # itcx names can only use alphanumeric characters
  11.     # battler is the battler using item
  12.     # item is the skill/item using the itcx
  13.     # The below itcx are examples added to help you set your itcx
  14.     # You can freely use, rewrite and/or delete these examples
  15.  
  16.     # Sets the item trigger condition as always true
  17.     def self.itc1(battler, item)
  18.       true
  19.     end
  20.  
  21.     # Sets the item trigger condition as always false
  22.     def self.itc2(battler, item)
  23.       false
  24.     end
  25.  
  26.     # Sets the item trigger condition as needing switch with id x to be on
  27.     def self.itc3(battler, item)
  28.       $game_switches[x]
  29.     end
  30.  
  31.     # Adds new itcx here
  32.    
  33.  
  34.     #--------------------------------------------------------------------------|
  35.     #  Item Trigger Action Notetag Values                                      |
  36.     #  - Setups itax used by <timing item trigger: itcx, itax>                 |
  37.     #--------------------------------------------------------------------------|
  38.     # itax are used at:
  39.     # 1. Scene_Battle
  40.     #    - it.send(trigger[1], self) if it.send(trigger[0], self) in
  41.     #      exec_item_triggers
  42.     # itax are strings of names of methods under DoubleX_RMVXA::Item_Triggers
  43.     # itax names can only use alphanumeric characters
  44.     # battler is the battler using item
  45.     # item is the skill/item using the itax
  46.     # The below itax are examples added to help you set your itax
  47.     # You can freely use, rewrite and/or delete these examples
  48.  
  49.     # Sets the item trigger action as what Special Effect Escape does
  50.     def self.ita1(battler, item)
  51.       battler.hide
  52.     end
  53.  
  54.     # Sets the item trigger action as calling common event with id
  55.     # common_event_id
  56.     def self.ita2(battler, item)
  57.       $game_temp.reserve_common_event(common_event_id)
  58.       SceneManager.scene.process_event
  59.     end
  60.  
  61.     # Sets the item trigger action as executing damage equal to the value of
  62.     # game variable with id x to self with type equal to that of skill with id
  63.     # equal to y
  64.     def self.ita3(battler, item)
  65.       battler.result.clear
  66.       battler.result.make_damage($game_variables[x], $data_skills[y])
  67.       battler.execute_damage(battler)
  68.     end
  69.  
  70.     # Adds new itax here
  71.    
Expand to see the code.


Script Call
  1. #  * Scene manipulation                                                        |
  2. #    1. exec_item_triggers(item, timing)                                       |
  3. #       - Executes all item triggers with timing timing of item item           |
Expand to see the code.


Games Using This Script
None so far

Prerequisites
Abilities:
1. Decent RGSS3 scripting proficiency to fully utilize this script

Terms Of Use
You shall keep this script's Script Info part's contents intact
You shalln't claim that this script is written by anyone other than DoubleX or his aliases
None of the above applies to DoubleX or his aliases

Instructions
1. Open the script editor and put this script into an open slot between Materials and Main, save to take effect.

Authors
DoubleX

Changelog
  1. #    v1.01a(GMT 1300 26-2-2016):                                               |
  2. #    1. itcx and itax take the skill/item calling them as an argument as well  |
  3. #    2. Fixed passing Scene_battle instead of a battler into itcx/itax bug     |
  4. #    v1.00b(GMT 0400 7-11-2015):                                               |
  5. #    1. Notetag values are now symbols of methods in the configuration regions |
  6. #    2. This script doesn't need DoubleX RMVXA Item Triggers Compatibility to  |
  7. #       be compatible with all its addressed scripts                           |
  8. #    3. Further improved this script's compatibility, efficiency and simplicity|
  9. #    v1.00a(GMT 1300 11-5-2015):                                               |
  10. #    1. 1st version of this script finished                                    |
Expand to see the code.


Download Link
http://pastebin.com/FUeT6D0u
Updates
  1. #    v1.01a(GMT 1300 26-2-2016):                                               |
  2. #    1. itcx and itax take the skill/item calling them as an argument as well  |
  3. #    2. Fixed passing Scene_battle instead of a battler into itcx/itax bug     |
Expand to see the code.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=78865