Standalone [1.3] tModLoader - A Modding API

I'm having an issue working on a creature. Upon building and reloading the mod, it tells me that its expecting a ; in between the p and e in aiType? I tried adding it but then it asks for another ; right after it over and over.
Please post your code whenever you get such an error, it's virtually impossible to help you based on this limited information.
ummmm i tried downloading tModloader and copying all the files and everything into my terraria folder but when i open terraria nothing changes its just normal terraria, im running version 1.3.1.1. can someone help?
Sounds like you didn't replace the executable. Try again.
 
so i use this to print text into chat

Main.NewText("ExpertMode +2 Max",155,155,155);

but how can i print a number from a score that changes from time to time



something like this

int BlueSlime = Item.NPCtoBanner(NPCID.BlueSlime);

Main.NewText("Blue Slimes killed BlueSlime",155,155,155);

where it prints the number from the score
 
I am making a modded item that shoots a modded projectile that mimics the vanilla projectile.
In that case, the problem is most likely with the projectile. The defaults that I gave you before were for the item. Here's the defaults for the projectile.
projectile.name = "Arkhalis"; //change this of course
projectile.width = 68;
projectile.height = 64;
projectile.aiStyle = 75;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.melee = true;
projectile.penetrate = -1;
projectile.ownerHitCheck = true;
You will also need aiType = ProjectileID.Arkhalis; (not projectile.type = 595; my mistake) and maybe also Main.projFrames[projectile.type] = 28;

What are you using for the projectile's texture? Vanilla uses a texture that's 68 x 1792 pixels big, divided vertically into 28 frames, each 64 px tall. It should be possible to use autoload to use vanilla's texture, but if you want to have your own custom look, you'll need to do your own texture.

ummmm i tried downloading tModloader and copying all the files and everything into my terraria folder but when i open terraria nothing changes its just normal terraria, im running version 1.3.1.1. can someone help?
If you renamed the Terraria.exe file when you copied it, just start that instead of the vanilla executable. If you rename the executable for tModLoader, you can choose between starting tModLoader or Terraria without having to rename any files.
 
so i use this to print text into chat

Main.NewText("ExpertMode +2 Max",155,155,155);

but how can i print a number from a score that changes from time to time



something like this

int BlueSlime = Item.NPCtoBanner(NPCID.BlueSlime);

Main.NewText("Blue Slimes killed BlueSlime",155,155,155);

where it prints the number from the score

If I understand your question right, try:

Main.NewText("Blue Slimes killed " + BlueSlime.ToString(),155,155,155);

or

Main.NewText(string.Format("Blue Slimes killed {0}", BlueSlime),155,155,155);
 
If I understand your question right, try:

Main.NewText("Blue Slimes killed " + BlueSlime.ToString(),155,155,155);

or

Main.NewText(string.Format("Blue Slimes killed {0}", BlueSlime),155,155,155);


i want the text in chat to look like this

Blue Slimes killed 293

where it uses the number from NPCtoBanner
 
Hey, me and my friend wants to play together, but everytime we try "host & play" the game crashes, we have tried the "tmodloader server" but one always ccannot connect (we are using hamachi). Is it just how it is, or are we just stupid? (Note: i have surfed the web but i cant find anything that help).
Thanks in advance

-Blue Cat
 
In that case, the problem is most likely with the projectile. The defaults that I gave you before were for the item. Here's the defaults for the projectile.
projectile.name = "Arkhalis"; //change this of course
projectile.width = 68;
projectile.height = 64;
projectile.aiStyle = 75;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.melee = true;
projectile.penetrate = -1;
projectile.ownerHitCheck = true;
You will also need aiType = ProjectileID.Arkhalis; (not projectile.type = 595; my mistake) and maybe also Main.projFrames[projectile.type] = 28;

What are you using for the projectile's texture? Vanilla uses a texture that's 68 x 1792 pixels big, divided vertically into 28 frames, each 64 px tall. It should be possible to use autoload to use vanilla's texture, but if you want to have your own custom look, you'll need to do your own texture.

Still no projectile shows up

projectile
Code:
 public class SolarisP : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Solarius";
            projectile.width = 68;
            projectile.height = 64;
            projectile.friendly = true;
            projectile.penetrate = -1;
            projectile.aiStyle = 75;
            projectile.type = ProjectileID.Arkhalis;
            Main.projFrames[projectile.type] = 28;
            projectile.ownerHitCheck = true;
            projectile.melee = true;
            projectile.tileCollide = false;
            projectile.light = 2f;
        }

weapon
Code:
 public override void SetDefaults()
        {
            item.name = "Solarius";
            item.damage = 200;
            item.melee = true;
            item.width = 48;
            item.height = 48;
            item.useTime = 15;
            item.useAnimation = 1;
            item.useStyle = 5;
            item.noMelee = true;
            item.knockBack = 4f;
            item.noUseGraphic = true;
            item.channel = true;
            item.value = 100000;
            item.rare = 9;
            item.useSound = 1;
            item.autoReuse = false;
            item.shoot = mod.ProjectileType("SolarisP");
            item.shootSpeed = 15f;
        }

where's the fail at?
I'm thinking in the weapon, but... I have no idea

