Standalone [1.3] tModLoader - A Modding API

i cant find anything help!
 
Is there a way to increase the speed of the animation when using public override DrawAnimation GetAnimation() for item animations?
 
Look in NPC.cs for the setdefaults of the NPC you are interested in. You'll see the type and aistyle for that NPC. Then, look for aistyle == (number here) and you should find the ai code for that ai style. Within that block of code there may be if statements to further refine the aistyle due to the type (aka NPCid) of the NPC. You'll need to look through it and attempt to understand the code.
 
Is there a way to increase the speed of the animation when using public override DrawAnimation GetAnimation() for item animations?
Yeah, the first parameter of the function you're returning determines the animation Speed.
 
Yeah, the first parameter of the function you're returning determines the animation Speed.
Maybe I'm being misled by this example then? I figured the return new was the only one I could use.

Or I guess it would be more appropriate to say, I thought the 30 was the frame height and the 4 was the total frames. So I don't see where I'm able to influence the speed from this example.
Code:
public override DrawAnimation GetAnimation()
        {
            return new DrawAnimationVertical(30, 4);
        }
 
Maybe I'm being misled by this example then? I figured the return new was the only one I could use.

Or I guess it would be more appropriate to say, I thought the 30 was the frame height and the 4 was the total frames. So I don't see where I'm able to influence the speed from this example.
Code:
public override DrawAnimation GetAnimation()
        {
            return new DrawAnimationVertical(30, 4);
        }
I believe the second parameter automatically defines the frame height of each frame by dividing the actual texture height by the amount of frames.
 
Try this:

Code:
public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor)
        {      
            if(npc.hasBuff(mod.BuffType("Frost")) != -1)
            {
                Vector2 drawPos = new Vector2(npc.position.X,npc.position.Y);
                spriteBatch.Draw(mod.GetTexture("Extras/Frozen"), drawPos, null, default(Color), 0f, drawPos, npc.scale * 2 , SpriteEffects.None, 0f);
                return false;
            }
            return true;      
        }

Untested, should (highly) theoretically work. If default(Color) gives an error, just change it to Color.white and that should work.
Still invisible :)
 
Then I think something's wrong with your texture, although at this point your guess is as good as mine.
It needs to be non-transparent?
 
It needs to be non-transparent?

No, that shouldn't be an issue, unless of course it's fully transparent, in which case, yes.

Is your texture a completely new sprite of the NPC or just an overlay/effect?
 
No, that shouldn't be an issue, unless of course it's fully transparent, in which case, yes.

Is your texture a completely new sprite of the NPC or just an overlay/effect?
Is an overlay.
 
Last edited:
How would I make a custom ore generate in a world?
 
How would I make a custom ore generate in a world?
Code:
        public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));
            if (ShiniesIndex == -1)
            {
                // Shinies pass removed by some other mod.
                return;
            }
            tasks.Insert(ShiniesIndex + 1, new PassLegacy("Example Mod Ores", delegate (GenerationProgress progress)
            {
                progress.Message = "Example Mod Ores";

                for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
                {
                    WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("ExampleBlock"), false, 0f, 0f, false, true);
                }
            }));
        }
where "mod.TileType("ExampleBlock")" is the tile, 6E-05 is a multiplier on the number of loops, and I forget all the parameters for TileRunner right now.
 
Look in NPC.cs for the setdefaults of the NPC you are interested in. You'll see the type and aistyle for that NPC. Then, look for aistyle == (number here) and you should find the ai code for that ai style. Within that block of code there may be if statements to further refine the aistyle due to the type (aka NPCid) of the NPC. You'll need to look through it and attempt to understand the code.
where would i find NPC.cs
 
How can I make flails and boomerangs?
 
Last edited:
How can I make flails and boomerangs? Could somebody help please?
 
Back
Top Bottom