tModLoader Official tModLoader Help Thread

I am trying to make a mod that adds more prefixes, but I cannot figure out how to assign the SetStats() parameters values, so nothing happens when a weapon has the modifier. Can someone tell me how to assign the parameters values?

This is my code:
[/
C#:
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using Terraria.Utilities;

namespace TheModifierMod.Items
{
    //SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus);
    public class Ungodly : ModPrefix
    {
        static float damageMult = 1.5f;
        static float knockbackMult = 1.5f;
        static float useTimeMult = 0.5f;
        static float scaleMult = 1f;
        static float shootSpeedMult = 1f;
        static float manaMult = 1f;
        static int critBonus = 10;
        static float valueMult = 1.5f;
        public override PrefixCategory Category => PrefixCategory.AnyWeapon;
        public override void Apply(Item item)
        {
        }
        public override void ModifyValue(ref float valueMult)
        {
        }
        public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus)
        {
        }
        public override void SetDefaults()
        {
        }
    }
}
]
 
Last edited:
Never mind, I figured it out.

Now I need to know how to make an accessories modifiers modify weapon damage. Does anyone know how?
 
Last edited:
To make a prefix you need to create a class that has the same name your prefix will have and have it inherit from ModPrefix.
To assign it to a certain type of item you use
C#:
public override PrefixCategory Category => PrefixCategory.InsertTypeHere;
Where InsertTypeHere can be Melee, Ranged, Magic, AnyWeapon, Accesory, or Custom.

To assign it Stat changes use:
C#:
public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus)
        {
            damageMult = value;
            knockbackMult = value;
            useTimeMult = value;
            scaleMult = value;
            shootSpeedMult = value
            manaMult = value;
            critBonus = 0;
        }
Replace value with the value you would like the stat to be multiplied by (1f = default for everything but the critBonus; the smaller the useTimeMult and the shootSpeedMult, the the faster the weapon).
Only type in scaleMult if the prefixe is type is Melee, shootSpeedMult if its type is Ranged, and manaMult if its type is Magic, otherwise your prefix will not work.
The critBonus is an int and is added to the critical strike chance, not multiplied.

To edit the amount of defense the item gives use:
C#:
public override void Apply(Item item)
        {
            item.defense += value;
        }
Where value is equal the the amount of defense you want to add.
C#:
public override void Apply(Item item)
        {
            item.damage += value;
            item.knockBack += value;
            item.useTime += value;
            item.size += value;
            item.shootSpeed += value;
            item.mana += value;
            item.critChance *= value;
            item.damage = value;
            item.knockBack = value;
            item.useTime = value;
            item.size = value;
            item.shootSpeed = value;
            item.mana = value;
            item.critChance = value;
        }
And you can edit anything else the Item class contains, you could even do this:
C#:
public override void Apply(Item item)
        {
            item.Melee = true;
        }

When I tried to make my accessory modifier add damage, it didn't work, so don't use SetStats on an accessory.

Finally, to modify an items rarity and value, use:
C#:
public override void ModifyValue(ref float valueMult)
        {
            valueMult = valuef;
        }
Where value is the amount you want to multiply the items value by (1f = default).

That's everything that I know how to do so far.
 
Last edited:
To make a prefix you need to create a class that has the same name your prefix will have and have it inherit from ModPrefix.
To assign it to a certain type of item you use
C#:
public override PrefixCategory Category => PrefixCategory.InsertTypeHere;
Where InsertTypeHere can be Melee, Ranged, Magic, AnyWeapon, Accesory, or Custom.

To assign it Stat changes use:
C#:
public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus)
        {
            damageMult = value;
            knockbackMult = value;
            useTimeMult = value;
            scaleMult = value;
            shootSpeedMult = value
            manaMult = value;
            critBonus = 0;
        }
Replace value with the value you would like the stat to be multiplied by (1f = default for everything but the critBonus; the smaller the useTimeMult and the shootSpeedMult, the the faster the weapon).
Only type in scaleMult if the prefixe is type is Melee, shootSpeedMult if its type is Ranged, and manaMult if its type is Magic, otherwise your prefix will not work.
The critBonus is an int and is added to the critical strike chance, not multiplied.

To edit the amount of defense the item gives use:
C#:
public override void Apply(Item item)
        {
            item.defense += value;
        }
Where value is equal the the amount of defense you want to add.

When i tried to make my accessory modifier add damage, it didn't work, so don't use SetStats on an accessory.

Finally, to modify an items rarity and value, use:
C#:
public override void ModifyValue(ref float valueMult)
        {
            valueMult = valuef;
        }
Where value is the amount you want to multiply the items value by (1f = default).

