Difference between revisions of "Modding"

From Isleward Wiki
Jump to navigation Jump to search
(code samples section)
(added 'running the server' section)
Line 5: Line 5:
  
 
Isleward allows for server-side mods by dropping a "modpack" into the server source.
 
Isleward allows for server-side mods by dropping a "modpack" into the server source.
 +
 +
== Running the Server ==
 +
You can run an Isleward server on your own computer if you would like to make/play with mods, test the game, or run a private server.
 +
 +
First, you'll need to install [https://nodejs.org/en/download/ Node.JS] and NPM.
 +
NPM should be included in the download linked above.
 +
 +
There are two ways to get the source code.
 +
The first way uses [https://git-scm.com/downloads Git], a Source Control Management program.
 +
The second way is to download the source files from the repository yourself, which doesn't require you to install another program but it is more difficult to update your server version later on.
 +
 +
'''Method 1:''' This way works best because you can run a single command to download the latest version without having to manually set up the files again.
 +
Once you install [https://git-scm.com/downloads Git], navigate to the parent directory of where you want to install the server.
 +
Run <code>git clone https://gitlab.com/Isleward/Isleward.git FOLDER</code>, replacing <code>FOLDER</code> with whatever you want to call the folder you are installing [[Isleward]] into.
 +
After that, <code>cd</code> into <code>FOLDER/src/server</code>.
 +
The server is now downloaded.
 +
 +
'''Method 2:''' This way doesn't require a download but is harder to maintain.
 +
Open [https://gitlab.com/Isleward/isleward/ this page] in your browser.
 +
Click on the download button and download the source in a format of your choice.
 +
Extract the downloaded files into a directory you want to install [[Isleward]] into.
 +
Navigate to <code>FOLDER/src/server</code>
 +
 +
Both methods will get you to the same place.
 +
Make sure you are in <code>FOLDER/src/server</code> and run <code>npm install</code>.
 +
If you installed Node.JS and NPM correctly, it should start installing.
 +
Wait for it to install.
 +
It should install everything it needs on it's own without needing you to install other dependencies.
 +
If you encounter other errors, try running it again with administrative permissions and try other basic troubleshooting problems.
 +
The [[Isleward]] [https://discord.gg/0w9fgEmdtEpUESHK Discord] might also be able to help you with your problem.
 +
 +
Now that you have all the dependencies installed, you should be ready to go!
 +
Run <code>node --expose-gc index.js</code> (in <code>FOLDER/src/server</code>) and you should see something like <pre>Server: ready
 +
(M estuary): Ready
 +
(M sewer): Ready
 +
(M cave): Ready
 +
(M tutorial): Ready</pre>
 +
If you see something like that (zone names may be different), your server is running.
 +
Head over to http://localhost:4000/ and you should see the game running!
 +
 +
You can change the message shown in the console (the <code>Server: ready</code> part) and the port that it runs on in <code>FOLDER/src/server/config/serverConfig.js</code>, the file should be pretty self-explanatory.
  
 
== Using Mods ==
 
== Using Mods ==
Line 29: Line 70:
 
* onBeforeGetZone
 
* onBeforeGetZone
  
 +
<!--
 
== Code Samples ==
 
== Code Samples ==
 
Below are some code samples for common things to do in mods.
 
Below are some code samples for common things to do in mods.
 
+
-->
 
<!-- i'm going to finish this later -->
 
<!-- i'm going to finish this later -->
 
<!-- === Give a player an item ===
 
<!-- === Give a player an item ===
 
<pre></pre> -->
 
<pre></pre> -->

Revision as of 23:22, 3 January 2018

Modding

Modding may refer to multiple things in Isleward. See Modding (disambiguation) for more information.

WIP: This article is a work in progress, meaning that it is being worked on but is unfinished. You can help by editing it.

Isleward allows for server-side mods by dropping a "modpack" into the server source.

Running the Server

You can run an Isleward server on your own computer if you would like to make/play with mods, test the game, or run a private server.

First, you'll need to install Node.JS and NPM. NPM should be included in the download linked above.

There are two ways to get the source code. The first way uses Git, a Source Control Management program. The second way is to download the source files from the repository yourself, which doesn't require you to install another program but it is more difficult to update your server version later on.

Method 1: This way works best because you can run a single command to download the latest version without having to manually set up the files again. Once you install Git, navigate to the parent directory of where you want to install the server. Run git clone https://gitlab.com/Isleward/Isleward.git FOLDER, replacing FOLDER with whatever you want to call the folder you are installing Isleward into. After that, cd into FOLDER/src/server. The server is now downloaded.

Method 2: This way doesn't require a download but is harder to maintain. Open this page in your browser. Click on the download button and download the source in a format of your choice. Extract the downloaded files into a directory you want to install Isleward into. Navigate to FOLDER/src/server

Both methods will get you to the same place. Make sure you are in FOLDER/src/server and run npm install. If you installed Node.JS and NPM correctly, it should start installing. Wait for it to install. It should install everything it needs on it's own without needing you to install other dependencies. If you encounter other errors, try running it again with administrative permissions and try other basic troubleshooting problems. The Isleward Discord might also be able to help you with your problem.

Now that you have all the dependencies installed, you should be ready to go!

Run node --expose-gc index.js (in FOLDER/src/server) and you should see something like

Server: ready
(M estuary): Ready
(M sewer): Ready
(M cave): Ready
(M tutorial): Ready

If you see something like that (zone names may be different), your server is running. Head over to http://localhost:4000/ and you should see the game running!

You can change the message shown in the console (the Server: ready part) and the port that it runs on in FOLDER/src/server/config/serverConfig.js, the file should be pretty self-explanatory.

Using Mods

You can use a modpack by dropping it into the "mods" folder of the server source code.

Events

A list of events available:

  • onAfterGetLayerObjects
  • onBeforeBuildLayerTile
  • onBeforeGetAnimations
  • onBeforeGetClasses
  • onBeforeGetDialogue
  • onBeforeGetEventList
  • onBeforeGetFactions
  • onBeforeGetHerbConfig
  • onBeforeGetItemTypes
  • onBeforeGetMtxList
  • onBeforeGetQuests
  • onBeforeGetResourceList
  • onBeforeGetSkins
  • onBeforeGetSpellsConfig
  • onBeforeGetSpellsInfo
  • onBeforeGetSpellTemplate
  • onBeforeGetZone