

This is a lighweight API to load enemy which relies on Lethal Lib, I do not appropriate myself any of the methods and classes given from this API, they belong to their original creator and are only seperated from the main code in the objective of making a better supported API for monster implementation. Right now this API only helps you adding monster and doesn't provide any functions, but in the future, I will be adding a bunch of different methods that are going to be useful to create monsters. This API is meant to be lightweight making it less likely to break with future updates Join me on my Discord if you have any questions! Or ask them on the LethalCompany Modding Server
First, you will need to add LethalBestiary as a dependecy of your solution. The way to do it is different for both VisualStudio and rider so follow those documentations for those to IDE :
For Rider, simply right click your solutions dependency, click on add dependecy. On the popup window, click on add From and then reference LethalBestiary.dll
This is very important, if you are using LethalLib or LethalLevelLoader and you use other stuff of those dependencies, it will be important to make sure you are referencing the RIGHT dependency for our 3 api uses the same naming convention. If you only want to add enemy, use this api, if you want to add more stuff than enemy, I'd suggest using Lethal Level Loader once it updates or the current LethalLib.
In your Plugin.cs, add the following Imports :
using LethalBestiary.Modules;
It will be important for this API to load before your mod else it will break, so you will have to add the following line above your PluginClass so that it will always load before yours! Here is an example :
namespace NightmareFoxyLC {
//Plugin BepInEx declaration
[BepInPlugin(ModGUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
//LINE TO ADD! ModGUID is a reference your mod GUID
[BepInDependency(LethalBestiary.Plugin.ModGUID)]
public class Plugin : BaseUnityPlugin {
//PluginOther stuff
Now to the main dishes, Here is how you implement your enemy into the game registry! In your Awake() function of your Plugin.cs, the following must be present :
InitializeNetworkBehaviours();
NetworkPrefabs.RegisterNetworkPrefab(FoxyEnemy.enemyPrefab);
Enemies.RegisterEnemy(EnemyType, RarityInt, Levels.LevelTypes.All, Enemies.SpawnType.Default, EnemyTerminalNodeTN, EnemyTerminalKeywordTk);
What are those you may ask? Let me break it down for you!
This must be called before we register the next step. Don't give it any parameters, leave it as is!
We register our prefab on the network so that there will be good syncing, missing this step will result in your enemy not despawning for some players, the enemy killing people who don't see him and worse.
What I am giving to this method is a reference to my enemyPrefab connected to my enemy type.
As you may know, I got my enemy type from
var EnemyType = ModAssetsBundle.LoadAsset<EnemyType>("NameOfEemyTypeAssetInAssetBundle");
And this EnemyType holds a reference to my prefab!
Here we are at the most important step! Registering our enemy! FINALY!!! Ok, so here are the parameters :
Levels.LevelTypes.AssuranceLevel, modded moons only : Levels.LevelTypes.Modded, vanilla moons only : Levels.LevelTypes.Vanilla or all moons as I did earlier Levels.LevelTypes.AllEnemies.SpawnType.Default, outside : Enemies.SpawnType.Outside or like pacive monsters (outside but with a twist of not being considered an enemy) : Enemies.SpawnType.DaytimeModAssets.LoadAsset<TerminalNode>("MonsterTN"); You have to create it and add it to your bundle!ModAssets.LoadAsset<TerminalNode>("MonsterTK"); You have to create it and add it to your bundle!\Your enemy is now in the game! Have fun! You will have to have this package as a dependency to your mod tho...
The AddEnemyToLevel(SpawnableEnemy spawnableEnemy, SelectableLevel level)
you can add your enemy to a specific level.