Mod Integrations (Final Fantasy Distant Memories)

From Terraria Mods Wiki
Jump to navigation Jump to search


It is possible to set up an integration to Final Fantasy Distant Memories from your own mod. In doing so, you can take advantage of our Elemental system, as well as NPC and Item Types.

Full example:

using Terraria.ID;
using Terraria.ModLoader;
namespace FFDMAddon
{
	public class FFDMAddon : ModSystem
	{
       public override void PostSetupContent()
       {
           if (ModLoader.TryGetMod("FF6Mod", out Mod ffdmMod))
           {
               ffdmMod.Call("NPC", NPCID.CorruptSlime, "Fire", 1); //Corrupt Slime weak to fire
               ffdmMod.Call("NPCMelee", NPCID.CorruptSlime, "Dark"); //Corrupt Slime deals dark damage on hit
               ffdmMod.Call("Projectile", ProjectileID.AdamantiteChainsaw, "Wind"); //Adamantite Chainsaw deals Wind dmg
               ffdmMod.Call("Weapon", ItemID.AdamantiteChainsaw, "Wind");//Adamantite Chainsaw displays as Wind dmg
               ffdmMod.Call("ItemType", ItemID.Snowball, "Special"); //Snowball displays 'Special' icon type
               ffdmMod.Call("Armor", ItemID.AdamantiteBreastplate, "Dark", 2); //Adamantite breastplate is now resistant to Dark
           }
       }
   }
}

Let's look at this example line by line.

First, this should be in a ModSystem class. Secondly, the mod calls will go in the PostSetupContent() method. If you are unsure about what these are, please refer to the TML Wiki and ExampleMod.

For the Element parameter, there are 9 to choose from for each type of call. They are:

  • Fire
  • Ice
  • Bolt
  • Water
  • Earth
  • Wind
  • Holy
  • Dark
  • Poison

Elemental Calls

NPC

NPCs have 2 types of calls associated with them. The first is "NPC", which is used to set weakness, resistance, immunity or absorption of an element. The second is "NPCMelee", which is used solely for setting the type of damage that the NPC will do when it deals contact damage with the player. This does not change any resistances for the NPC itself. So an NPC could be weak to Fire damage, yet still deal Fire damage on contact, for example.

The NPC call has these parameters: ffdmMod.Call("NPC", NPC ID, "Element", Resistance). In our example, we have ffdmMod.Call("NPC", NPCID.CorruptSlime, "Fire", 1)

  • "NPC" - This is required to designate the type of call.
  • NPCID - This will be the ID of your NPC. You can use NPCID for a vanilla NPC, or ModContent.NPCType<type>() for a custom NPC from your mod.
  • "Element"- This designates the element. There are 9 to choose from, please see above. These are entered as a string, within quotes. Ex. "Earth" or "Wind"
  • Resistance - This is a number from between 1 to 4. 1 designates weakness, 2 designates resistance, 3 designates immunity, and 4 designates absorption.

So having the call in our example as ffdmMod.Call("NPC", NPCID.CorruptSlime, "Fire", 1) would designate the Corrupt Slime NPC as weak to fire. An alternate example could be ffdmMod.Call("NPC", NPCID.CorruptSlime, "Dark", 2) which will make the Corrupt Slime resistant to dark.

It's also perfectly fine to have multiple Calls referring to the same NPC, if you want to set multiple weaknesses / resistances.

NPCMelee

The NPCMelee call has these parameters: ffdmMod.Call("NPCMelee", NPCID, "Element")

  • "NPCMelee" - This is required
  • NPCID - This will be the ID of your NPC. You can use NPCID for a vanilla NPC, or ModContent.NPCType<type>() for a custom NPC from your mod.
  • "Element" - This designates the elemental contact damage that the player would take when hit by this NPC.

So for example, ffdmMod.Call("NPCMelee", NPCID.CorruptSlime, "Dark"); would designate the Corrupt Slime as dealing dark damage when it hits the player by touching it.

If an NPC shoots projectiles, the element of the projectile would have to be set as well, NPCMelee does not affect that.

Projectile

Projectiles can be set to 1 or more elements, and that will be the type of damage done when the projectile hits a Player or an NPC.

The Projectile call has these parameters: ffdmMod.Call("Projectile", ProjectileID, "Element");

  • "Projectile" - required
  • ProjectileID - The ID of your Projectile, either ProjectileID for a vanilla projectile, or ModContent.ProjectileType<type>() for a custom projectile
  • "Element" - The type of damage this Projectile will deal on hit

Weapon

This designates the element of an item, and in the case of Broadswords, Pickaxes, Axes, and other melee weapons, also determines the type of damage dealt on hit.

Because designating an element also modifies the item's tooltip, it's recommended to do this even for items which do not directly damage an NPC. For example, the Water Bolt book. If you designate this as Water Damage, the Projectile itself is still neutral unless the Projectile is also designated as Water Damage. However, designating the item will display "This item deals Water damage" on the book's tooltip.

The Weapon call has these parameters: ffdmMod.Call("Weapon", ItemID, "Element");

  • "Weapon" - required (this is also used for items, not just damaging weapons)
  • ItemID - The ID of your Item, either ItemID for a vanilla projectile, or ModContent.ItemType<type>() for a custom item
  • "Element" - The type of damage this Item will deal on hit

Armor

This designates elemental weakness and resistance for an armor.

Resistances for armor can stack from different sources. If you designate a Helmet, Breastplate, and Leggings as resistant to Fire, each one will reduce Fire damage by 33%, for 99% reduction total. Otherwise, resistance and weakness works the same as it does for an NPC.

The Armor call has these parameters: ffdmMod.Call("Armor", ItemID, "Element", Resistance);

  • "Armor" - Required
  • ItemID - The ID of your Item, either ItemID for a vanilla projectile, or ModContent.ItemType<type>() for a custom item
  • "Element" - One of the 9 elements, please refer to the list at the top of the page
  • Resistance - A number between 1 to 4. 1 designates weakness, 2 designates resistance, 3 designates immunity, and 4 designates absorption.

Item Type calls

You can designate a weapon as a specific type, such as Broadsword, Spear, etc. The mod attempts to do this automatically on load, even for other mod's items. However it cannot guess everything, so you may need to specify your own. Item Types are used to specify what weapons work with what character abilities and other effects. For example, Kain's Dragoon Dive will have bonus damage with a Spear. Specifying the type also displays an icon with the weapon name, showing that it's properly specified.

The ItemType call has these parameters: ffdmMod.Call("ItemType", ItemID, "Type");

  • "ItemType" - Required
  • ItemID - The ID of your Item, either ItemID for a vanilla projectile, or ModContent.ItemType<type>() for a custom item
  • "Type" - This will be a string, such as "Arrow" or "Axe". Please see the list below. Please note these are case sensitive

Item types that can be specified:

  • Arrow
  • Axe
  • Bard
  • Bell
  • BlackMagic
  • Block (used for placeable blocks)
  • Boomerang
  • Boots
  • Bow
  • Bracer
  • Broadsword
  • Bullet
  • Cape
  • Chainsaw
  • Claw
  • Consumable
  • Drill
  • Flail
  • Food
  • Gambler (Used for Setzer's items and items like Dice)
  • GreyMagic (Used for effect / buff magic)
  • Gun
  • Hammer
  • Hat (Intended for lighter helmet types, like masks and hats)
  • HeavyArmor
  • Helmet
  • Katana
  • Launcher
  • LightArmor (Intended for Robes and other cloth armor)
  • Loot (misc loot items)
  • Mechanic (For example, the Mechanic's wrench)
  • Mount
  • Pants
  • Pickaxe
  • Relic (Used for accessories that do not fit into another accessory category)
  • Revival (Used for an item that can bring back a dead player)
  • Ring
  • Rod
  • Scroll (Used for Thrown items from the various Ninja type characters)
  • Shield
  • Shortsword
  • Spawn (Used for an item that spawns an NPC)
  • Spear
  • Special (Used for items that may not fit into other categories)
  • Staff (Intended for Effect / healing staves, for damaging ones use Rod)
  • Stat (Used for items that raise the player's stats, for example the Terraria Heart Crystal)
  • Summon
  • Tent (Used for the Tent item, which provides a full party heal)
  • Thrown
  • Tools (Used for Edgar's Tools)
  • Whip
  • WhiteMagic (Used for healing magic, and holy type attack spells)
  • Wing
  • Yoyo