Mod Creation/Essentials: Difference between revisions

Line 456: Line 456:
== Game Object Patching/Hooking ==
== Game Object Patching/Hooking ==


''View this topic's relevant API reference here [[Mod Creation/Mod Context API Reference#Game Method Patching/Hooking]].''
''View this topic's relevant API reference here [[Mod Creation/Mod Context API Reference#Game Object Patching/Hooking]].''


A common modding scenario is to want to override/modify an in-game method or perform an action before or after it has completed. Your mod's context object contains a patch property that can be used for this these cases. Patches can only be applied to methods that exist on a JavaScript class (<code>Player</code>, <code>Enemy</code>, <code>CombatManager</code>, <code>Woodcutting</code>, etc.). To start, define the class and method that you want to patch:
A common modding scenario is to want to override/modify an in-game method or perform an action before or after it has completed. Your mod's context object contains a patch property that can be used for this these cases. Patches can only be applied to methods that exist on a JavaScript class (<code>Player</code>, <code>Enemy</code>, <code>CombatManager</code>, <code>Woodcutting</code>, etc.). To start, define the class and method that you want to patch:
91

edits