Standalone [1.3] tModLoader - A Modding API

WORKED! thanks budy, buuuut... when the mod is with the buff, he turns invisible:D

That could have multiple causes. Try this and see if it works:
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, Color.White, 0f, new Vector2(28f, 28f), 1f, SpriteEffects.None, 0f);
                return false;
            }
            return true;     
        }
 
k thanks
[doublepost=1459097849,1459097418][/doublepost]wait Terraria.exe? where would i find that, or is it just terraria
[doublepost=1459098230][/doublepost]nevermind i found it, i found BossEoC and what now
[doublepost=1459098398][/doublepost]it just says
Code:
// Terraria.GameContent.UI.EmoteID
public const int BossEoC = 39;
 
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.
 
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 :)
 
Back
Top Bottom