That's everything that I know how to do so far.
Thanks
 
I'm making 4 different ammo items which shoot the rocket 1, rocket 2, rocket 3, and rocket 4 projectiles.

Within the "SetDefaults()" method of each i am using the ProjectileID's: 134 (rocket 1), 137 (Rocket 2), 140 (Rocket 3) and 143 (Rocket 4).

For some reason whenever i shoot these projectiles out of the rocket launcher using my ammo items, rather than shooting the rockets it shoots the eye spring pet (Rocket 1), the K.O. Cannon glove (Rocket 2), the Death Sickle projectile (Rocket 3) and the Plantera spikey seed projectile (Rocket 4).

within visual studio it has a warning for each of the ProjectileID's, telling me to change the numbers to text for readability. When it tells me what text to replace it with, it does in fact show the correct text which corresponds with the type of projectile im trying to shoot i.e. it tells me to replace the rocket 1 ProjectileID with "Rocket I" and so on.

Just to clarify, i got all of the ProjectileID numbers from the terraria wiki list of projectile IDs and not from the bottom of the summary that you get which tells you item stats and what not (mainly because it didnt have them).

to summarise, my ammo items are shooting the wrong projectiles even though i am convinced that i used the correct ProjectileID numbers.

Edit: I'm also having the same issue with the clentaminator ammo, one of them is the inferno fork projectile (i think) two of them are shadow beam staff projectiles, one is nothing (note: the gun still moves with my cursor so it is shooting something but is just invisible) and i dont know exactly what the last one is, it looks similar to the inferno fork projectile however.
 
Last edited:
I'm making 4 different ammo items which shoot the rocket 1, rocket 2, rocket 3, and rocket 4 projectiles.

Within the "SetDefaults()" method of each i am using the ProjectileID's: 134 (rocket 1), 137 (Rocket 2), 140 (Rocket 3) and 143 (Rocket 4).

For some reason whenever i shoot these projectiles out of the rocket launcher using my ammo items, rather than shooting the rockets it shoots the eye spring pet (Rocket 1), the K.O. Cannon glove (Rocket 2), the Death Sickle projectile (Rocket 3) and the Plantera spikey seed projectile (Rocket 4).

within visual studio it has a warning for each of the ProjectileID's, telling me to change the numbers to text for readability. When it tells me what text to replace it with, it does in fact show the correct text which corresponds with the type of projectile im trying to shoot i.e. it tells me to replace the rocket 1 ProjectileID with "Rocket I" and so on.

Just to clarify, i got all of the ProjectileID numbers from the terraria wiki list of projectile IDs and not from the bottom of the summary that you get which tells you item stats and what not (mainly because it didnt have them).

to summarise, my ammo items are shooting the wrong projectiles even though i am convinced that i used the correct ProjectileID numbers.

Edit: I'm also having the same issue with the clentaminator ammo, one of them is the inferno fork projectile (i think) two of them are shadow beam staff projectiles, one is nothing (note: the gun still moves with my cursor so it is shooting something but is just invisible) and i dont know exactly what the last one is, it looks similar to the inferno fork projectile however.
Code please?
 
