Mod calls (Bosses As NPCs)
Bosses As NPCs features many Mod Calls that other mods can use.
General
Call String | Return Type | Info |
---|---|---|
"downedBetsy" |
bool |
Returns true or false if Betsy has been defeated in the current world. |
"downedDungeonGuardian" |
bool |
Returns true or false if Dungeon Guardian has been defeated in the current world. |
"downedDarkMage" |
bool |
Returns true or false if Dark Mage has been defeated in the current world. This is either the Tier 1 or Tier 3 Dark Mage. |
"downedOgre" |
bool |
Returns true or false if Ogre has been defeated in the current world. This is either the Tier 2 or Tier 3 Ogre. |
"downedGoblinSummoner" |
bool |
Returns true or false if Goblin Warlock has been defeated in the current world. |
"downedDreadnautilus" |
bool |
Returns true or false if Dreadnautilus has been defeated in the current world. |
"downedMothron" |
bool |
Returns true or false if Mothron has been defeated in the current world. |
"downedEoW" |
bool |
Returns true or false if Eater of Worlds has been defeated in the current world. |
"downedBoC" |
bool |
Returns true or false if Brain of Cthulhu has been defeated in the current world. |
"downedWoF" |
bool |
Returns true or false if Wall of Flesh has been defeated in the current world. |
"daytimeEoLDefeated" |
bool |
Returns true or false if Empress of Light has been defeated during the daytime in the current world. |
"SellExpertMode" |
bool |
Returns true or false based on the "Sell Expert Mode Items in Non-Expert Worlds" config setting. |
"SellMasterMode" |
bool |
Returns true or false based on the "Sell Master Mode Items in Non-Master Worlds" config setting. |
"SellExtraItems" |
bool |
Returns true or false based on the "Sell Extra Items" config setting. |
"shopMulti" |
float |
Returns the value of the "Shop Price Scaling" config setting divided by 100. Range is 0.25f to 4f. If you are adding items with the "AddToShop" call, you do not need to worry about this.
|
"TownNPCsCrossModSupport" |
bool |
Returns true or false based on the "Town NPCs Cross Mod Support" config setting. |
"CatchNPCs" |
bool |
Returns true or false based on the "Catch Town NPCs" config setting. |
"GoblinSellInvasionItems" |
bool |
Returns true or false based on the "Goblin Tinkerer Sells Goblin Army Items" config setting. |
"PirateSellInvasionItems" |
bool |
Returns true or false based on the "Pirate Sells Pirate Invasion Items" config setting. |
"GetStatusShop1" |
bool |
Obsolete Use one of the "AddToShop" calls. |
"GetStatusShop2" |
bool |
Obsolete Use one of the "AddToShop" calls. |
Can Spawn
Call String | Second Argument | Return Type | Info |
---|---|---|---|
"CanSpawn" |
"KingSlime" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"EyeOfCthulhu" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"EaterOfWorlds" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"BrainOfCthulhu" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"QueenBee" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Skeletron" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Deerclops" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"WallOfFlesh" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"QueenSlime" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"TheDestroyer" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"TheTwins" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"SkeletronPrime" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Plantera" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Golem" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"EmpressOfLight" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"DukeFishron" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Betsy" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"LunaticCultist" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"MoonLord" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Dreadnautilus" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Mothron" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"Pumpking" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"IceQueen" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"MartianSaucer" |
bool |
Returns true or false based on the corresponding config setting. |
"CanSpawn" |
"TorchGod" |
bool |
Returns true or false if the All in One NPC Mode config is "Mixed" or "Only One" .
|
Get Condition
Call String | Second Argument | Return Type | Description |
---|---|---|---|
"GetCondition" |
"TownNPCsCrossModSupport" |
Condition |
'Town NPCs Cross Mod Support' config is enabled |
"GetCondition" |
"SellExtraItems" |
Condition |
'Sell Extra Items' config is enabled |
"GetCondition" |
"GoblinSellInvasionItems" |
Condition |
'Goblin Tinkerer Sells Goblin Army Items' config is enabled |
"GetCondition" |
"PirateSellInvasionItems" |
Condition |
'Pirate Sells Pirate Invasion Items' config is enabled |
"GetCondition" |
"IsNotNpcShimmered" |
Condition |
When the vendor is not a shimmer variant |
"GetCondition" |
"Expert" |
Condition |
In Expert mode or 'Sell Expert Mode Items in Non-Expert Worlds' config is enabled |
"GetCondition" |
"Master" |
Condition |
In Master mode or 'Sell Master Mode Items in Non-Master Worlds' config is enabled |
"GetCondition" |
"DaytimeEoLDefated" |
Condition |
After defeating Empress of Light during the day time |
"GetCondition" |
"DownedBetsy" |
Condition |
After defeating Betsy |
"GetCondition" |
"DownedDungeonGuardian" |
Condition |
After defeating Dungeon Guardian |
"GetCondition" |
"DownedDarkMage" |
Condition |
After defeating Dark Mage |
"GetCondition" |
"DownedOgre" |
Condition |
After defeating Ogre |
"GetCondition" |
"DownedGoblinWarlock" |
Condition |
After defeating Goblin Warlock |
"GetCondition" |
"DownedMothron" |
Condition |
After defeating Mothron |
"GetCondition" |
"DownedDreadnautilus" |
Condition |
After defeating Dreadnautilus |
"GetCondition" |
"DownedEaterOfWorlds" |
Condition |
After defeating Eater of Worlds |
"GetCondition" |
"DownedBrainOfCthulhu" |
Condition |
After defeating Brain of Cthulhu |
"GetCondition" |
"DownedWallOfFlesh" |
Condition |
After defeating Wall of Flesh |
"GetCondition" |
"RescuedWizard" |
Condition |
After rescuing the Wizard |
"GetCondition" |
"UnlockOWMusicOrDrunkWorld" |
Condition |
After unlocking the Otherworldly music |
"GetCondition" |
"CorruptionOrHardmode" |
Condition |
In a world with The Corruption or In hardmode |
"GetCondition" |
"CrimsonOrHardmode" |
Condition |
In a world with The Crimson or In hardmode |
"GetCondition" |
"UndergroundCavernsOrHardmode" |
Condition |
When in the Underground or Caverns layer, or In hardmode |
"GetCondition" |
"HallowOrCorruptionOrCrimson" |
Condition |
When in the Hallow, Corruption, or Crimson |
"GetCondition" |
"InIceAndHallowOrCorruptionOrCrimson" |
Condition |
When in the Ice biome and When in the Hallow, Corruption, or Crimson |
Add To Shop
There are four types of calls you can make to add items to the shops. Call string is "AddToShop"
Usage: mod.Call("AddToShop", string priceMode, string npc, int item, List<Condition> condition, ...)
string priceMode
refers to the price mode on the item. It can be "DefaultPrice"
, "CustomPrice"
, "WithDiv"
, or "WithDivAndMulti"
. See their respective sections below for more information.
string npc
refers to which NPC you want to add the item to. See below for a list of names.
int item
refers to the item you want to add to the shop. For vanilla items, use ItemID.Item
and for modded items, use ModContent.ItemType<YourItemClass>()
List<Condition> condition
refers to the availability of the item. The condition can be anything, but it must be a Condition record.
Here are some examples of conditions you may want to use:
new List<Condition>() { }
for always available.new List<Condition>() { Condition.DownedEyeOfCthulhu}
for available after defeating the Eye of Cthulhu.new List<Condition>() { (Condition)bossesAsNPCs.Call("GetCondition", "Expert") }
for available in Expert Mode or if the "Sell Expert Mode Items in Non-Expert Worlds" config is enabled.new List<Condition>() { (Condition)bossesAsNPCs.Call("GetCondition", "DownedGoblinWarlock") }
for available after defeating the Goblin Summoner (Bosses As NPC call).new List<Condition>() { (Condition)bossesAsNPCs.Call("GetCondition", "SellExtraItems") }
for available if the "Sell Extra Items" config is enabled.new List<Condition>() { Condition.PlayerCarriesItem(ItemID.IronPickaxe) }
for available if the player has an Iron Pickaxe in their inventory. This a pre-defined Condition in tModLoader.new List<Condition>() { Condition.MoonPhaseFull }
for available if the current Moon phase is a Full Moon (not necessarily nighttime).new List<Condition>() { Condition.DownedQueenBee, Condition.InJungle }
for available if Queen Bee has been defeated and the Town NPC/player is in the Jungle.
The "AddToShop" calls will return false if unsuccessful. (Returning true doesn't necessarily mean it was successful though. Check the log files for any warnings if you do not see your item in the shops.)
You do not need to worry about adding the shop to the Torch God, as he will automatically get the corresponding boss' shop.
You do not need to worry about setting the shop scaling for prices, that is handled automatically as well.
You do not need to worry about checking if the NPC/shop is enabled, that is handled automatically as well.
Valid Shop Names
The following are the valid shops that you can specify with "AddToShop"
- "KingSlime"
- "EyeOfCthulhu"
- "EaterOfWorlds"
- "BrainOfCthulhu"
- "QueenBee"
- "Skeletron"
- "Deerclops"
- "WallOfFlesh"
- "QueenSlime"
- "TheDestroyer"
- "Retinazer"
- "Spazmatism"
- "SkeletronPrime"
- "Plantera"
- "Golem"
- "EmpressOfLight"
- "DukeFishron"
- "Betsy"
- "LunaticCultist"
- "MoonLord"
- "Dreadnautilus"
- "Mothron"
- "Pumpking"
- "IceQueen"
- "MartianSaucer"
- "GoblinTinkerer"
- "Pirate"
"DefaultPrice"
Usage: mod.Call("AddToShop", "DefaultPrice", string npc, int item, List<Condition> condition)
The price of the item will be the item's value.
"CustomPrice"
Usage: mod.Call("AddToShop", "CustomPrice", string npc, int item, List<Condition> condition, int customPrice)
The price of the item will whatever is set for the customPrice int. The value is in copper coins. 1 is one copper coin, 100 is one silver coin, 10000 is one gold coin, and 1000000 is one platinum coin. Alternatively, you can use Item.buyPrice()
to set the value.
You can do math to pre-calculate the value if you would like. For example, you could do something like (int)Math.Round(Item.buyPrice(gold: 5) / 0.05f))
to set the value to '5 gold coins at 5% chance' (using the same formula this mod uses).
"WithDiv"
Usage: mod.Call("AddToShop", "WithDiv", string npc, int item, List<Condition> condition, float priceDiv)
The price of the item will be the item's (value / 5 / priceDiv). This will follow the formula this mod uses which is the sell price divided by the chance. The item's value will 5 times the sell price, which is why it is first divided by 5.
"WithDivAndMulti"
Usage: mod.Call("AddToShop", "WithDivAndMulti", string npc, int item, List<Condition> condition, float priceDiv, float priceMulti)
The price of the item will be the item's ((value / priceDiv) * priceMulti).
If you wanted an item just to be more expensive than its value, simply set the priceDiv to 1f and the priceMulti to the multiplier you want.
Disable Internal Cross Mod Support
These calls will disable the internal cross mod support for the specified mod.
Call String | Second Argument | Return Type | Description |
---|---|---|---|
"DisableInternalCrossModSupport" |
"Fargowiltas" |
false |
Disables the internal support for Fargo's Mutant Mod |
"DisableInternalCrossModSupport" |
"FargowiltasSouls" |
false |
Disables the internal support for Fargo's Souls Mod |
"DisableInternalCrossModSupport" |
"CalamityMod" |
false |
Disables the internal support for Calamity Mod |
"DisableInternalCrossModSupport" |
"OrchidMod" |
false |
Disables the internal support for Orchid Mod |
"DisableInternalCrossModSupport" |
"Polarities" |
false |
Disables the internal support for Polarities |
"DisableInternalCrossModSupport" |
"ThoriumMod" |
false |
Disables the internal support for Thorium Mod |
"DisableInternalCrossModSupport" |
"StormDiversMod" |
false |
Disables the internal support for Storm's Additions Mod |
"DisableInternalCrossModSupport" |
"AmuletOfManyMinions" |
false |
Disables the internal support for Amulet of Many Minions |
"DisableInternalCrossModSupport" |
"ClickerClass" |
false |
Disables the internal support for Clicker Class |
"DisableInternalCrossModSupport" |
"QwertyMod" |
false |
Disables the internal support for Qwerty's Bosses and Items 2 |
"DisableInternalCrossModSupport" |
"MagicStorage" |
false |
Disables the internal support for Magic Storage |
"DisableInternalCrossModSupport" |
"ItReallyMustBe" |
false |
Disables the internal support for Dreadnautilus is a Boss |
"DisableInternalCrossModSupport" |
"EchoesoftheAncients" |
false |
Disables the internal support for Echoes of the Ancients |
"DisableInternalCrossModSupport" |
"StarsAbove" |
false |
Disables the internal support for The Stars Above |
"DisableInternalCrossModSupport" |
"StarlightRiver" |
false |
Disables the internal support for Starlight River |
"DisableInternalCrossModSupport" |
"PboneUtils" |
false |
Disables the internal support for Pbone's Utilities |
Log file warnings
If you have done something wrong, there will be warnings printed in the log file to help you figure out what you did wrong.
"Expected a function name for the first argument"
You called nothing?
"Function "function" is not defined by BossesAsNPCs"
Your call string is wrong. Make sure you have spelled it correctly.
"Function "function" is obsolete. Please use one of the "AddToShop" calls."
Calling "GetStatusShop1"
or "GetStatusShop2"
will show this warning in the logs. The calls will still work, but you should really be using the "AddToShop" calls.
"Expected # arguments for Mod.Call("function", "argNames"), got # arguments instead"
You entered the incorrect number of arguments for the call you made. Take a look at the calls above and make sure you have the correct number of arguments passed.
"Argument "arg" of Function "function" is not defined by Bosses As NPCs"
The second argument for either the "CanSpawn"
or "AddToShop"
call is incorrect.
"Cross mod SetShopItem(): Item type ID "#" exceeded the number of loaded items!"
The item you set in your "AddToShop"
call is larger than the number of loaded items. Use ItemID.Item
for vanilla items and ModContent.ItemType<YourItemClass>()
for modded items to set the item type.
"Cross mod SetShopItem(): NPC string "string" is not a valid npc type!"
The NPC you set in your "AddToShop"
is incorrect. Check the spelling and capitalization.
"Internal cross mod support for Mod has been disabled."
This is just a debug message letting you know that the internal support for that mod has been disabled.
Example Usage
Usage example:
public override void PostSetupContent() { if (ModLoader.TryGetMod("BossesAsNPCs", out Mod bossesAsNPCs)) { bossesAsNPCs.Call("AddToShop", "WithDiv", "GoblinTinkerer", ModContent.ItemType<My10PercentDropChanceItem>(), new List<Condition>() { (Condition)bossesAsNPCs.Call("GetCondition", "DownedGoblinWarlock") }, 0.1f); bossesAsNPCs.Call("AddToShop", "DefaultPrice", "IceQueen", ModContent.ItemType<MyExpertItem>(), new List<Condition>() { (Condition)bossesAsNPCs.Call("GetCondition", "Expert") }); int itemType = ModContent.ItemType<MyVanityOrMatieralItem>(); List<Condition> availability = new() { (Condition)bossesAsNPCs.Call("GetCondition", "SellExtraItems") }; int price = (int)Math.Round(30000 / 0.05f); bossesAsNPCs.Call("AddToShop", "CustomPrice", "BrainOfCthulhu", itemType, availability, price); bossesAsNPCs.Call("AddToShop", "CustomPrice", "EmpressOfLight", (int)ItemID.SoulofLight, new List<Condition>(), Item.buyPrice(gold: 5)); bossesAsNPCs.Call("AddToShop", "WithDivAndMulti", "Golem", ModContent.ItemType<MyExpensiveItem>(), new List<Condition>() { Condition.DownedMoonLord, Condition.InJungle }, 1f, 20f); } }
To see these examples in more detail, take a look at this example file: CrossModExamples.cs
For a working example, take a look at Rijam's Mod: RijamsMod: RijamsMod.cs
See the tModLoader Wiki for information on Mod Calls.
Happiness
See this example for adding cross mod happiness through GlobalNPC: CrossModExamples.cs
For a working example, take a look at Rijam's Mod: RijamsMod: GlobalNPCs.cs