tModLoader Official tModLoader Help Thread

Hi,

What is the plr parameter in these methods:

C#:
WorldGen.PlaceTile(int j, int i, int type, [bool mute = false], [bool force = false], [int plr = -1],[int style = 0]);

NPC.SpawnOnPlayer(int plr, int Type);

I see it in a lot of methods, but can't find any definition of what it is....

Thanks :)
 
im trying to make a sword/dagger kind of thing but the sprite is tiny does anyone know how to fix it?
1589065573337.png

1589065603458.png
 
Hi,

What is the plr parameter in these methods:

C#:
WorldGen.PlaceTile(int j, int i, int type, [bool mute = false], [bool force = false], [int plr = -1],[int style = 0]);

NPC.SpawnOnPlayer(int plr, int Type);

I see it in a lot of methods, but can't find any definition of what it is....

Thanks :)
It is very likely the index of a player in the Main.player array, so it can range from 0 to MaxPlayers-1 (that's probably 254)
I've got an error, and I don't know why, so i'll erase all of my game folders. I have a pastebin on it. LINK
That's an odd error, I havent seen that before. What OS are you on?
I want to make an accessory that acts like the brain of confusion but I can't find anything that explains how and was wondering if you could guide me
You might want to read the vanilla code adaption guide
 
Question: I know it was listed earlier in the thread, but how do I give a projectile an afterimage effect, like how the tempest staff has an afterimage on the sharks it sends out? The other posts on the thread don't seem to work for me.
 
i need help with frames/animation of a projectile ive made. i have all the 'frames' 4 pixels apart verticaly and named it the same as the projectile.
however in game all the frames are shown at the same time stacked on top of each other.
if anyone one knows how to fix this help would be much appreciated.
 
i need help with frames/animation of a projectile ive made. i have all the 'frames' 4 pixels apart verticaly and named it the same as the projectile.
however in game all the frames are shown at the same time stacked on top of each other.
if anyone one knows how to fix this help would be much appreciated.

I'm not too sure about frames and animation, but whenever I do it I have them 2 pixels apart rather than 4 and they work fine so maybe try that?
 
I'm not too sure about frames and animation, but whenever I do it I have them 2 pixels apart rather than 4 and they work fine so maybe try that?

i tried it and it didnt work sadly. maybe because my projectile grows in size for each fram?
thanks anyway :D
 
i tried it and it didnt work sadly. maybe because my projectile grows in size for each fram?
thanks anyway :D
I'll just tell you what I have for my projectile codes and see if it works. It shouldn't matter if the animation itself grows in size as long as each frame of the animation has the same border size.
So, in SetDefaults(),
make sure that your projectile.width and projectile.height are the size of one individual frame, not including the 2 pixels in between. Make sure that the number in your Main.projFrames[projectile.type] is the number of frames that you have. Then in the code, I have
C#:
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            projectile.frameCounter++;
            if (projectile.frameCounter >= 10)

            {
                projectile.frame++;
                projectile.frameCounter = 0;
                if (projectile.frame > 3)
                    projectile.frame = 0;
            }
            return true;
When I use these scripts everything works fine for me, so if this doesn't work I'm not sure.
 
I'll just tell you what I have for my projectile codes and see if it works. It shouldn't matter if the animation itself grows in size as long as each frame of the animation has the same border size.
So, in SetDefaults(),
make sure that your projectile.width and projectile.height are the size of one individual frame, not including the 2 pixels in between. Make sure that the number in your Main.projFrames[projectile.type] is the number of frames that you have. Then in the code, I have
C#:
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            projectile.frameCounter++;
            if (projectile.frameCounter >= 10)

            {
                projectile.frame++;
                projectile.frameCounter = 0;
                if (projectile.frame > 3)
                    projectile.frame = 0;
            }
            return true;
When I use these scripts everything works fine for me, so if this doesn't work I'm not sure.
ive now tried adding that code but under Predraw there is an error it says. 'curesedball.PreDraw(Spritebatch, Color': not all code paths return a value
im not sure what that means.
btw sorry if this is annoying.
 
Hey! I'm new to the forums, and Terraria modding, so excuse any dumbassery on my part, but I'm struggling to get a tile to work, with no apparent reason as to why. Here is my code, the 'UHCram' item works fine and isn't intended to place this tile, as in once it's mined you can't place it again with the 'UHCram
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace Cram.Items.Placable
{
public class UnhardenedCram : ModTile
{
public override void SetDefaults()
{
Main.tileSolid[Type] = true;
Main.tileMergeDirt[Type] = true;
Main.tileBlockLight[Type] = false;
Main.tileLighted[Type] = true;
drop = mod.ItemType("UHCram");
}
}
}
 
Back
Top Bottom