Standalone [1.3] tModLoader - A Modding API

I´m not really complaining, but does any 1 else have issues with v 0.8.2 getting detected as malware from windows defender?
 
I've been having the same issue. It also keeps deleting the modded Terraria.exe.
 
I've been having the same issue. It also keeps deleting the modded Terraria.exe.

open up windows defender right when it pops up, there you can allow the process to keep doing what it should instead of deleting, that´s what i did
 
I've been having the same issue. It also keeps deleting the modded Terraria.exe.
Same problem here. I deactivated the real time protection. -_-
 
Can't download it anymore for some reason and it deleted Terraria.exe saying it was a Trojan Thx Windows 10 -_-
 
it says its a virus ;-;
 
Does anybody else also get this error message when trying to run the example mod?
Missing mod: ExampleMod/Dusts/Bubble
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.AddDust(String name, ModDust dust, String texture)
at Terraria.ModLoader.Mod.AutoloadDust(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
Does anyone know if the tModLoader server has a config file? I'd like to change how much ram it uses cause my friend has been experiencing some lag issues because of all the mods. Thanks.
 
Why is it a Trojan?
 
Does anybody else also get this error message when trying to run the example mod?
Missing mod: ExampleMod/Dusts/Bubble
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.AddDust(String name, ModDust dust, String texture)
at Terraria.ModLoader.Mod.AutoloadDust(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Did you check that file (Bubble)? Did you edit anithing?
 
c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\CopperDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\CopperDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\CopperDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\GoldDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\GoldDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\GoldDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\IronDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\IronDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\IronDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\LeadDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\LeadDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\LeadDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\SilverDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\SilverDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\SilverDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TinDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TinDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TinDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TungstenDrill123.cs(34,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TungstenDrill123.cs(35,34) : error CS0103: The name 'ItemID' does not exist in the current context

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\TungstenDrill123.cs(36,28) : error CS0103: The name 'TileID' does not exist in the current context


The code:
using Terraria;
using Terraria.ModLoader;

namespace CakeMod.Items
{
public class CopperDrill123 : ModItem
{
public override void SetDefaults()
{
item.name = "Copper Drill";
item.damage = 4;
item.melee = true;
item.width = 20;
item.height = 12;
item.toolTip = "";
item.useTime = 15;
item.useAnimation = 23;
item.channel = true;
item.noUseGraphic = true;
item.noMelee = true;
item.pick = 35;
item.useStyle = 5;
item.knockBack = 2;
item.value = Item.buyPrice(0, 1, 20, 0);
item.rare = 5;
item.useSound = 23;
item.autoReuse = true;
item.shoot = mod.ProjectileType("CopperDrill123");
item.shootSpeed = 40f;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.CopperBar, 12);
recipe.AddIngredient(ItemID.Wood, 4);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}


Even though there were several files in the error message, all of them are almost the same.
 
You forgot to add "using Terraria.ID"
 
hlp me plz
c:\Users\William\Documents\My Games\Terraria\ModLoader\Mod Sources\TheElectronMod\Projectiles\ElectronFlailProjectile.cs(24,96) : error CS0246: The type or namespace name 'Color' could not be found (are you missing a using directive or an assembly reference?)
 
hlp me plz
c:\Users\William\Documents\My Games\Terraria\ModLoader\Mod Sources\TheElectronMod\Projectiles\ElectronFlailProjectile.cs(24,96) : error CS0246: The type or namespace name 'Color' could not be found (are you missing a using directive or an assembly reference?)

Have you added the using directive "using Microsoft.Xna.Framework"?
 
are you kiddin me
i have using Microsoft.Xna.Framework.Graphics
but forget using Microsoft.Xna.Framework :sigh:
 
less of a problem now :)

all it does now is go out a small distance and the stops and then homes when there is something to home on.
but it still is stopping when there is nothing to home on.

Code:
public NPC FindNearest(Vector2 pos)
        {
        
            NPC nearest = null;
            float oldDist = 1001;
            float newDist = 1000;
            for (int i = 0; i < Terraria.Main.npc.Length - 1; i++)
            {
                if (!Collision.CanHit(pos, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height))
                    continue;
                if (!Terraria.Main.npc[i].CanBeChasedBy(projectile))
                    continue;
                if (nearest == null)
                    nearest = Terraria.Main.npc[i];
                else
                {
                    oldDist = Vector2.Distance(pos, nearest.position);
                    newDist = Vector2.Distance(pos, Terraria.Main.npc[i].position);
                    if (newDist < oldDist)
                        nearest = Terraria.Main.npc[i];
                }
            }
            return nearest;
        }
        int maxSpeed = 10;
        public override void AI()
        {
            NPC nearest = this.FindNearest(projectile.Center);
            Vector2 acceleration;
            if (nearest != null) // extremely important
            {
                acceleration = (nearest.position - projectile.position);
            } else
            {
                acceleration = Vector2.Zero; // maintain speed -- or whatever else you want to do here
            }
            projectile.velocity += acceleration * 1.5f;
            projectile.velocity *= 0.95f;
            if (projectile.velocity.Length() > maxSpeed)
            {
                projectile.velocity.Normalize();
                projectile.velocity *= maxSpeed;
            }
            projectile.rotation = projectile.velocity.ToRotation();
        }

also, since this homing is almost complete, how might I make an arkhalis type weapon. I have tried, but the projectile for the blade doesn't even show up!

Weapon Code defaults:
Code:
 public override void SetDefaults()
        {
            item.name = "Solarius";
            item.damage = 75;
            item.melee = true;
            item.width = 48;
            item.height = 48;
            item.useTime = 1;
            item.useAnimation = 1;
            item.useStyle = 1;
            item.noMelee = true;
            item.knockBack = 2;
            item.noUseGraphic = true;
            item.channel = true;
            item.value = 100000;
            item.rare = 9;
            item.useSound = 1;
            item.autoReuse = true;
            item.shoot = mod.ProjectileType("SolarisP");
            item.shootSpeed = 20;
        }

Projectile Code defaults:
Code:
public class SolarisP : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Solarius";
            projectile.width = 36;
            projectile.height = 20;
            projectile.friendly = true;
            projectile.penetrate = -1;
            projectile.aiStyle = 20;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.light = 2f;
        }
the class is shown so you know why the weapon is refering to that name for the projectile.
pls help me
I am so lost :(
To fix the slow-to-a-stop problem, move the line 'projectile.velocity *= 0.95f;' inside the 'if (nearest != null)' condition, or get rid of it entirely if you don't want any drag. That's all that line did.

As for the arkhalis type weapon, the vanilla projectile has the type of 595 and uses the ai style of 75, so you'll need to set projectile.type and .aiStyle to those two numbers. Also, it would be a good idea for you to try decompiling tModLoader's source so that you can have a look at vanilla code for yourself. ILSpy and DotPeek are two good decompilers.
 
I'd like to say that after my pc updated, windows defender identifies the Terraria.exe file from this is a trojan, I'm aware this is not the case but you may want to look into checking nothing has been infected and for users of this to got to the antivirus view details of quarantined items and allow it (you can check its the terraria file by reading details of the trojan)
 
Last edited:
I have a problem with this code:
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ZeldaMod.Items.Weapons
{
    public class HerosBow : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Hero's Bow";
            item.damage = 20;
            item.ranged = true;
            item.noMelee = true;
            item.width = 14;
            item.height = 42;
            item.toolTip = "The tresaure of Gorons.";
            item.useTime = 27;
            item.useAnimation = 27;
            item.useStyle = 5;
            item.knockBack = 2;
            item.value = 10000;
            item.rare = 2;
            item.shoot = mod.ProjectileType("LightArrow");
            item.useAmmo = 1;
            item.useSound = 1;
            item.shootSpeed = 9;
            item.autoReuse = true;
        }
      
        public override bool AltFunctionUse(Player player) //Enable right click
        {
            return true;
        }
        public override bool UseItem(Player player)
        {
            return base.UseItem(player);
        }

        public override bool CanUseItem(Player player)
        {
            return true;
        }

        public override bool ConsumeAmmo(Player player) //So that when right clicking it change the projectile but doesn't shoot anything
        {
            if (player.altFunctionUse == 2)
                return false;
            else
                return true;
        }

        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            ZMPlayer mp = player.GetModPlayer<ZMPlayer>(mod);
            if (player.altFunctionUse == 2) // if right click sswitch projectile that will be shooted
            {
                if (mp.switchArrow == 3) //Variable in ZMPlayer (ModPlayer)
                    mp.switchArrow = 0;
                else
                    mp.switchArrow++;
                return false;
            }

            if (mp.switchArrow == 0) // If there is no special projectile type, we just want to shoot the bow.
                return true;

            // If there is, however, we want to set the projectile type we want to shoot to the specialProjetileType of the player.

            if (mp.switchArrow == 3)
            {
                if (player.statMana >= 50)
                {
                    player.statMana -= 50;
                    type = mod.ProjectileType("LightArrow");
                    damage = 150;
                }
                else
                {
                    type = ProjectileID.WoodenArrowFriendly;
                    damage = 20;
                }
            }
            else if (mp.switchArrow == 1)
            {
                if (player.statMana >= 25)
                {
                    player.statMana -= 25;
                    type = ProjectileID.FireArrow;
                    damage = 50;
                }
                else
                {
                    type = ProjectileID.WoodenArrowFriendly;
                    damage = 20;
                }
            }
            else if (mp.switchArrow == 2)
                if (player.statMana >= 25)
                {
                    player.statMana -= 25;
                    type = ProjectileID.FrostburnArrow;
                    damage = 40;
                }
                else
                {
                    type = ProjectileID.WoodenArrowFriendly;
                }
          
            return true;
        }

      
    }
}
The right click function works, but only after the world is "updated". For example after loading the world it doesn't work but then I place a block and it starts to work.
 
