EtG Modding Guide
Search…
⌃K

Synergies

Difficulty: 3/10

Getting Started

This guide will showcase how to create new synergies with your items / guns, and showcase how to add your items / guns to already existing synergies.

New synergies

If you are using the provided Example Mod, you will have access to all the tools required to make your synergy, as ItemAPI innately provides the tools to do that.
To add a new synergy to your item, you add this:
List<string> mandatoryConsoleIDs = new List<string>
{
"",
};
List<string> optionalConsoleIDs = new List<string>
{
""
};
CustomSynergies.Add("Your synergy name", mandatoryConsoleIDs, optionalConsoleIDs, true);
This will add a new synergy with the appropriate parameters to your item / gun. The first argument in the Add() method is the name of your synergy, which you will look for when creating custom effects for your synergy,
The 2nd part is a list of mandatory items / guns for your synergy. You will need to add the console ID of your item / gun into that list for it to be required to have for your synergy. (The console ID is what you use to give yourself the item via the F2 console ingame)
An example of a mandatory item list. You can have only one entry in it if you wish for only your item to be mandatory for the synergy.
The 3rd part is a list of optional items / guns. When any optional item is paired with all of the mandatory items, the synergy will be active in game. Again, this list also uses console IDs.
An example of an optional item list. If the player has all mandatory items and any of these items, the synergy will activate.
The 4th part is whether the synergy is unable to be activated due to Lichs Eye Bullets. You can usually just leave this as true so your item-based synergies do not get activated due to Lichs Eye Bullets.
(Note, if you simply want the synergy to only be activated from only 2 items, you can simply add both items to the mandatory list and leave the optional list empty / as null)
(Note, when adding synergies to guns, you will need to place the code after this specific line of code (seen just below) or the synergy will not be added.)
As an example, here is what the whole block should look like.
(Note, your items / guns can have multiple synergies, as long as you create unique lists for them and run the CustomSynergies.Add() method multiple times.)
An example of multiple synergies being added to a singular item.
To check in the code to see if your synergy is active, you run:
if (player.PlayerHasActiveSynergy("your synergy name"))
{
//Your code here
}
This will check if the player has a specific synergy, and if it is true, will run the code that is in the brackets.
To add your item to an already existing synergy, firstly check if you are able to do: access "AddItemToSynergy() through your item." If you are, you can simply do this:
Note that navigating the list of available synergies is unintuitive as Dodge Roll didn't label the synergies in the code appropriately.
If you do NOT have access to this method, add this block of code somewhere in your mod as long as it is inside of a static class (You will only need to do this once). Then, you can do what is above.
public static void AddItemToSynergy(this PickupObject obj, CustomSynergyType type)
{
AddItemToSynergy(type, obj.PickupObjectId);
}
public static void AddItemToSynergy(CustomSynergyType type, int id)
{
foreach (AdvancedSynergyEntry entry in GameManager.Instance.SynergyManager.synergies)
{
if (entry.bonusSynergies.Contains(type))
{
if (PickupObjectDatabase.GetById(id) != null)
{
PickupObject obj = PickupObjectDatabase.GetById(id);
if (obj is Gun)
{
if (entry.OptionalGunIDs != null)
{
entry.OptionalGunIDs.Add(id);
}
else
{
entry.OptionalGunIDs = new List<int> { id };
}
}
else
{
if (entry.OptionalItemIDs != null)
{
entry.OptionalItemIDs.Add(id);
}
else
{
entry.OptionalItemIDs = new List<int> { id };
}
}
}
}
}
}
An example of adding it to a static class. (You can create your own class for this as well.)