Standalone [1.3] tModLoader - A Modding API

i cant load my self-made mod because of an error:

An unexpected error has occurred.
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

can someone help me?
Are you on steam or cracked
 
I can't even start the game, I did put my terraria inside the vanilla file and used the patcher to generate the modded version.
But after I put the modded version inside the terraria folder, I can't run it. When I run it, it said there is something wrong with the terraria.
I need help QAAQ
 
Umm, I can't publish anything from my mod, the publish button is missing

You have probably forgot a paste file of the examplemod, no? :x


I can't even start the game, I did put my terraria inside the vanilla file and used the patcher to generate the modded version.
But after I put the modded version inside the terraria folder, I can't run it. When I run it, it said there is something wrong with the terraria.
I need help QAAQ
Reinstall Terraria, then you have just to put all modded file of the compressed modloader file in your folder Terraria, then you launch.

guys please does anyone know WHY my boss dissappears when u hit him with anything except the Nebula Blaze??
Try with removing code one per one. This method is very good for found bug. Yes, you need test after each time, but this is the only means for fix a "invisible" bug. And use a vanilla aistyle is for me a bad idea for a boss npc, i prefer rewrite(and paste) code ^^.
 
You have also the examplemod where you have two boss for example. Use that also.

Your problem is not in your code(i think), this is setdefault where you have probably put a bad value, i suppose
 
ah, yes, i have not see, knockBackResist is a false word, more less you put, more he resist. Ah ah ^^. (and 0 is a immunity, 20 is huge knockback)
 
ooooohhhh.... so basically he disappeared becus he got 100 times the knockback... WELL
[doublepost=1468146708,1468146296][/doublepost]and i have another question:

how do i make my crossbow shoot FASTER??
if i change the usetime it will shoot 2 or more arrows after each other and also consume them, pls halp

heres the code:
Code:
using Terraria;
using System;
using Terraria.ID;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

namespace SacredTools.Items.Weapons
{
    public class PandolarRepeater : ModItem
    {

        public override void SetDefaults()
        {
            item.name = "Pandolar Repeater";
            item.damage = 55;
            item.noMelee = true;
            item.ranged = true;
            item.width = 69;
            item.height = 40;
            item.toolTip = "death to the enemies!";
            item.toolTip2 = "Pandolar FTW!";
            item.useTime = 18;
            item.useAnimation = 30;
            item.useStyle = 5;
            item.shoot = 3;
            item.useAmmo = 1;
            item.knockBack = 1;
            item.value = Item.sellPrice(0, 30, 0, 0);
            item.rare = 5;
            item.useSound = 5;
            item.autoReuse = true;
            item.shootSpeed = 20f;

        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f); //This is spawning a projectile of type FrostburnArrow using the original stats
            return false; //Makes sure to not fire the original projectile
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.SnowBlock, 100);
            recipe.AddIngredient(null, "OblivionBar", 20);
            recipe.AddIngredient(null, "PandolarBow", 1);
            recipe.AddTile(TileID.MythrilAnvil);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
[doublepost=1468146827][/doublepost]and how do i spawn more dust on an debuffed NPC/Player and make em not move away from the entity (for some reason my dust moves away from the debuffed enemy)
 
ooooohhhh.... so basically he disappeared becus he got 100 times the knockback... WELL
[doublepost=1468146708,1468146296][/doublepost]and i have another question:

how do i make my crossbow shoot FASTER??
if i change the usetime it will shoot 2 or more arrows after each other and also consume them, pls halp

heres the code:
Code:
using Terraria;
using System;
using Terraria.ID;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

namespace SacredTools.Items.Weapons
{
    public class PandolarRepeater : ModItem
    {

