Anonymous

Mod Creation/Essentials: Difference between revisions

From Melvor Idle
Line 264: Line 264:
''View this topic's relevant API reference here [[Mod Creation/Mod Context API Reference#Game Object Registration]].''
''View this topic's relevant API reference here [[Mod Creation/Mod Context API Reference#Game Object Registration]].''


Mods can now register or modify game objects (items, skills, pages, etc.) in a streamlined way. The entry point for doing so is the <code>gameData</code> endpoint within the mod context API. There is massive variety on what data is needed between different game object types but the general concept is the same. You will need to either define a data package using JSON and load that into the game, or you can dynamically build one via code (certain dynamic objects like skills requires the latter).
Mods can now register or modify game objects (items, skills, pages, etc.) in a streamlined way. The entry point for doing so is either the <code>"load"</code> property of your <code>manifest.json</code>, or the <code>gameData</code> endpoint within the mod context API. There is massive variety on what data is needed between different game object types but the general concept is the same. You will need to either define a data package using JSON and load that into the game, or you can dynamically build one via code (certain dynamic objects like skills requires the latter).


=== Defining a Data Package ===
=== Defining a Data Package ===
Line 327: Line 327:
}</nowiki>
}</nowiki>


You would then register your game data using the following:
You would then register your game data using one of the following methods:
 
<nowiki>// manifest.json
{
  "namespace": "helloWorld",
  "load": ["path-to-your-data.json"]
}</nowiki>
 
''or''


  <nowiki>// setup.mjs
  <nowiki>// setup.mjs
89

edits