Standalone [1.3] tModLoader - A Modding API

Guys someone can help!Becouse i missing a file in .../common/Terraria/Content/Images/UI/Sort_0.xnb and im sure that i missing multiple files.
 
Guys someone can help!Becouse i missing a file in .../common/Terraria/Content/Images/UI/Sort_0.xnb and im sure that i missing multiple files.
I dont know if its allowed to Upload Terraria Files in the Forum C:
[doublepost=1465237919,1465237832][/doublepost]
I dont know if its allowed to Upload Terraria Files in the Forum C:
Go to Steam - Rigthclick on Terraria - Properties - Lokal Data - Search for Errors
Then Steam should Redownload these Files (Possible that Tmodloader gets Deleted,just Reinstall it then)
 
Yeah i think so...(I don't know either)
[doublepost=1465238187,1465237973][/doublepost]No success D:
[doublepost=1465238477][/doublepost]The thing is that tmodloader is missing a file (files) not terraria.
 
I've been told how to fix modded multiplayer bosses, that being I should use a projectile to synchronize my request with the server. I'm not too sure how to do that though. I gave this a shot, but this didn't have any effect in multiplayer, though it did work in single player. I assume because NPC.SpawnOnPlayer itself has problems with server sync... Anyway, if I could get a quick hand, that would be amazing!

Code:
public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
          
            if (projectile.ai[1] >= 0)
            {
                NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BossV1"));
                Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);

                projectile.ai[1] = -30;
            }
        }

On an unrelated note, how difficult would it be to have an enemy run on lava?
 
Last edited:
I need help! Im trying to set up a modded server but I have no idea what i'm doing! What do I do?
You should be able to run tModLoader servers the same way you run vanilla servers.

Hey anyone have the bug for npc's dissapearing on tmod servers?/ know how to fix it?
Update to the most recent tModLoader.

I've been told how to fix modded multiplayer bosses, that being I should use a projectile to synchronize my request with the server. I'm not too sure how to do that though. I gave this a shot, but this didn't have any effect in multiplayer, though it did work in single player. I assume because NPC.SpawnOnPlayer itself has problems with server sync... Anyway, if I could get a quick hand, that would be amazing!

Code:
public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
         
            if (projectile.ai[1] >= 0)
            {
                NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BossV1"));
                Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);

                projectile.ai[1] = -30;
            }
        }

On an unrelated note, how difficult would it be to have an enemy run on lava?
Hm, that's odd. Can I see the full projectile code?
I imagine it would be somewhat difficult to make an enemy run on lava, mostly because you'd have to program in the collision with lava yourself and also understand what's going on in the vanilla running AIs.
 
Hello someone can help with the tmodloader becouse i missing the files in the Content/Images folder can anyone send this files some how? I tried Every single thing i can do.
 
Here's the full projectile.cs, names and all.
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThoriumMod.Projectiles.Spawn
{
    public class JellyFishSpawn : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Jellyfish Spawn";
            projectile.width = 6;
            projectile.height = 6;
            projectile.aiStyle = 1;
            projectile.hostile = true;
            projectile.scale = 1f;
            projectile.penetrate = 1;
            projectile.light = 0.5f;
            projectile.timeLeft = 20;
            projectile.tileCollide = false;
            aiType = ProjectileID.Bullet;
        }
       
        public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
           
            if (projectile.ai[1] >= 0)
            {
                if(!NPC.AnyNPCs(mod.NPCType("Diverman")))
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJelly"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);

                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJellyDiverless"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
               
                }
                projectile.ai[1] = -30;
            }
        }
    }
}

I figured enemy lava walking wouldn't be easy, but using npc.lavaWet to decrease its Y Velocity gave me a suitable effect. Kinda like the lava slimes...
 
Hello someone can help with the tmodloader becouse i missing the files in the Content/Images folder can anyone send this files some how? I tried Every single thing i can do.

No, no one can send you Terraria content files, that is piracy and against the rules. If you have the Steam version, then you can use Steam to check your installation for missing files and it will reinstall them. If you have the GOG version, then you can simply reinstall the game and it will replace the missing files. There is no reason that anyone who owns a legitimate copy of the game should need another user to send them content files.
 
Here's the full projectile.cs, names and all.
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThoriumMod.Projectiles.Spawn
{
    public class JellyFishSpawn : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Jellyfish Spawn";
            projectile.width = 6;
            projectile.height = 6;
            projectile.aiStyle = 1;
            projectile.hostile = true;
            projectile.scale = 1f;
            projectile.penetrate = 1;
            projectile.light = 0.5f;
            projectile.timeLeft = 20;
            projectile.tileCollide = false;
            aiType = ProjectileID.Bullet;
        }
      
        public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
          
            if (projectile.ai[1] >= 0)
            {
                if(!NPC.AnyNPCs(mod.NPCType("Diverman")))
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJelly"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);

                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJellyDiverless"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
              
                }
                projectile.ai[1] = -30;
            }
        }
    }
}

I figured enemy lava walking wouldn't be easy, but using npc.lavaWet to decrease its Y Velocity gave me a suitable effect. Kinda like the lava slimes...
Hm, for projectiles spawning the NPC I was mostly talking about the Thunder Bird (since it looks like you need to fire the projectile anyways in order to summon it). This is still a weird problem though. Can you add some Main.NewText statements to tell whether certain pieces of code are being called? The server version of Main.NewText is:
Code:
if (Main.netMode == 2)
{
    NetMessage.SendData(25, -1, -1, "message", 255, 255, 255, 255);
}
 
Nope, with this code, no message occurs. Hopefully I just dun' goofed somewhere?
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThoriumMod.Projectiles.Spawn
{
    public class JellyFishSpawn : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Jellyfish Spawn";
            projectile.width = 6;
            projectile.height = 6;
            projectile.aiStyle = 1;
            projectile.hostile = true;
            projectile.scale = 1f;
            projectile.penetrate = 1;
            projectile.light = 0.5f;
            projectile.timeLeft = 20;
            projectile.tileCollide = false;
            aiType = ProjectileID.Bullet;
        }
     
        public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
         
            if (projectile.ai[1] >= 0)
            {
                if(!NPC.AnyNPCs(mod.NPCType("Diverman")))
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJelly"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
                 
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "Yo", 255, 255, 255, 255);
                    }
                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJellyDiverless"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
                 
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "Yo", 255, 255, 255, 255);
                    }
                }
                projectile.ai[1] = -30;
            }
        }
    }
}
 
Nope, with this code, no message occurs. Hopefully I just dun' goofed somewhere?
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThoriumMod.Projectiles.Spawn
{
    public class JellyFishSpawn : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Jellyfish Spawn";
            projectile.width = 6;
            projectile.height = 6;
            projectile.aiStyle = 1;
            projectile.hostile = true;
            projectile.scale = 1f;
            projectile.penetrate = 1;
            projectile.light = 0.5f;
            projectile.timeLeft = 20;
            projectile.tileCollide = false;
            aiType = ProjectileID.Bullet;
        }
    
        public override void AI()
        {
            Player player = Main.player[projectile.owner];
            projectile.ai[1]++;
        
            if (projectile.ai[1] >= 0)
            {
                if(!NPC.AnyNPCs(mod.NPCType("Diverman")))
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJelly"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
                
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "Yo", 255, 255, 255, 255);
                    }
                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("QueenJellyDiverless"));
                    Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
                
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(25, -1, -1, "Yo", 255, 255, 255, 255);
                    }
                }
                projectile.ai[1] = -30;
            }
        }
    }
}
Hm, does any message appear when you move it directly into the "if (projectile.ai[1] >= 0)" block? Also if you just put it at the beginning of the AI?
 
Hm, does any message appear when you move it directly into the "if (projectile.ai[1] >= 0)" block? Also if you just put it at the beginning of the AI?
Nope, both have no effect. Looks like my proj ai isn't reaching the server, right? Could aiType = ProjectileID.Bullet possibly be ignoring my attempts because it wouldn't normally do that? I doubt its that, but I don't know for sure.
 
Nope, both have no effect. Looks like my proj ai isn't reaching the server, right? Could aiType = ProjectileID.Bullet possibly be ignoring my attempts because it wouldn't normally do that? I doubt its that, but I don't know for sure.
Hm, the aiType shouldn't mess with the AI hook. And it does work on singleplayer, right?
Wait a minute, is the projectile hostile? Hostile projectiles can't be sent from the client to the server, so probably the projectile just doesn't exist on the server.
 
Hm, the aiType shouldn't mess with the AI hook. And it does work on singleplayer, right?
Wait a minute, is the projectile hostile? Hostile projectiles can't be sent from the client to the server, so probably the projectile just doesn't exist on the server.
Aaaaaay, it works! Thanks as always Blue, I'm sure most of us would be lost without you. :p
 
How do I make a Homing projectile?

how do I make a boomerang like the paladin's hammer?
mine returns too slow, doesn't go through enemies, and goes really far off screen

How do I make a weapon heal the player?

and

How do I make an Item drop only from enemies in the Jungle Temple.

I have

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

namespace Pack.NPCs
{
   public class ModGlobalNPC : GlobalNPC
   {
      public override void NPCLoot(NPC npc)
      {
         if (Main.rand.Next(4) == 0 && zoneTemple)
         {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TempliteIngot"), 3);
         }
      }
   }
}

in ModGlobalNPC

and the zoneTemple part says there is no such thing
What do i put there instead or if this is all wrong, what do I say instead
 
Hello someone can help with the tmodloader becouse i missing the files in the Content/Images folder can anyone send this files some how? I tried Every single thing i can do.
Maybe the problem is you haven't updated vanilla Terraria to 1.3.1.(since that is what updates the image files you are missing) Steam usually does it automatically, but maybe you are in offline mode or something.
 
Well.. i found out it's done via item.backSlot and item.frontSlot in vanilla.. but it's sbyte.. so i can't really give it what i want.

EDIT: Also, my accesory uses both front and back textures (draws both).

What value would you give a standard cape in item.backslot? I see that there's several values according to different items
Magic Quiver = 7
Star Cloak = 2
Bee Cloak = 1
 
Back
Top Bottom