Standalone [1.3] tModLoader - A Modding API

I have a rather bizzare little issue if anyone thinks they know a solution... One of my items projectiles uses the ai to trigger the spawning of multiple bubbles. Now these bubbles have the ai of the Flairon Bubbles, which means they have different sizes when they come into existence and home in on enemies. But for some strange reason, occasionally the spawned bubble will do... this?
j08AOux.jpg
I have no idea why this happens when the bubbles usually only vary in size slightly... Here's my code regardless. Is there a way to prevent them from spawning so big or perhaps a way to kill the projectile instantly when it gets all weird like that?

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

namespace ThoriumMod.Projectiles
{
    public class SevenSeasBall : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Seven Seas Ball";
            projectile.width = 26;
            projectile.height = 26;
            projectile.scale = 1;
            projectile.friendly = true;
            projectile.penetrate = -1;
            projectile.melee = true;
            projectile.aiStyle = 13;
            aiType = ProjectileID.GolemFist;
        }
   
        public override void AI()
        {
            projectile.ai[1]++;
       
            if (projectile.ai[1] >= 0)
            {
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next((int)-6f, (int)6f), Main.rand.Next((int)-6f, (int)6f), mod.ProjectileType("Bubble"), 190, 2, projectile.owner, 0f, 0f);
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next((int)-6f, (int)6f), Main.rand.Next((int)-6f, (int)6f), mod.ProjectileType("Bubble"), 190, 2, projectile.owner, 0f, 0f);
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next((int)-6f, (int)6f), Main.rand.Next((int)-6f, (int)6f), mod.ProjectileType("Bubble"), 190, 2, projectile.owner, 0f, 0f);
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next((int)-6f, (int)6f), Main.rand.Next((int)-6f, (int)6f), mod.ProjectileType("Bubble"), 190, 2, projectile.owner, 0f, 0f);
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next((int)-6f, (int)6f), Main.rand.Next((int)-6f, (int)6f), mod.ProjectileType("Bubble"), 190, 2, projectile.owner, 0f, 0f);
           
                projectile.ai[1] = -40;
            }
        }
   
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109);
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AquaBoomDamage"), 200, 5, projectile.owner, 0f, 0f);
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AquaBoom"), 0, 5, projectile.owner, 0f, 0f);
        }

        public override void PostDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture = ModLoader.GetTexture("ThoriumMod/Projectiles/SevenSeasChain");

            Vector2 position = projectile.Center;
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;
            Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
            Vector2 origin = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
            float num1 = (float)texture.Height;
            Vector2 vector2_4 = mountedCenter - position;
            float rotation = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
            bool flag = true;
            if (float.IsNaN(position.X) && float.IsNaN(position.Y))
                flag = false;
            if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
                flag = false;
            while (flag)
            {
                if ((double)vector2_4.Length() < (double)num1 + 1.0)
                {
                    flag = false;
                }
                else
                {
                    Vector2 vector2_1 = vector2_4;
                    vector2_1.Normalize();
                    position += vector2_1 * num1;
                    vector2_4 = mountedCenter - position;
                    Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
                    color2 = projectile.GetAlpha(color2);
                    Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f);
                }
            }
        }
    }
}

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

namespace ThoriumMod.Projectiles
{
    public class Bubble : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Bubble";
            projectile.width = 14;
            projectile.height = 14;
            projectile.alpha = 100;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.light = 0.4f;
            projectile.penetrate = 1;
            projectile.timeLeft = 180;
            projectile.tileCollide = false;
            projectile.aiStyle = 70;
            Main.projFrames[projectile.type] = 8;
        }
   
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            if (Main.rand.Next(2) == 0)
            {
                target.AddBuff(mod.BuffType("GraniteSurge"), 300, true);
            }
        }
   
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 56);
       
            for (int k = 0; k < 20; k++)
            {
                int DustID = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width + 8, projectile.height + 8, 29, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f);
                Main.dust[DustID].noGravity = true;
            }
        }
   
        public override void PostAI()
        {    
            projectile.frameCounter++;
            if (projectile.frameCounter > 2)
            {
                projectile.frame++;
                projectile.frameCounter = 0;
            }
            if (projectile.frame >= 8)
            {
                projectile.frame = 0;
                return;
            }
        }

    }
}
 
