Documentation
Quick InfoVersion: Alpha R10
Made for RPG Maker MZ 1.9.0
The basicsMany hooks are also passed the context and arguments you may wish to use in your custom JavaScript. To access an argument, in your JavaScript you will write arguments[0], arguments[1], etc. Below is what is sent to each hook.
RMMZ Base Code HooksCommon Event
Context: Either Game_Interpreter or Game_Temp depending how common event was called. Event command will be Game_Interpreter.
Arguments:
0 = common event id
Gold Changed
Context: Game_Party
Arguments:
0 = amount of gold (can be negative if lose gold).
Item Changed
Context: Game_Party
Arguments:
0 = item object (from $dataItems/$dataArmors/$dataWeapons)
1 = amount to gain/lose
2 = includeEquip - for wep/armor, this will be true if discarding equips
Equip Changed
Context: Game_Actor
Arguments:
0 = slot id
1 = weapon/armor object that was equipped
Actor Added
Context: Game_Party
Arguments:
0 = Actor id that was added
Actor Removed
Context: Game_Party
Arguments:
0 = Actor id that was removed
Level Up
Context: Game_Actor
Arguments: N/A
Level Down
Context: Game_Actor
Arguments: N/A
Learn Skill
Context: Game_Actor
Arguments:
0 = Skill ID to learn
Note: This will be called for skills actors are initialized with.
Forget Skill
Context: Game_Actor
Arguments:
0 = Skill ID to forget
Skill Use
Context: Game_Action
Arguments:
0 = Instance of Game_Item that represents the skill used
1 = Instance of Game_Actor or Game_Enemy, the target of the skill
Change Class
Context: Game_Actor
Arguments:
0 = Class id to change to
1 = keepExp, true if the actor will transfer their exp to new class
Get On Vehicle
Context: Game_Vehicle
Arguments: N/A
Get Off Vehicle
Context: Game_Vehicle
Arguments: N/A
Battle Start
Context: Game_System
Arguments: N/A
Battle Win
Context: Game_System
Arguments: N/A
Battle Escape
Context: Game_System
Arguments: N/A
Battle Escape Fail
Context: BattleManager
Arguments: N/A
Enemy Kill
Context: Game_Enemy
Arguments:
0 = Enemy ID that was killed
CGMZ HooksAfter Load
Context: CGMZ_Core
Arguments: N/A
Variable Change
Context: Game_Variables
Arguments:
0 = variable id
1 = new value
Switch Change
Context: Game_Switches
Arguments:
0 = switch id
1 = new value
Self Switch Change
Context: Game_SelfSwitches
Arguments:
0 = key (array typically in the form of [map id, event id, switch letter])
1 = new value
Toast Window
Context: CGMZ_Temp
Arguments:
0 = toast object to be displayed
Screenshot
Context: CGMZ_Temp
Arguments: N/A
Achievement Earned
Context: CGMZ_Core
Arguments:
0 = achievement object being earned
Profession Level Up
Context: CGMZ_Profession
Arguments: N/A
Profession Level Down
Context: CGMZ_Profession
Arguments: N/A
Craft
Context: CGMZ_Recipe
Arguments:
0 = whether craft is a success or not
Fast Travel
Context: CGMZ_Scene_FastTravel
Arguments:
0 = fast travel data object
Difficulty Change
Context: CGMZ_Core
Arguments:
0 = name of the difficulty changing to
Skill Purchase
Context: CGMZ_Scene_SkillShop
Arguments:
0 = skill object
1 = price paid for the skill
2 = $gameActor object that learned the skill
New Game Plus
Context: CGMZ_Core
Arguments: N/A
Actor Recruit
Context: CGMZ_Scene_RecruitmentBoard
Arguments:
0 = CGMZ_RecruitmentBoardActor object that was recruited, use the 'id' property to get the actor's id.
Skill Level Up
Context: CGMZ_Core
Arguments:
0 = Skill ID that leveled up
1 = New skill level
Quest Discover
Context: CGMZ_Quest
Arguments: N/A
Quest Start
Context: CGMZ_Quest
Arguments: N/A
Quest Complete
Context: CGMZ_Quest
Arguments: N/A
Quest Fail
Context: CGMZ_Quest
Arguments: N/A
Quest Pin
Context: CGMZ_Quest
Arguments: N/A
Quest Unpin
Context: CGMZ_Quest
Arguments: N/A
Jukebox Discover
Context: CGMZ_JukeboxSaved
Arguments: N/A
Jukebox Played
Context: CGMZ_JukeboxSaved
Arguments: N/A
On Gather
Context: CGMZ_GatherNodeSaved
Arguments: N/A
Plugin CommandsThis plugin supports the following plugin commands:
Run Hook - Executes the JS code from hook with the provided id
Saved GamesThis plugin is fully compatible with saved games. This means you can:
✓ Add this plugin to a saved game and it will work as expected.
✓ Change any plugin params and changes will be reflected in saved games.
✓ Remove the plugin with no issue to save data.
Filename
The filename for this plugin MUST remain CGMZ_Hooks.js. This is what it comes as when downloaded. The filename is used to load parameters and execute plugin commands. If you change it, things will begin behaving incorrectly and your game will probably crash. Please do not rename the js file.
Known Issues
This plugin currently has no known issues that need to be fixed. If you believe you have encountered a bug, please report it to Casper Gaming.
Compatibility
This plugin currently has no known compatibility issues with other RMMZ plugins. If you believe you have encountered a conflict, please report it to Casper Gaming.
Version HistoryVersion AlphaR3
- Added hook to run when a skill shop purchase is made
- Bug fix for skill hooks not running
- This plugin will now warn instead of crash when invalid JSON is detected
- Added hook for variable change
- Added hook for switch change
- Added hook for dungeon tool use
- Added hook for dungeon tool interact
- Bug fix for skill purchase hook not providing actor
- Hooks now support multiple hooks per hook type
- Added hook for new game plus start
- Added hook for actor recruit
- Added hook for when a skill levels up
- Added RMMZ hook for equip change
- Added CGMZ hook for quest discover, start, complete, fail, pin, unpin
- Added CGMZ hook for jukebox discover, play
- Added CGMZ hook for gathering
- Added RMMZ hook for battle escape failure
- Added RMMZ hook for self switch change
- Added CGMZ hook for picture gallery functions
- Added CGMZ hook for encyclopedia discover