also, remember all my questions about homing and boomerangs? well, now I want a homing boomerang... It's half working. I want it to work like the possessed hatchet, but It doesn't. It tries to home on things through blocks, and homes on on thing and keeps returning till it's dead then goes to another. I want it to only hit 1 thing once then return to the player. also, if I try to shoot it left, for example, and there is a target on the right, it will go right with out going left at all. I want it to curve, not go abruptly.

the code
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 = 16;
        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;
            }
        }
        public override void PostAI()
        {
            if (projectile.ai[0] == 1)
            {
                Player myOwner = Main.player[projectile.owner]; //find the owner of this projectile
                Vector2 toMe = Vector2.Normalize(myOwner.Center - projectile.Center); //find the distance from this projectile to it's owner and convert to a unit vector.
                projectile.velocity += toMe * 1f; //add the above vector to this projectile's velocity -- change 1f to change the return speed
            }

        }

also, can anyone help me with the boss ai?

I have a couple of questions about npc ai, projectile ai, and other stuff for my custom boss. I be soo lost

- how do I make the npc texture change to something else kinda like the EoC changes to have a mouth.

- how do I make the npc shoot a projectile from the edge of the texture and not the center to where it's facing, not necessarily at the player EDIT: sorta like the way either one of the twins shoots, my shots usually come out in weird angles from the texture center to where the player is when it is shot.

- how do I make the npc stay stationary and spin
- also how might I make the npc invincible and regen while it is spinning

- how do I make the npc hover above the player like the nimbus, only stay in that position relative to the player no matter how fast they move

- how do I draw a giant rectangle, sort of like the circle around the abomination in that it is shaded, with the player's position, when it is first drawn, as the center when the boss is first summoned, and stay put until the boss is defeated or leaves, which it will do if the player dies
- also how might I move the npc to the center of the rectangle
- also how might I make the npc charge super fast at the payer and deal 1,000,000,000,000 damage or what ever the max damage in terraria is and be invincible if the player leaver the inside of the rectangle (I know it's OP, buuut... the summon item will warn you not to leave...)

- how might I make a bouncing projectile, that bounces like the meteorite bullet, but with no limit
- also how could I make this projectile bounce of the side of the rectangle, but only if it hits them from the inside (or is this even possible)
- also how could I make this projectile shoot motionless projectile every single tick to stay along the path it took and damage the player

- how might I make the npc damage and defence increase the more damaged it is

- how might I make the npc shoot a beam like the moon lord's death ray thing

-how do I make the npc face the player and then charge like the expert EoC

EDIT: 'a couple questions' is a huge understatement. I just noticed that

pls help me

pls help me
 
Last edited:
Can Some one please help me, Some of the mods that I want to play say that they only work on version 8.2 and no-matter were i click to download or what i click it always downloads version 8.0? what can i do?
 
i want the text in chat to look like this

Blue Slimes killed 293

where it uses the number from NPCtoBanner

That is what the two examples I showed would do. If you have:
Code:
int BlueSlime = Item.NPCtoBanner(NPCID.BlueSlime);
then you can do BlueSlime.ToString() and use the '+' operator to add it anywhere you want in a string.
Code:
Main.NewText("Blue Slimes killed " + BlueSlime.ToString(),155,155,155);

Alternatively, you can use 'string.Format()' to substitute in values where you want them in the string without using the addition operator.
Code:
Main.NewText(string.Format("Blue Slimes killed {0}", BlueSlime),155,155,155);
The '{0}' would be replaced with the string representation of the 'BlueSlime' variable.

Either way you do it, if the 'BlueSlime' variable has a value of '293', then they would both output: Blue Slimes Killed 293
 
ok so yesterday got v0.8.2 but v0.8.2.1 came out the day after how would i update and not lose any of my stuff

this is all tmodloader can any one help me pls?
 
When I install this, and launch Terraria with it, all my Terraria characters and worlds disappear. Is there a way to make this not happen?
 
When I install this, and launch Terraria with it, all my Terraria characters and worlds disappear. Is there a way to make this not happen?
tModLoader saves and vanilla saves are saved seperately. If you want to use vanilla characters and/or worlds, you'll have to copy them over.
 
When I'm using this (Mac version) There are some sounds that are muted, and I can't fix them at all. Zombies don't make death sounds, there's no sound for picking up money/selling/buying stuff, and I can't hear the fallen star/starfury sound effect, either. All the other sounds so far are fine, though.
 
I have a problem building my mod, It says the type or namespace name Example player could not be found, I don't know what that means, the error is inside the cs file for the buff for my oshawott pet mod, can you find the error in the file?
sing Terraria;
using Terraria.ModLoader;

namespace Oshawottmod.Buffs
{
public class ExamplePet : ModBuff
{
public override void SetDefaults()
{
Main.buffName[Type] = "Oshawott";
Main.buffTip[Type] = "\"Don't be sad little guy!\"";
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}

public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<ExamplePlayer>(mod).Oshawott = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Oshawott")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Oshawott"), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
This a simple mod, it just adds a oshawott pet, it has 4 frames of animation, and copies Ai from the bunny pet, should I use other Ai for my pet?
[doublepost=1467248223,1467248088][/doublepost]forgot to mention, i used the Example mod's example pet as a template for this code, is their any problem with that too?
 
Back
Top Bottom