6/8/2016 11:19:43 PM
System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)

6/8/2016 11:20:12 PM
System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)
Tmodloader crash first time launching after install, please help and I just joined so I don't know how to use a spoiler
 
So i'v never had this problem before with tmodloader but my firewall is blocking two files called RoslynWrapper.dll and Mono.Cecil.Pdb.dll when i download tmodloader are thy needed as i am running it fine with out them? Also i just got the newest update as well.
 
Hello bluemagic123! I have a problem...

I ask only one simple question: WHAT THE HECK IS ON SCREENSHOT???!!!

Seriously, why i have only one quickslot? and i have no inventory! Interface is absolutely corrupted.

FIX IT OR SAY "DEAL WITH WITH!:cool:"
20160608123509_1.jpg
 
now it disapears each time it switches to the beginning of the sprite sheet and then reapears 1 frame time later

in set defaults I have

Code:
npc.aiStyle = 3;
animationType = NPCID.Zombie;
Main.npcFrameCount[npc.type] = 3;
aiType = NPCID.Skeleton;

and the other code is

Code:
public override void FindFrame(int frameHeight)
        {
            npc.frameCounter++;
            if (npc.frameCounter % 6 == 0)
            {
                myFrame++;
                if (myFrame > Main.npcFrameCount[npc.type])
                    myFrame = 0;
            }
            npc.frame.Y = myFrame * frameHeight;

            npc.spriteDirection = npc.direction;
        }
I see, I forgot that my frame is zero-indexed, while npcFrameCount isn't. To get rid of the blank frame, change the second if statement to "(myFrame >= Main.npcFrameCount[npc.type])".
 
6/8/2016 11:19:43 PM
System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)

6/8/2016 11:20:12 PM
System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args)
Tmodloader crash first time launching after install, please help and I just joined so I don't know how to use a spoiler
You make spoilers with [ spoiler ] [ /spoiler ] tags. If you replace the first tag with [ spoiler=someText ], then the spoiler title changes to someText. (Don't use the spaces when making actual tags!)
For example:
Made you look
(you can quote this post to view the tags in use)

My guess is that you're trying to use the Steam version of tML with the GoG version of Terraria. The GoG version of tML has been recently released; use that instead.
 
How do I Install Tmodloader for Terraria 1.3.1.1 GOG Version? I dont understand :C
Make sure you unblock all of the files in this folder before you start installation.

To install, find your vanilla Terraria.exe and TerrariaServer.exe files then copy them into the Vanilla folder (inside the Patcher folder). Run the Patch.bat file, then the modded Terraria.exe and tModLoaderServer.exe should appear in the tModLoader folder. Copy these modded files back to where you found your vanilla Terraria.exe.

Also copy everything in the Files folder to where you found your vanilla Terraria.exe.

If you ever want to switch back to vanilla, the vanilla Terraria.exe file will still be in the Vanilla folder.
 
Last edited:
How do I Install Tmodloader for Terraria 1.3.1.1 GOG Version? I dont understand :C
Make sure you unblock all of the files in this folder before you start installation.

To install, find your vanilla Terraria.exe and TerrariaServer.exe files then copy them into the Vanilla folder (inside the Patcher folder). Run the Patch.bat file, then the modded Terraria.exe and tModLoaderServer.exe should appear in the tModLoader folder. Copy these modded files back to where you found your vanilla Terraria.exe.

Also copy everything in the Files folder to where you found your vanilla Terraria.exe.

If you ever want to switch back to vanilla, the vanilla Terraria.exe file will still be in the Vanilla folder.
Ok, first find your Terraria.exe. Being the GoG version, this might be in Program Files/Terraria, or somewhere else.

One of the easier ways to find it is to look at the destination of your desktop shortcut if you have one (right-click and click 'properties' or something).
 
Ok, first find your Terraria.exe. Being the GoG version, this might be in Program Files/Terraria, or somewhere else.

One of the easier ways to find it is to look at the destination of your desktop shortcut if you have one (right-click and click 'properties' or something).
I understand that stuff But I dont knw how to install it i tried one time i got an error :/ I dont knw how to install tmodloader correctly do u have skype or something pm me if u do.
 
I just wanted to update my old mod from 1.3.0.8 and add new items, but now, on 1.3.1 it crashes. :c
Here's the log

Couldn't find the part of path "C:\Users\chief\Documents\My Games\Terraria\ModLoader\Logs\Network Error.txt".
в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
в System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append)
в System.IO.File.CreateText(String path)
в Terraria.ModLoader.ErrorLogger.LogModPublish(String message)
в Terraria.ModLoader.UI.UIModSourceItem.Publish(UIMouseEvent evt, UIElement listeningElement)
в Terraria.UI.UIElement.Click(UIMouseEvent evt)
в Terraria.UI.UserInterface.Update(GameTime time)
в Terraria.Main.do_Update(GameTime gameTime)
в Terraria.Main.Update(GameTime gameTime)
[doublepost=1465401544,1465401347][/doublepost]
I just wanted to update my old mod from 1.3.0.8 and add new items, but now, on 1.3.1 it crashes. :c
Here's the log

