Standalone [1.3] tModLoader - A Modding API

this mod decrease spawn ratio?
my underworld's max enemies are change to 5
To me too is decreased, in the blood moon normally 40-50 monsters spawn, but in my three last blood moons only 10
You're joking, right? :p
My vanilla game must have the same bug then. I only get 5 monsters in vanilla blood moons.
Also another vanilla bug is that I can't get all the cellphone parts.

The same happens to me. I don't know if it's a vanilla bug or if it comes from this mod though.

maybe can be the halloween event bug

What are you referring to?
 
Hmm, I'm getting normal amouts in the underworld:
mJSDPr5.png


How can I make an NPC walk left\right (without falling the floor or something like that)? I have a sprite sheet that animates walking.
Thanks!
Are you making your own AI?

There is a way to make vanilla NPCs say new things right?
I think you can just modify this (randomly of course): https://github.com/bluemagic123/tMo...c-virtual-void-getchatnpc-npc-ref-string-chat

By the way, when I try to download the example mod from Mediafire, I get a "Permission Denied" error.
Hmm, wonder why that's happening, I see that too.
 
The same happens to me. I don't know if it's a vanilla bug or if it comes from this mod though.
It's literally just bad luck. What happens is that the people who get unlucky mention it, while the people who get lucky or who get normal luck have no reason to say anything. Thus it looks like everyone's getting no spawns, while in reality it's just a few people getting unlucky. I'm personally always getting swarmed with monsters whenever I try to test things like modded tiles or items, never get monsters when I just happen to want to test NPCs, and get no monsters in vanilla when I'm hunting for banners. Like I said, it's all luck. (I can't believe people actually think this might be some sort of bug, haha :D)

By the way, when I try to download the example mod from Mediafire, I get a "Permission Denied" error.
Hmm, wonder why that's happening, I see that too.
That's pretty weird, since I'm able to download it normally.
 
I may have found a bug; apparently you can put modtiles through the extractinator, but I tested it with other mods' tiles and it happens too. I tested mine because I know I didn't put such properties in them.
 
I may have found a bug; apparently you can put modtiles through the extractinator, but I tested it with other mods' tiles and it happens too. I tested mine because I know I didn't put such properties in them.
I've confirmed this bug. Thanks for reporting! It will be fixed in the next update.
 
How would you go about creating a torch tile? I've tinkered around with TileObjectData by trying to adapt the code in the ExampleMod's workbench, bed etc. to apply to a torch, but the current behavior is not quite right. Here's what I've got:

Code:
    public class BeigeTorchTile : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileFlame[Type] = true;
            Main.tileLighted[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileSolid[Type] = false;
            Main.tileNoAttach[Type] = true;
            //Main.tileNoFail[Type] = true;
            Main.tileWaterDeath[Type] = true;

            TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newTile.CoordinateHeights = new int[] { 20 };
            TileObjectData.addTile(Type);

            drop = mod.ItemType("BeigeTorch");
            soundStyle = 1;
            mineResist = 0.1f;
            dustType = mod.DustType("QuartzBoltDust");
            AddMapEntry(new Color((int)(255 * 0.7255f), (int)(255 * 0.7020f), (int)(255 * 0.6667f)));
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
            adjTiles = new int[]{TileID.Torches};
        }
    }

With that code, torches break instantly when they're placed. At one point I got it to place, but it could be placed on any side (including the underside of a block) and the sprite wasn't right. Speaking of which, my sprite image looks like this:
r726UiS.png


It would also be nice if you could add the torch item to the list of things that the player can hold when you press shift, but I can't figure that one out either.
 
How do I get a projectile to create dust on impact with a tile?
You can use the following:
Code:
public override bool OnTileCollide(Vector2 oldVelocity)
{            
    Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height);
    return true;
}
This spawns the dust corresponding with the tile that was hit, which is probably what you're asking for. Or did you mean ModDusts?
 
How would you go about creating a torch tile? I've tinkered around with TileObjectData by trying to adapt the code in the ExampleMod's workbench, bed etc. to apply to a torch, but the current behavior is not quite right. Here's what I've got:

Code:
    public class BeigeTorchTile : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileFlame[Type] = true;
            Main.tileLighted[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileSolid[Type] = false;
            Main.tileNoAttach[Type] = true;
            //Main.tileNoFail[Type] = true;
            Main.tileWaterDeath[Type] = true;

            TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newTile.CoordinateHeights = new int[] { 20 };
            TileObjectData.addTile(Type);

            drop = mod.ItemType("BeigeTorch");
            soundStyle = 1;
            mineResist = 0.1f;
            dustType = mod.DustType("QuartzBoltDust");
            AddMapEntry(new Color((int)(255 * 0.7255f), (int)(255 * 0.7020f), (int)(255 * 0.6667f)));
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
            adjTiles = new int[]{TileID.Torches};
        }
    }

With that code, torches break instantly when they're placed. At one point I got it to place, but it could be placed on any side (including the underside of a block) and the sprite wasn't right. Speaking of which, my sprite image looks like this:
r726UiS.png


It would also be nice if you could add the torch item to the list of things that the player can hold when you press shift, but I can't figure that one out either.
It looks like you need to add alternates for your TileObjectData, each one representing an orientation the torch can be placed in. Here's the code for the vanilla torch and its alternates:
Code:
            TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); //the default torch orientation is on the ground
            TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); //torch with wall on left
            TileObjectData.newAlternate.AnchorAlternateTiles = new int[]
            {
                124 //allows placement on wooden beams
            };
            TileObjectData.addAlternate(1);
            TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); //torch with wall on right
            TileObjectData.newAlternate.AnchorAlternateTiles = new int[]
            {
                124 //allows placement on wooden beams
            };
            TileObjectData.addAlternate(2);
            TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
            TileObjectData.newAlternate.AnchorWall = true; //torch on wall
            TileObjectData.addAlternate(0);

And you're right, I completely forgot about hotkeys working for modded items. I'll try to get that in the next update.
 
Hmm, I'm getting normal amouts in the underworld:
mJSDPr5.png



Are you making your own AI?
ya. but how can I tell the animation to change? I can get the NPC to move but I can't get it to animate. I'd rather not upload the sprite sheet, it's a secret ;)
 
ya. but how can I tell the animation to change? I can get the NPC to move but I can't get it to animate. I'd rather not upload the sprite sheet, it's a secret ;)
You can look at the Abomination for an "example". The Abomination doesn't have a walking animation, but it shows you how you can change the NPC's frame. What you'll need to do is look at the y-velocity to see whether the NPC is falling/jumping, or whether it's on the ground. If it's on the ground, you can look at the x-velocity to tell how fast it's going, and increment frameCounter by a certain amount. frameCounter is a field in NPC dedicated to timing the animations. Once frameCounter reaches a certain value, you can set it to 0 then change your NPC's frame.
 
should this work?:
Code:
 npc.direction = npc.velocity.X > 0 ? -1 : 1;
            npc.spriteDirection = npc.direction;
            frameHeight = 52;
           
            if (running)
            {
                npc.frameCounter += 1;
                 npc.frameCounter %= Main.npcFrameCount[npc.type];
                npc.frame.Y = (int)((npc.frameCounter) * frameHeight);
               
            }
            if (standing)
            {
                npc.frame.Y = 0;
            }
running and standing are defined in the AI() and they work.
 
should this work?:
Code:
npc.direction = npc.velocity.X > 0 ? -1 : 1;
            npc.spriteDirection = npc.direction;
            frameHeight = 52;
          
            if (running)
            {
                npc.frameCounter += 1;
                 npc.frameCounter %= Main.npcFrameCount[npc.type];
                npc.frame.Y = (int)((npc.frameCounter) * frameHeight);
              
            }
            if (standing)
            {
                npc.frame.Y = 0;
            }
running and standing are defined in the AI() and they work.
You shouldn't need to set frameHeight yourself; the parameter will already be set to the correct value for you.
But yeah, that should work if you're fine with each frame lasting only a single tick.
 
Sooooo, I'm trying to make a Buff that boosts defence, but lowers mobility (move speed) and have the following code as the buffs Update:
Code:
public override void Update(Player player, ref int buffIndex)
{
    player.statDefense += 5;
    player.moveSpeed -= 0.2F;
}
And all's well, but when the buff is active and the player is at full speed, you get these particles/dusts as if the player is running. Now I don't have anything else equipped, so I'm positive that this is a visual effect that the buff gives, but this ain't an effect that I want, sooo... Is there any way to remove this?
 
Hi I never made a mod and totally new with programmation, I want to create a boss that have the same AI of King slime... but I don't have Idea of how create a mod :( Anyone can help me how? I'll try to make a prince slime but don't know what is the codes etc...
 
Back
Top Bottom