        public override void SetDefaults()
        {
            item.name = "Pandolar Repeater";
            item.damage = 55;
            item.noMelee = true;
            item.ranged = true;
            item.width = 69;
            item.height = 40;
            item.toolTip = "death to the enemies!";
            item.toolTip2 = "Pandolar FTW!";
            item.useTime = 18;
            item.useAnimation = 30;
            item.useStyle = 5;
            item.shoot = 3;
            item.useAmmo = 1;
            item.knockBack = 1;
            item.value = Item.sellPrice(0, 30, 0, 0);
            item.rare = 5;
            item.useSound = 5;
            item.autoReuse = true;
            item.shootSpeed = 20f;

        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f); //This is spawning a projectile of type FrostburnArrow using the original stats
            return false; //Makes sure to not fire the original projectile
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.SnowBlock, 100);
            recipe.AddIngredient(null, "OblivionBar", 20);
            recipe.AddIngredient(null, "PandolarBow", 1);
            recipe.AddTile(TileID.MythrilAnvil);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
[doublepost=1468146827][/doublepost]and how do i spawn more dust on an debuffed NPC/Player and make em not move away from the entity (for some reason my dust moves away from the debuffed enemy)


UseTime: shoot projectile each time than he go this value and the max counts is useanimation, so, you need put less in useanimation also.

For your problem of dust, create a special dust and say: No, do not move! This is a stupid question, i think, you need just put velocity zero
 
where is the part i need to change??

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace SacredTools.Dusts
{
    public class PandolarDust : ModDust
    {
        public override void OnSpawn(Dust dust)
        {
            dust.color = new Color(103, 208, 208); 
            dust.alpha = 1;
            dust.scale = 1.13f;
            dust.velocity *= 1.4f;
            dust.noGravity = true;
            dust.noLight = false;
        }

        public override bool Update(Dust dust)
        {
            dust.position += dust.velocity;
            dust.rotation += dust.velocity.X * 0.15f;
            dust.scale *= 0.99f;                   
            float light = 0.35f * dust.scale;
            Lighting.AddLight(dust.position, light, light, light);
            if (dust.scale < 0.5f)
            {
                dust.active = false;
            }
            return false;
        }
    }
}
 
halp something went wrong, i tried to add minions to my boss, it didnt work so i removed them again, then i wanted to make the dust have no velocity, AND NOW I CANT PLAY! IT ALWAYS SAYS FAILED TO LOAD NO BACKUP FOUND ;-;

i hope i didnt loose my world....
 
halp something went wrong, i tried to add minions to my boss, it didnt work so i removed them again, then i wanted to make the dust have no velocity, AND NOW I CANT PLAY! IT ALWAYS SAYS FAILED TO LOAD NO BACKUP FOUND ;-;

i hope i didnt loose my world....
If lag, you have maybe add too many dust. After, maybe than put a dust to zero (Maybe put just dust.velocity = Vector2.Zero) can have problem. (but this is not that, because, no reason ^^)
For add minion, the minion, a npc have be coded per you or this is a vanilla npc?
 
Last edited:
I think I ´ve found a MP bug:

In singleplayer I can place/remove modded tiles but in multiplayer I can´t.

I have noticed that if try to place a modded tile in multiplayer, it seems to be placed but if I exit the game, it is not saved.


This is the code:

Code:
   public override void SetDefaults()
        {
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.StyleWrapLimit = 36;
            TileObjectData.newTile.Direction = Terraria.Enums.TileObjectDirection.PlaceRight;
            TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight;
            animationFrameHeight = 54;
            TileObjectData.newAlternate.CopyFrom(TileObjectData.Style3x3);
            TileObjectData.newAlternate.StyleHorizontal = true;
            TileObjectData.addAlternate(1);
            Main.tileContainer[Type] = true;

            TileObjectData.addTile(Type);
         
     

            dustType = 7;
            disableSmartCursor = true;
            AddMapEntry(new Color(120, 85, 60), "Turret");
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
              
        
                Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("MyItem"));
          
        }
 
nvm i fixed it, but pls tell me where do i put the thing to make the dust not move

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace SacredTools.Dusts
{
    public class ShadowDust : ModDust
    {
        public override void OnSpawn(Dust dust)
        {
            dust.color = new Color(103, 24, 122); 
            dust.alpha = 1;
            dust.scale = 1.13f;
            dust.velocity *= 1.4f;
            dust.noGravity = true;
            dust.noLight = false;
        }

        public override bool Update(Dust dust)
        {
            dust.position += dust.velocity;
            dust.rotation += dust.velocity.X * 0.15f;
            dust.scale *= 0.99f;                   
            float light = 0.35f * dust.scale;
            Lighting.AddLight(dust.position, light, light, light);
            if (dust.scale < 0.5f)
            {
                dust.active = false;
            }
            return false;
        }
    }
}
[doublepost=1468178197,1468178143][/doublepost]when i changed the velocity to 0.1, 0 the thing with the Backup happened
 
Back
Top Bottom