To fix the slow-to-a-stop problem, move the line 'projectile.velocity *= 0.95f;' inside the 'if (nearest != null)' condition, or get rid of it entirely if you don't want any drag. That's all that line did.

As for the arkhalis type weapon, the vanilla projectile has the type of 595 and uses the ai style of 75, so you'll need to set projectile.type and .aiStyle to those two numbers. Also, it would be a good idea for you to try decompiling tModLoader's source so that you can have a look at vanilla code for yourself. ILSpy and DotPeek are two good decompilers.

Firstly, and most importantly, I Thank You LOADS for the help with the homing projectile doing the entirety of the homing projectile for me. It FINALLY works in a satisfactory manor :)

secondly,
ARKHALIS
I've set the type and ai to 595 and 75 respectively, but it still won't appear :( is there something in my code making it invisible, or is there something I still need to do to make it appear properly

also, I'd rather not look into the vanilla code unless it's really REALLY necessary. aka nobody anywhere on this forum knows how to do such and such thing and there are no tutorials, which would be a tragedy indeed.

also, sorry if I annoy you with my constant questions. That would not happen to be one of my goals when asking them

also, are there any tutorials on basic custom boss ai stuff that you know of? I'd like to check out things of that sort before I ask on here

also, I say 'also' too much
 
Hi I'm new here and i just tried to download the tmod loader only my virusscan began to shout that there was a virus in the zip file i clicked it away but i really want this mod so did i do something wrong or is the virusscanner oversensitive? i hope you can help me?
you have a few errors
your virusscan is a bad one, i got mine virus free, as there is no virus, its just the .jar that the computer doesnt like, get something different, ok?
there is no virus in there, ok? just turn off or get a different anti-virus, then download again, make sure its an actuall popular one that isnt in the corners of the web.

I had the tmodloader downloaded a few days ago and my computer didn't scan any virus , but when I started up Terraria today, my computer scanned there is Trojan virus in the Terraria.exe.bak file. Also my virusscan is Windows Defender so I think it shouldn't be wrong. Pls help.[/QUOTE]
 
Back
Top Bottom