User:Discode/Modding Getting Started: Difference between revisions

From Ylvapedia
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 51: Line 51:
In Visual Studio, right click the name of your project under '''Solution Explorer>Add>New Item'''.
In Visual Studio, right click the name of your project under '''Solution Explorer>Add>New Item'''.
Click '''Data''' on the left and add an '''XML File''', name it '''package.xml'''.
Click '''Data''' on the left and add an '''XML File''', name it '''package.xml'''.
Add this to '''package.xml''':
 
Add this to '''package.xml''': (Version number should match or be close to Elin's version)
  <nowiki>
  <nowiki>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
Line 116: Line 117:
* [https://github.com/MinusGix/ElinExampleMod Elin Mod Template]
* [https://github.com/MinusGix/ElinExampleMod Elin Mod Template]
* [https://weaselofdeath.github.io/ElinModdingDocumentation/index.html Elin Modding Documentation]
* [https://weaselofdeath.github.io/ElinModdingDocumentation/index.html Elin Modding Documentation]
* [https://elin-modding-resources.github.io/Elin.Docs/ Elin Modding Resources]


== Sources ==
== Sources ==

Latest revision as of 22:43, 1 December 2024

This a guide on how to setup the development environment and a quickstart guide to modding using an example.

Getting Started

Project Setup

Download Visual Studio 2019 or 2022

Make sure to install .NET desktop development. It should say ".NET Framework 4.7.2 development tools" is included on the right.

Visual Studio Installer

Create a new folder where you would like to store your mods, name it whatever you want.

Create 3 folders inside this folder named: Elin, BepInEx and Mods.

Navigate to your Elin folder. (You can find your Elin folder by going to Steam, right clicking Elin>Properties, and under Installed Files, click "Browse".)

Under /Elin/Elin_Data/BepInEx/core, copy these files to the BepInEx folder you made:

  • 0Harmony.dll
  • BepInEx.Core.dll
  • BepInEx.Core.xml
  • BepInEx.Unity.dll
  • BepInEx.Unity.xml

Under /Elin/Elin_Data/Managed/, copy these files to the Elin folder you made:

  • Elin.dll
  • Plugins.BaseCore.dll
  • Plugins.UI.dll
  • Reflex.dll
  • UnityEngine.dll
  • UnityEngine.CoreModule.dll

If a .dll is missing in a project you're trying to build, simply go to your game's folder and look for them.

Now run Visual Studio, create a new project: Class Library (.Net Framework)

Create a new project

Set the location to the Mods folder you created

Check the box that says Place solution and project in the same directory.

Set the Framework as .NET Framework 4.7.2

Configure your new project

After creating your project, go to your Solution Explorer, right click References, click Add References.

Create a new project

In the Reference Manager, browse to the 3 folders you created and add all the .dlls from the Elin and BepInEx folder you made.

Create a new project

Make sure they're checked marked to the left on each .dll's name.

Adding XML File

In Visual Studio, right click the name of your project under Solution Explorer>Add>New Item. Click Data on the left and add an XML File, name it package.xml.

Add this to package.xml: (Version number should match or be close to Elin's version)

<?xml version="1.0" encoding="utf-8"?>
<Meta>
	<title>newElinModd</title>
	<id>new_Elin_Mod</id>
	<author>author</author>
	<loadPriority>100</loadPriority>
	<description>
		Test Mod
	</description>
	<version>0.23.30</version>
</Meta>

On the Solutions Explorer, left click package.xml. Then on the right side of Visual Studio, on the Properties window, set Copy to Output Directory to Copy always.

This project is now setup to make mods. Save it as a template when you make another mod.

QOL Settings

Set References' Copy Local to False

Highlight all references except Analyzers under Solution Explorer.

On the right window of Visual Studio is Properties, change Copy Local to False.

Set Release's Output path to a mod test folder

Navigate to your game's folder: /Elin/Package/ and create a folder with a name of your choice e.g Mod_Test.

In Visual Studio, right click the name of your project under Solution Explorer, go to Properties and change the Output path to your /Elin/Package/Mod_Test (The folder you created.)

Enable BepInEx Console

Navigate to your game's folder: /Elin/BepInEx/config.

Open BepInEx.cfg with Notepad.

Find [Logging.Console]

Set Enabled = true

Now you can use System.Console.WriteLine("yourStringHere"); in your mods and obtain an output.


Example

We are now going to try building the SimpleMod_example.

Download and extract it.

Add a new class to your project and copy the contents of /SimpleMod_Example/Assets/SimpleMod/NerunTest.cs.

Build and it should show up wherever you designated in the Output path.

Verify the .dll and .xml are in the folder at /Elin/Package/YourFolder.

Run Elin.

The mod should be enabled by default but you can check through the mod window.

Now test it by entering different zones. Nerun should pop up and tell you the zone's name.

Helpful Resources

Sources

Using "Google Translate on: