Standalone [1.3] tModLoader - A Modding API

You make the IA of the Nyan Cats or you use the IA from the Stardust Dragon?
Stardust Dragon, I never even knew about the Meowmere until after I made this, I felt pretty dumb when I realized there were textures from the game I could have used.

is the damage type for summoner items item.summon or item.damage or neither?
item.summon is a boolean, so set it to true. item.damage will be the damage the summon will have.

thank you, what do the scripts for these things look like? i want to try (and probably fail at) making one of these. also do you know anything about ammo consumption reduction? thanks for the help.
Looks like we might need to put in a buff hook for specific ammo reductions (v0.6.1), but if you make a buff that sets player.ammoCost75 or player.ammoCost80 you can reduce by 20 or 25% (set both for 40%), or your item can just give the ammobox buff....If you want to make an item (weapon or ammon) that has reduced ammo usage, that is easy.

Code for a minions are just projectile scripts. They usually iterate through the npc array and use npc.CanBeChasedBy to find the closest npc and move in to attack.

Do you have experience writing your own NPC AIs and Projectile AIs?
 
Looks like we might need to put in a buff hook for specific ammo reductions (v0.6.1), but if you make a buff that sets player.ammoCost75 or player.ammoCost80 you can reduce by 20 or 25% (set both for 40%), or your item can just give the ammobox buff....If you want to make an item (weapon or ammon) that has reduced ammo usage, that is easy.

item.summon is a boolean, so set it to true. item.damage will be the damage the summon will have.
thank you very much. will ammo box buff reduce thrown weapon consumption?
 
Hey guys is there a way to make a crafting station that can craft everything without manually adding the recipes? Here's what I got so far.
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace CraftingMod.Tiles
{
    public class TheMachine : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
            TileObjectData.newTile.CoordinateHeights = new int[] { 18 };
            TileObjectData.addTile(Type);
            AddMapEntry(new Color(25, 142, 214), "The Machine");
            adjTiles = new int[] { TileID.Furnaces };
            adjTiles = new int[] { TileID.WorkBenches };
            adjTiles = new int[] { TileID.Anvils };
            adjTiles = new int[] { TileID.AlchemyTable };
            adjTiles = new int[] { TileID.Sawmill };
            adjTiles = new int[] { TileID.Loom };
            adjTiles = new int[] { TileID.Chairs };
            adjTiles = new int[] { TileID.Tables };
            adjTiles = new int[] { TileID.CookingPots };
            adjTiles = new int[] { TileID.TinkerersWorkbench };
            adjTiles = new int[] { TileID.ImbuingStation };
            adjTiles = new int[] { TileID.DyeVat };
            adjTiles = new int[] { TileID.DemonAltar };
            adjTiles = new int[] { TileID.Bookcases };
            adjTiles = new int[] { TileID.CrystalBall };
            adjTiles = new int[] { TileID.Autohammer };
            adjTiles = new int[] { TileID.LunarCraftingStation };
            adjTiles = new int[] { TileID.Kegs};
            adjTiles = new int[] { TileID.HeavyWorkBench };
            adjTiles = new int[] { TileID.Blendomatic };
            adjTiles = new int[] { TileID.MeatGrinder };
            adjTiles = new int[] { TileID.BoneWelder };
            adjTiles = new int[] { TileID.GlassKiln };
            adjTiles = new int[] { TileID.HoneyDispenser };
            adjTiles = new int[] { TileID.IceMachine };
            adjTiles = new int[] { TileID.LivingLoom };
            adjTiles = new int[] { TileID.SkyMill };
            adjTiles = new int[] { TileID.Solidifier };
            adjTiles = new int[] { TileID.SteampunkBoiler };
            adjTiles = new int[] { TileID.FleshCloningVat };
            adjTiles = new int[] { TileID.LihzahrdFurnace };
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("TheMachine"));
        }
    }
}
 
Hey guys is there a way to make a crafting station that can craft everything without manually adding the recipes? Here's what I got so far.
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace CraftingMod.Tiles
{
    public class TheMachine : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
            TileObjectData.newTile.CoordinateHeights = new int[] { 18 };
            TileObjectData.addTile(Type);
            AddMapEntry(new Color(25, 142, 214), "The Machine");
            adjTiles = new int[] { TileID.Furnaces };
            adjTiles = new int[] { TileID.WorkBenches };
            adjTiles = new int[] { TileID.Anvils };
            adjTiles = new int[] { TileID.AlchemyTable };
            adjTiles = new int[] { TileID.Sawmill };
            adjTiles = new int[] { TileID.Loom };
            adjTiles = new int[] { TileID.Chairs };
            adjTiles = new int[] { TileID.Tables };
            adjTiles = new int[] { TileID.CookingPots };
            adjTiles = new int[] { TileID.TinkerersWorkbench };
            adjTiles = new int[] { TileID.ImbuingStation };
            adjTiles = new int[] { TileID.DyeVat };
            adjTiles = new int[] { TileID.DemonAltar };
            adjTiles = new int[] { TileID.Bookcases };
            adjTiles = new int[] { TileID.CrystalBall };
            adjTiles = new int[] { TileID.Autohammer };
            adjTiles = new int[] { TileID.LunarCraftingStation };
            adjTiles = new int[] { TileID.Kegs};
            adjTiles = new int[] { TileID.HeavyWorkBench };
            adjTiles = new int[] { TileID.Blendomatic };
            adjTiles = new int[] { TileID.MeatGrinder };
            adjTiles = new int[] { TileID.BoneWelder };
            adjTiles = new int[] { TileID.GlassKiln };
            adjTiles = new int[] { TileID.HoneyDispenser };
            adjTiles = new int[] { TileID.IceMachine };
            adjTiles = new int[] { TileID.LivingLoom };
            adjTiles = new int[] { TileID.SkyMill };
            adjTiles = new int[] { TileID.Solidifier };
            adjTiles = new int[] { TileID.SteampunkBoiler };
            adjTiles = new int[] { TileID.FleshCloningVat };
            adjTiles = new int[] { TileID.LihzahrdFurnace };
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("TheMachine"));
        }
    }
}
why are you setting AdjTiles over 9000 times? You need to put all the IDs into one single int[] array, separated by comma and space
 
Question:
Is there a way to get a mod that doesn't use TModLoader to work in the "Mods" area?

An example would be N Terraria.
No, N Terraria is a separate executable. It would be like having Adobe Photoshop in the "Mods" area. That said, both N Terraria and tModLoader can coexist in the steam folder I believe, just open up the one you want.

Does anyone have the code for the lunar armors or know what they are?
If you need the setDefaults stuff, check here: https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Item-Field-Values

Or do you need help doing set bonuses? What are you hoping to accompilish?
 
don't know what to do anymore...
The item Wood does not exist in the mod CraftKnightMod.
If you are trying to use a vanilla item, try removing the first argument.
at Terraria.ModLoader.ModRecipe.AddIngredient(Mod mod, String itemName, Int32 stack)
at CraftKnightMod.Items.Weapons.SwordofDestruction.AddRecipes()
at Terraria.ModLoader.ModLoader.AddRecipes()
at Terraria.Recipe.SetupRecipes()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

here's the code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace CraftKnightMod.Items.Weapons
{
public class SwordofDestruction : ModItem
{
public override void SetDefaults()
{
item.name = "Sword of Destruction";
item.damage = 500;
item.melee = true;
item.width = 54;
item.height = 54;
item.toolTip = "You earned this.";
item.useTime = 37;
item.useAnimation = 37;
item.useStyle = 1;
item.knockBack = 6;
item.value = 1000000;
item.rare = 9;
item.useSound = 1;
item.autoReuse = true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "Wood", 0);
recipe.AddTile(null, "Work Bench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 
don't know what to do anymore...
The item Wood does not exist in the mod CraftKnightMod.
If you are trying to use a vanilla item, try removing the first argument.
at Terraria.ModLoader.ModRecipe.AddIngredient(Mod mod, String itemName, Int32 stack)
at CraftKnightMod.Items.Weapons.SwordofDestruction.AddRecipes()
at Terraria.ModLoader.ModLoader.AddRecipes()
at Terraria.Recipe.SetupRecipes()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

here's the code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace CraftKnightMod.Items.Weapons
{
public class SwordofDestruction : ModItem
{
public override void SetDefaults()
{
item.name = "Sword of Destruction";
item.damage = 500;
item.melee = true;
item.width = 54;
item.height = 54;
item.toolTip = "You earned this.";
item.useTime = 37;
item.useAnimation = 37;
item.useStyle = 1;
item.knockBack = 6;
item.value = 1000000;
item.rare = 9;
item.useSound = 1;
item.autoReuse = true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "Wood", 0);
recipe.AddTile(null, "Work Bench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
are you trying to get Wood from vanilla terraria as a recipe ingredient? because if so this line:
Code:
recipe.AddIngredient(null, "Wood", 0);
should be:
Code:
recipe.AddIngredient(ItemID.Wood, 1);
 
are you trying to get Wood from vanilla terraria as a recipe ingredient? because if so this line:
Code:
recipe.AddIngredient(null, "Wood", 0);
should be:
Code:
recipe.AddIngredient(ItemID.Wood, 1);
I kinda got it to work before I read the reply, but thanks anyway... Also, is there a way to increase the size of the weapon? scale isn't working...
 
You have a list with the AI of the summons? because i need that :S
Find id here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-IDs
Then look up ai here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-AIs

There is a lot of specific code to each typeid though, so I kinda doubt you'll be able to get anything to work without writing AI code. Decompiling Terraria will be your best bet for attempting a summon. You can download the tmodloader project, run setup, then open the solution in visual studios. From there, investigate the ai code for each summon and try to understand how they use the float arrays to accomplish their behaviors.
 
Find id here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-IDs
Then look up ai here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-AIs

There is a lot of specific code to each typeid though, so I kinda doubt you'll be able to get anything to work without writing AI code. Decompiling Terraria will be your best bet for attempting a summon. You can download the tmodloader project, run setup, then open the solution in visual studios. From there, investigate the ai code for each summon and try to understand how they use the float arrays to accomplish their behaviors.

Thanks for all
 
Find id here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-IDs
Then look up ai here:
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Projectile-AIs

There is a lot of specific code to each typeid though, so I kinda doubt you'll be able to get anything to work without writing AI code. Decompiling Terraria will be your best bet for attempting a summon. You can download the tmodloader project, run setup, then open the solution in visual studios. From there, investigate the ai code for each summon and try to understand how they use the float arrays to accomplish their behaviors.

The projectile works good, but the buff... What i need to put into public virtual void Update(Player player, ref int buffIndex)?
 
Back
Top Bottom