Code please?
Rocket 1:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket1
{
    class EndlessRocket1Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket I Rack");
            Tooltip.SetDefault("Small blast radius. Will not destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 40;
            item.knockBack = 4f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 134;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketI, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 2:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket2
{
    class EndlessRocket2Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket II Rack");
            Tooltip.SetDefault("Small blast radius. Will destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 40;
            item.knockBack = 4f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 137;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketII, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 3:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket3
{
    class EndlessRocket3Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket III Rack");
            Tooltip.SetDefault("Large blast radius. Will not destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 65;
            item.knockBack = 6f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 140;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketIII, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 4:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket4
{
    class EndlessRocket4Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket IV Rack");
            Tooltip.SetDefault("Large blast radius. Will destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 65;
            item.knockBack = 6f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 143;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketIV, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Blue Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Blue
{
    class EndlessBlueSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Blue Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Hallow");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 146;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.BlueSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Dark Blue Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.DarkBlue
{
    class EndlessDarkBlueSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Dark Blue Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads Glowing Mushrooms ");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 148;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DarkBlueSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Green Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Green
{
    class EndlessGreenSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Green Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Purity");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 145;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.GreenSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Purple Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Purple
{
    class EndlessPurpleSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Purple Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Corruption");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 147;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.PurpleSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Red Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Red
{
    class EndlessRedSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Red Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Crimson");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 149;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RedSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
 
Rocket 1:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket1
{
    class EndlessRocket1Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket I Rack");
            Tooltip.SetDefault("Small blast radius. Will not destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 40;
            item.knockBack = 4f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 134;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketI, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 2:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket2
{
    class EndlessRocket2Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket II Rack");
            Tooltip.SetDefault("Small blast radius. Will destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 40;
            item.knockBack = 4f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 137;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketII, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 3:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket3
{
    class EndlessRocket3Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket III Rack");
            Tooltip.SetDefault("Large blast radius. Will not destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 65;
            item.knockBack = 6f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 140;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketIII, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Rocket 4:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Rockets.Rocket4
{
    class EndlessRocket4Rack : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Rocket IV Rack");
            Tooltip.SetDefault("Large blast radius. Will destroy tiles");
        }

        public override void SetDefaults()
        {
            item.damage = 65;
            item.knockBack = 6f;
            item.ranged = true;
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 1);
            item.rare = ItemRarityID.Green;
            item.shoot = 143;
            item.ammo = AmmoID.Rocket;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RocketIV, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Blue Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Blue
{
    class EndlessBlueSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Blue Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Hallow");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 146;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.BlueSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Dark Blue Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.DarkBlue
{
    class EndlessDarkBlueSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Dark Blue Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads Glowing Mushrooms ");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 148;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DarkBlueSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Green Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Green
{
    class EndlessGreenSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Green Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Purity");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 145;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.GreenSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Purple Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Purple
{
    class EndlessPurpleSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Purple Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Corruption");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 147;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.PurpleSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Red Solution:
C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace EndlessAmmo.Items.Ammo.Solution.Red
{
    class EndlessRedSolutionBottle : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Endless Red Solution Bottle");
            Tooltip.SetDefault("Used by the Clentaminator Spreads the Crimson");
        }

        public override void SetDefaults()
        {
            item.width = 32;
            item.height = 32;
            item.maxStack = 1;
            item.consumable = false;
            item.value = Item.sellPrice(gold: 4);
            item.rare = ItemRarityID.Pink;
            item.shoot = 149;
            item.ammo = AmmoID.Solution;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RedSolution, 3996);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
Hmmm...

---------------------------

134 Rocket I /\
135
136
137 Rocket II
138
139
140 Rocket III
141
142
143 Rocket IV

---------------------------

268 Eye Spring
269
270
271 Boxing Glove
272
273
274 Death Sickle
275
276
277 Thorn Ball

---------------------------

It seems like the game calculates all numbers + 134 for somewhat strange reason.

134 + 134 = 268
137 + 134 = 271
etc.

--------------------------------------------------------------------------------------------------------------------------------------

145 Pure Spray /\
146 Hallow Spray
147 Corrupt Spray
148 Mushroom Spray
149 Crimson Spray

---------------------------

290 Shadow Beam (hostile)
291 Inferno Bolt (hostile)
292 Inferno Blast (hostile)
293 Lost Soul (hostile)
294 Shadow Beam (friendly)

---------------------------

It seems like the game calculates all numbers + 145 for another somewhat strange reason.

145 + 145 = 290
etc.

I don't know what it means but these two projectiles are the culprit for their code:

134 Rocket I
145 Pure Spray

They are also marked with '/\'

Sorry, but I don't really know the solution to this problem, but if it is a system problem, try contacting the moderators or re-check your requirements for TModloader. You can also reach out to other people for some help.
 
this thing appears when i try to upload a mod help

[19:48:20] [1/INFO] [tML]: Your Mod Browser Credentials are invalid. Please fix the ModBrowserPassphrase property in My Games\Terraria\ModLoader\config.json by visiting Mod Browser - Manage your mods.

[19:48:30] [1/DEBUG] [tML]: Process.Start (UseShellExecute = True): "C:\Users\name\Documents\My Games\Terraria\ModLoader\Logs\client.log"

i changed the passphrase but still the same
 
im making a new helmet for palladium armor, but i dont know how to make the set bonus work.

EDIT: i should probably clarify, i know how to make set bonuses, but i need help making the palladium armors Greatly increases life regeneration after striking an enemy effect
 
im making a new helmet for palladium armor, but i dont know how to make the set bonus work.

EDIT: i should probably clarify, i know how to make set bonuses, but i need help making the palladium armors Greatly increases life regeneration after striking an enemy effect
Best thing I can think of is a buff:

C#:
        public override void UpdateArmorSet(Player player) {
            player.setBonus = "trollface.jpg";
            player.AddBuff(58, 2);
        }
The rapid healing buff has an ID of 58.
You're welcome!
 
Hello, how do i access mod folders?
I tried
using using xp.Projectiles;
and
using static Terraria.ModLoader.ModContent;
But it keeps giving me an error saying "The type or namespace "Projectiles" does not exist in the namespace xp" even though the folder is clearly there
please help
Can you give a picture about the evidence? Thanks.
 
Best thing I can think of is a buff:

C#:
        public override void UpdateArmorSet(Player player) {
            player.setBonus = "trollface.jpg";
            player.AddBuff(58, 2);
        }
The rapid healing buff has an ID of 58.
You're welcome!

"EDIT: i should probably clarify, i know how to make set bonuses, but i need help making the palladium armors Greatly increases life regeneration after striking an enemy effect"

so you aint know how to make the buff appears after hitting an enemy?
 
How would i go about checking whether a boss or event has been defeated in order to make something happen in an "if" statement?

For example, what should i type if i want to make an npc sell an item once the eater or worlds has been defeated.
 
"EDIT: i should probably clarify, i know how to make set bonuses, but i need help making the palladium armors Greatly increases life regeneration after striking an enemy effect"

so you aint know how to make the buff appears after hitting an enemy?
Oh no I did a mistake! Sorry.
I must've been really sleepy and ignored the facts.
There might be an easier way but for right now it's gonna be more complicated.
C#:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace Mod.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class ModArmor : ModItem // Change ModArmor to the name you want.
    {

        public bool ArmorOn; // You can change the name if you want.

        public override void SetDefaults() {
            item.width = Width; // replace with width
            item.height = Height; // replace with height
            item.value = Value; // replace with value
            item.rare = Rarity; // replace with rarity
            item.defense = Defense; // replace with defense
        }

        public override void UpdateArmorSet(Player player) {
            ArmorOn = true;
        }
    }
}
Here is the second piece of code.
C#:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using Terraria.ModLoader.IO;
using Terraria.Utilities;
using Mod.Items.Armor;

namespace Mod.Items
{
    public class Item : GlobalItem
    {
        public virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
        {
            if (ModArmor.ArmorOn == true) {
                player.AddBuff(58, 2);
            }
        }
    }
}

I hope what I'm doing is correct. If it's not, then sorry.
 
Oh no I did a mistake! Sorry.
I must've been really sleepy and ignored the facts.
There might be an easier way but for right now it's gonna be more complicated.
C#:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace Mod.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class ModArmor : ModItem // Change ModArmor to the name you want.
    {

        public bool ArmorOn; // You can change the name if you want.

        public override void SetDefaults() {
            item.width = Width; // replace with width
            item.height = Height; // replace with height
            item.value = Value; // replace with value
            item.rare = Rarity; // replace with rarity
            item.defense = Defense; // replace with defense
        }

        public override void UpdateArmorSet(Player player) {
            ArmorOn = true;
        }
    }
}
Here is the second piece of code.
C#:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using Terraria.ModLoader.IO;
using Terraria.Utilities;
using Mod.Items.Armor;

namespace Mod.Items
{
    public class Item : GlobalItem
    {
        public virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
        {
            if (ModArmor.ArmorOn == true) {
                player.AddBuff(58, 2);
            }
        }
    }
}

I hope what I'm doing is correct. If it's not, then sorry.
it appened to me too lmao, i only saw the first part
 
How would i go about checking whether a boss or event has been defeated in order to make something happen in an "if" statement?

For example, what should i type if i want to make an npc sell an item once the eater or worlds has been defeated.
For NPC selling, do this:
C#:
        public override void SetupShop(Chest shop, ref int nextSlot) {
            if (downedBoss2 == true)
            {
                shop.item[nextSlot].SetDefaults(ItemID);
                nextSlot++;
            }
        }
Replace ItemID with and Item by it's ID.
For normal and unprepared if statements, do this:
C#:
     if (downedBoss2 == true)
     {
     }
 
For NPC selling, do this:
C#:
        public override void SetupShop(Chest shop, ref int nextSlot) {
            if (downedBoss2 == true)
            {
                shop.item[nextSlot].SetDefaults(ItemID);
                nextSlot++;
            }
        }
Replace ItemID with and Item by it's ID.
For normal and unprepared if statements, do this:
C#:
     if (downedBoss2 == true)
     {
     }
bro how i can make a item spawn like a soul like it stays in the air?
 
For NPC selling, do this:
C#:
        public override void SetupShop(Chest shop, ref int nextSlot) {
            if (downedBoss2 == true)
            {
                shop.item[nextSlot].SetDefaults(ItemID);
                nextSlot++;
            }
        }
Replace ItemID with and Item by it's ID.
For normal and unprepared if statements, do this:
C#:
     if (downedBoss2 == true)
     {
     }
nvm find out how to make it / just putting ItemID.Sets.ItemNoGravity[item.type] = true; in my SetDefaults if anyone asks
 
Back
Top Bottom