Standalone [1.3] tModLoader - A Modding API

Thanks a lot !
Don't mess with the player regeneration. It does make you regenerate faster but will also make all dots tick faster. Then again, you might like that if you want a tougher game. Just don't set it too hight or any dot will kill you almost instantly.



On another matter is there still a discussion on whether or not 64 bit will be done? Or is it dead like my hopes and dreams?
 
You can always override an AI method and set the velocity to zero manually:
Code:
public override bool PreAI()
{
    projectile.velocity = Vector2.Zero;
    return false;
}
Thanks for the help :). But how do I get my projectile to spawn when it comes in contact with a tile or enemy npc?
Here is the projectile's code:
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonSpell : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Poison Spell";
            projectile.width = 8;
            projectile.height = 21;
            projectile.aiStyle = 1;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = 1;
            projectile.timeLeft = 600000;
            projectile.light = 0.5f;
            projectile.tileCollide = true;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
        }
        public override bool Kill(Vector2 oldVelocity)
        {
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(1, 1), Main.rand.Next(1, 1), mod.ProjectileType ("PoisonRing"), (int)(projectile.damage * .5f), projectile.owner);
           
            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PoisonSpell"), projectile.position);
            return true;
        }   
    }
}
 
How do I get my projectile to do damage? This question sounds dumb but since this projectile (Poison Ring) spawns from the (Poison Spell) it doesn't do any damage.
here is the projectile's code (Poison Ring)
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {   
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 160;
            projectile.height = 159;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
        }
        public override bool PreAI()
    {
        projectile.velocity = Vector2.Zero;
        return false;
    }

    }
}
 
anyone knows what happen to boss health bar mod? i cant find it on the browser people.

It's probably not updated yet. I think if you can find an older version it should work. Gameraiders is still using it in his new series.
I HATE YOU THIS DELETED ALL MY PROGRESS THIS IS :red: GO TO HELL I HAVE WORKED HUNDREDS OF HOURS TO GET MY STUFF AND NOW ITS :red:ING GONE

You do realize that tmod saves characters and worlds in a separate folder from the original? If you didn't and it seems you don't. they are still available but can not be accessed by terraria unless you move them to the correct folder.
 
How do I get my projectile to do damage? This question sounds dumb but since this projectile (Poison Ring) spawns from the (Poison Spell) it doesn't do any damage.
here is the projectile's code (Poison Ring)
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {  
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 160;
            projectile.height = 159;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
        }
        public override bool PreAI()
    {
        projectile.velocity = Vector2.Zero;
        return false;
    }

    }
}
I believe all you are missing is projectile.damage = (some number); from your SetDefaults hook.
 
All of my Characters and worlds disappeared after downloading. Any help on recuperating them?

Go to "My Documents\My Games\Terraria\" Copy the "Worlds" and "Players" folders into the "ModLoader" folder. Just be careful about overwriting files, etc.
 
Who knows what is the name of mod, which the more information about weapon
Example:
Wood sword
7 Melee Damage
Very Fast speed (25)
Weak knockback (4)
 
Last edited:
I want to make an accessory that takes away invulnerability frames, and also takes away life regen, how would I do that? I have no idea where to find a list with all of the player's stat names e.g. meleeDamage

*player.meleeDamage*
 
I believe all you are missing is projectile.damage = (some number); from your SetDefaults hook.
I added the projectile.damage = 25; but it still doesn't do damage :/
Here is the code:
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {   
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 160;
            projectile.height = 159;
            projectile.friendly = true;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
            projectile.damage = 25;
        }
        public override bool PreAI()
        {
            projectile.velocity = Vector2.Zero;
            return false;
        }

    }
}
 