Couldn't find the part of path "C:\Users\chief\Documents\My Games\Terraria\ModLoader\Logs\Network Error.txt".
в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
в System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append)
в System.IO.File.CreateText(String path)
в Terraria.ModLoader.ErrorLogger.LogModPublish(String message)
в Terraria.ModLoader.UI.UIModSourceItem.Publish(UIMouseEvent evt, UIElement listeningElement)
в Terraria.UI.UIElement.Click(UIMouseEvent evt)
в Terraria.UI.UserInterface.Update(GameTime time)
в Terraria.Main.do_Update(GameTime gameTime)
в Terraria.Main.Update(GameTime gameTime)
And yes, I have reainstalled Windows, so I think if I try to publish this mod, it'll be uploaded as another one, won't it?
[doublepost=1465402078][/doublepost]
I just wanted to update my old mod from 1.3.0.8 and add new items, but now, on 1.3.1 it crashes. :c
Here's the log

Couldn't find the part of path "C:\Users\chief\Documents\My Games\Terraria\ModLoader\Logs\Network Error.txt".
в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
в System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
в System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
в System.IO.StreamWriter..ctor(String path, Boolean append)
в System.IO.File.CreateText(String path)
в Terraria.ModLoader.ErrorLogger.LogModPublish(String message)
в Terraria.ModLoader.UI.UIModSourceItem.Publish(UIMouseEvent evt, UIElement listeningElement)
в Terraria.UI.UIElement.Click(UIMouseEvent evt)
в Terraria.UI.UserInterface.Update(GameTime time)
в Terraria.Main.do_Update(GameTime gameTime)
в Terraria.Main.Update(GameTime gameTime)
[doublepost=1465401544,1465401347][/doublepost]
And yes, I have reainstalled Windows, so I think if I try to publish this mod, it'll be uploaded as another one, won't it?
Ah, well. I just didn't change the version. It has been replaced with the new version. Now everything is fine.
 
I understand that stuff But I dont knw how to install it i tried one time i got an error :/ I dont knw how to install tmodloader correctly do u have skype or something pm me if u do.
Here's the steps broken down:
1. In your Terraria installation directory, find Terraria.exe and TerrariaServer.exe.
2. Copy these files into (tML download)/Patcher/Vanilla.
3. Run Patcher.bat (from tML download). A modded Terraria.exe and tModLoaderServer.exe should appear in Patcher/tModLoader.
4. Copy these new files into your Terraria installation directory. Replace Terraria.exe.
5. Copy all items in the Files folder (in tML download) into your Terraria installation directory (the same place you found and replaced Terraria.exe).
6. Launch and play! Hopefully.
If you're sure you've completed these exact steps and still get an error, please let us know (and provide a screenshot/paste)
 
Back
Top Bottom