The RPG Maker Resource Kit

RMRK RPG Maker Creation => MV => MV Scripts Database => Topic started by: DoubleX on December 17, 2015, 02:59:46 PM

Title: DoubleX RMMV Item Triggers
Post by: DoubleX on December 17, 2015, 02:59:46 PM
Changelog
Code: [Select]
*      v1.01a(GMT 1300 26-2-2016):                                           
 *      1. ITCX and ITAX take the skill/item using them as an argument as well
 *      v1.00b(GMT 1400 27-1-2016):                                           
 *      1. Fixed calling current action via battler function upon action end   
*      v1.00a(GMT 1500 17-12-2015):                                         
 *      1. 1st version of this plugin finished                               

Authors
DoubleX

Credits
DoubleX(Optional)

Purpose
Sets some items to trigger some actions when conditions are met

Games using this script
None so far

Notetags
Code: [Select]
*    # Skill/Item Notetags:                                                 
 *      1. <timing item trigger: ITCX, ITAX>                                 
 *         - Sets a skill/item to trigger ITAX when timing and ITCX are met   
 *         - timing can be pre, post or custom timings set by you             
 *         - preBattle means right before using the skill/item in battles     
 *         - postBattle means right after using the skill/item in battles     
 *         - preMap means right before using the skill/item outside battles   
 *         - postMap means right after using the skill/item outside battles   
 *         - timing must only consist of alphanumeric characters             
 *         - ITCX can be set in Item Trigger Condition Functions             
 *         - ITAX can be set in Item Trigger Action Functions                 

Plugin Calls
Code: [Select]
*    # Configuration manipulations                                           
 *      1. DoubleX_RMMV.Item_Triggers.prop                                   
 *         - Returns the property prop under DoubleX_RMMV.Item_Triggers       
 *      2. DoubleX_RMMV.Item_Triggers.prop = function                         
 *         - Sets the property prop under DoubleX_RMMV.Item_Triggers as       
 *           function which will be bound to the battler upon use             
 *         - No DoubleX_RMMV.Item_Triggers.prop change will be saved         
 *    # Item manipulations                                                   
 *      All meta.itemTriggers changes can be saved if                         
 *      DoubleX RMMV Dynamic Data is used                                     
 *      1. meta.itemTriggers[timing]                                         
 *         - Returns the array of all ITCX-ITAX pairs of timing timing       
 *      2. meta.itemTriggers[timing] = [[ITCX, ITAX], [ITCX, ITAX], ...]     
 *         - Adds a new timing with some ITCX-ITAX pairs or overwrites all the
 *           existing ones with those pairs if timing is an existing timing   
 *      3. meta.itemTriggers[timing][i] = [ITCX, ITAX]                       
 *         - Set the ith ITCX-ITAX pair as the new ITCX-ITAX pair             
 *    # Battler manipulations                                                 
 *      1. GBB.execItemTriggers.call(battler, item, timing)                   
 *         - Executes all item triggers with timing timing of item of battler
 *           battler                                                         
 *         - GBB is DoubleX_RMMV.Item_Triggers.Game_BattlerBase               

Configurations
Code: [Select]
    /*------------------------------------------------------------------------
     *    Item Trigger Condition Functions                                   
     *    - Setups ITCX used by <timing item trigger: ITCX, ITAX>             
     *------------------------------------------------------------------------*/
    /* ITCX are used at:
       1. DoubleX_RMMV.Item_Triggers.Game_BattlerBase
          - if (IT[trigger[0]].call(this)) { IT[trigger[1]].call(this); } in
          - execItemTriggers
       ITCX are Javascript functions which will be bound to the battler upon use
       ITCX names can only use alphanumeric characters
       item is the skill/item using the ITCX
       The below ITCX are examples added to help you set your ITCX
       You can freely use, rewrite and/or delete these examples */

    // Sets the item trigger condition as always true
    ITC1: function(item) { return true; },

    // Sets the item trigger condition as needing switch with id x to be on
    ITC2: function(item) { return $gameSwitches.value(x); },

    // Adds new ITCX here
   

    /*------------------------------------------------------------------------
     *    Item Trigger Action Values                                         
     *    - Setups ITAX used by <timing item trigger: ITCX, ITAX>             
     *------------------------------------------------------------------------*/
    /* ITAX are used at:
       1. DoubleX_RMMV.Item_Triggers.Game_BattlerBase
          - if (IT[trigger[0]].call(this)) { IT[trigger[1]].call(this); } in
          - execItemTriggers
       ITAX are Javascript functions which will be bound to the battler upon use
       ITAX names can only use alphanumeric characters
       item is the skill/item using the ITAX
       The below ITAX are examples added to help you set your ITAX
       You can freely use, rewrite and/or delete these examples */

    // Sets the item trigger action as what Special Effect Escape does
    ITA1: function(item) { this.hide(); },

    // Sets the item trigger action as setting the battler's hp to full
    ITA2: function(item) { this._hp = this.mhp; },

    // Adds new ITAX here
   

Prerequisites
Abilities:
1. Decent Javascript coding proficiency to fully utilize this plugin

Terms Of Use
You shall keep this plugin's Plugin Info part's contents intact
You shalln't claim that this plugin's written by anyone other than DoubleX or his aliases
None of the above applies to DoubleX or his/her aliases
Title: Re: DoubleX RMMV Item Triggers
Post by: DoubleX on January 29, 2016, 12:55:54 AM
Updates
Code: [Select]
*      v1.00b(GMT 1400 27-1-2016):                                           
 *      1. Fixed calling current action via battler function upon action end 
Title: Re: DoubleX RMMV Item Triggers
Post by: DoubleX on February 27, 2016, 02:32:29 AM
Updates
Code: [Select]
*      v1.01a(GMT 1300 26-2-2016):                                           
 *      1. ITCX and ITAX take the skill/item using them as an argument as well