I added the projectile.damage = 25; but it still doesn't do damage :/
Here is the code:
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {  
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 160;
            projectile.height = 159;
            projectile.friendly = true;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
            projectile.damage = 25;
        }
        public override bool PreAI()
        {
            projectile.velocity = Vector2.Zero;
            return false;
        }

    }
}
If you ever put the item.damage in your SetDefaults hook for your items, it should do the weapons' damage
[doublepost=1486234608,1486234348][/doublepost]On my side, I have another problem. I'm making a spear, and it's noice and stuff, but even though it goes in the right direstion, it points in the most random way ever...
Here is my code for the item and the projectile :
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace SimpleMod.Items
{
    public class SimpleSpear : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Simple Spear";
            item.width = 80;
            item.height = 80;
            item.toolTip = "A simple spear...";
            item.rare = 2;
            item.useTime = 60;
            item.useAnimation = 60;
            item.useStyle = 5;
            item.useTurn = true;
            item.autoReuse = true;
            item.UseSound = SoundID.Item1;
            item.value = 10000;
            item.damage = 60;
            item.knockBack = 8f;
            item.crit = 4;
            item.shoot = mod.ProjectileType("SimpleSpearProj");
            item.shootSpeed = 3f;
            item.melee = true;
            item.noMelee = true;
            item.noUseGraphic = true;
        }
       
        public override bool CanUseItem(Player player)
        {
            return player.ownedProjectileCounts[item.shoot] < 1;
        }
       
        public override void AddRecipes()
        {
            ModRecipe recipe;
           
            recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "SimpleAlloy", 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace SimpleMod.Projectiles
{
    public class SimpleSpearProj : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Simple Spear";
            projectile.width = 80;
            projectile.height = 80;
            projectile.aiStyle = 19;
            projectile.penetrate = -1;
            projectile.friendly = true;
            projectile.hide = true;
            projectile.ignoreWater = true;
            projectile.tileCollide = false;
            projectile.melee = true;
            projectile.ownerHitCheck = true;
        }
       
        public override void AI()
        {
            Main.player[projectile.owner].direction = projectile.direction;
            Main.player[projectile.owner].heldProj = projectile.whoAmI;
            Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
            projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2);
            projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2);
            projectile.position += projectile.velocity * projectile.ai[0];
           
            if (!Main.player[projectile.owner].frozen)
            {
                if (projectile.ai[0] == 0f)
                {
                    projectile.ai[0] = 3f;
                    projectile.netUpdate = true;
                }
               
                if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
                {
                    projectile.ai[0] -= 1f;
                }
                else
                {
                    projectile.ai[0] += 1f;
                }
            }
           
            if (Main.player[projectile.owner].itemAnimation == 0)
            {
                projectile.Kill();
            }
           
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.X, (double)projectile.velocity.Y) + MathHelper.ToRadians(135f);
            if (projectile.spriteDirection == -1)
            {
                projectile.rotation -= MathHelper.ToRadians(90f);
            }
        }
    }
}

Thx for anyone who will help me :p
 
I want to make an accessory that takes away invulnerability frames, and also takes away life regen, how would I do that? I have no idea where to find a list with all of the player's stat names e.g. meleeDamage

*player.meleeDamage*

To take away regen, in ModPlayer.UpdateBadLifeRegen put lines like "player.lifeRegen = 0; player.lifeRegenTime = 0;"
For the invulnerability, if you use ModPlayer.PostHurt and have "player.immuneTime = 0;" it would get rid of most of it I think.

If doing this via an accessory, you'll need to set some kind of flag in the ModPlayer class.
[doublepost=1486237047,1486236549][/doublepost]
<snippage>
Code:
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.X, (double)projectile.velocity.Y) + MathHelper.ToRadians(135f);
            if (projectile.spriteDirection == -1)
            {
                projectile.rotation -= MathHelper.ToRadians(90f);
            }
        }
    }
}

Thx for anyone who will help me :p

Math.Atan2 parameters should be Y and then X. I'm not sure if you'll need to adjust it with the MathHelper stuff after that or not.
 
Back
Top Bottom