Standalone [1.3] tModLoader - A Modding API

Hi, I've run into a bit of a problem. I've been working on one part of my mod, and recently tested an item that I have had working for months now. It is still working fine in single player, but has stopped working in multiplayer altogether. I did a little bit of debugging, and found that the hook UseItem doesn't seem to be called on a server anymore. I used the following code to test this.
Code:
public override bool UseItem(Player player)
{
    Main.NewText("UseItem");
    Console.WriteLine("UseItem");
//ect...
My mod is kind of dependant of this being called on the server. Is there some reason why this and several other item related hooks are no longer being called on the server, or has Console.WriteLine been disabled somehow?

Thank you for your time.
 
Hi, I've run into a bit of a problem. I've been working on one part of my mod, and recently tested an item that I have had working for months now. It is still working fine in single player, but has stopped working in multiplayer altogether. I did a little bit of debugging, and found that the hook UseItem doesn't seem to be called on a server anymore. I used the following code to test this.
Code:
public override bool UseItem(Player player)
{
    Main.NewText("UseItem");
    Console.WriteLine("UseItem");
//ect...
My mod is kind of dependant of this being called on the server. Is there some reason why this and several other item related hooks are no longer being called on the server, or has Console.WriteLine been disabled somehow?

Thank you for your time.
In my experience, Main.NewText itself should be called on the server (same as when the server displays the chat input of every player).
So if this is never called on the server, my guess is that it never reaches the server(?).
 
guys im back and i need help AGAIN.
so, i wanna make a Buff, given by a potion called "Ancient Waters", the Buff is Called Pandolars Blessing and it should give +50 max health, +2 increased regen, and 15% more dmg on everything, ontop of that a sprite is displayed above the buffed player (its a Pandolar God, with little dust below it)

you dont need to put the whole code there for me to copy, u can if u want, but a few codes here and there and explanation where to put em would be nice, i think the stuff with the sprite above the player is similar to how a sprite is displayed on a boss when its low health (like al0n37 showed in his Boss Second Stage video).

thx for the replies! ^-^
 
Multiple things that I need help with:
1. Making a big mimic
2. Making a custom death animation for an enemy
3. Making an enemy move faster
4. Making and enemy fly towards the player at high speeds when they get too far away and using a custom animation when that happens
 
guys im back and i need help AGAIN.
so, i wanna make a Buff, given by a potion called "Ancient Waters", the Buff is Called Pandolars Blessing and it should give +50 max health, +2 increased regen, and 15% more dmg on everything, ontop of that a sprite is displayed above the buffed player (its a Pandolar God, with little dust below it)

you dont need to put the whole code there for me to copy, u can if u want, but a few codes here and there and explanation where to put em would be nice, i think the stuff with the sprite above the player is similar to how a sprite is displayed on a boss when its low health (like al0n37 showed in his Boss Second Stage video).

thx for the replies! ^-^
I don't know how to do the sprite thing, but this should work for the rest of the stuff.
Code:
public override void Update(Player player, ref int buffIndex)
{
        player.lifeRegen += 2;
        player.statLifeMax2 += 50;
        player.magicDamage += 0.15f;
        player.meleeDamage += 0.15f;
        player.rangedDamage += 0.15f;
        player.thrownDamage += 0.15f;
        player.minionDamage += 0.15f;
}
 
Heyo, I have a question.
Do I have to create a new map every time I install a mod? ( Talking about the ores and so on )
Thanks
 
............HELP I cant go to Terrarai it not letting me ???

It keep saying go to steam client but I do that and it still NOT working ;-; HELP!!!!
 
Last edited:
does anyone know how i can create a sprite above the Buffed player???
 
I have success, use examplemod:
In ExamplePlayer, this is :
public static readonly PlayerLayer MiscEffects
avec
public override void ModifyDrawLayers(List<PlayerLayer> layers)

After 10 hours of research, and after 1 hour when i have found:
http://imgur.com/ZaL4tLp

You can alone for that without problem.
 
WOW! YOU CAN CREATE A MORPH MOD WITH THAT!!!

but i still dont know how to display a sprite above the player ._.
 
I have say you how --', you have just read the code than i have past you? Just with that, i have create that. (and other thing, also, but not for sprite above player)

You are a coder, you need go alone a day ^^.
 
oh, i think i might have confused you, i mean LITERALLY above the player, not above the Player Sprite, it should be HOVERING above the player, like the skull from the ExampleMod, but the Debuff Undead.cs doesnt have anything that helps ._.
 
And yes, you do not understand.

You have just read a small? Why he exist:
public static readonly PlayerLayer MiscEffects

And:
public static readonly PlayerLayer MiscEffectsBack


And why he exist, PreDraw and PostDraw?

You understand now? MiscEffects put above the player, then you decide where you want put the sprite. The MiscEffectsBack put belove the player than you decide where put the sprite.

ExampleMod is ExampleMod, you found all things than you need. (Except new biome)
 
Hello guys! Can someone tell all the DustName's that is used in melee weapons (example the Excalibur's golden dust even its used) for the mod i making? Because im struggling with it! pls help
 
um, i still dont know the code how to make the sprite...
pls put it into my code...
(srry, this is the thing im not very good at, FINDING stuff ._.)

Code:
using Terraria;
using Terraria.ModLoader;
using SacredTools.NPCs;

namespace SacredTools.Buffs
{
    public class PandolarBuff : ModBuff
    {
        public override void SetDefaults()
        {
            Main.buffName[Type] = "Blessing of the Pandolars";
            Main.buffTip[Type] = "the almighty Pandolars gave you a blessing...";
            Main.debuff[Type] = false;
            Main.pvpBuff[Type] = true;
            Main.buffNoSave[Type] = true;
            longerExpertDebuff = false;
        }

        public override void Update(Player player, ref int buffIndex)
        {
            player.lifeRegen += 2;
            player.statLifeMax2 += 50;
            player.magicDamage += 0.15f;
            player.meleeDamage += 0.15f;
            player.rangedDamage += 0.15f;
            player.thrownDamage += 0.15f;
            player.minionDamage += 0.15f;
       
            //Example:
            if (Main.rand.Next(2) == 0)
            {
                int idx= Dust.NewDust(player.position, player.width, player.height, mod.DustType("PandolarDust"));
                Main.dust[idx].noGravity = true;
            }
        }

       
    }
}

the file name for the Sprite is PandolarGod.png and its in the Buffs folder (or does it need to be somewhere else?)
 
um, i still dont know the code how to make the sprite...
pls put it into my code...
(srry, this is the thing im not very good at, FINDING stuff ._.)

Code:
using Terraria;
using Terraria.ModLoader;
using SacredTools.NPCs;

namespace SacredTools.Buffs
{
    public class PandolarBuff : ModBuff
    {
        public override void SetDefaults()
        {
            Main.buffName[Type] = "Blessing of the Pandolars";
            Main.buffTip[Type] = "the almighty Pandolars gave you a blessing...";
            Main.debuff[Type] = false;
            Main.pvpBuff[Type] = true;
            Main.buffNoSave[Type] = true;
            longerExpertDebuff = false;
        }

        public override void Update(Player player, ref int buffIndex)
        {
            player.lifeRegen += 2;
            player.statLifeMax2 += 50;
            player.magicDamage += 0.15f;
            player.meleeDamage += 0.15f;
            player.rangedDamage += 0.15f;
            player.thrownDamage += 0.15f;
            player.minionDamage += 0.15f;

            //Example:
            if (Main.rand.Next(2) == 0)
            {
                int idx= Dust.NewDust(player.position, player.width, player.height, mod.DustType("PandolarDust"));
                Main.dust[idx].noGravity = true;
            }
        }


    }
}

the file name for the Sprite is PandolarGod.png and its in the Buffs folder (or does it need to be somewhere else?)

You need add here a bool like buff Undead.
Then, you go in your modplayer for add this same bool everywhere you found Undead bool in ExamplePlayer
Then, you change MiscEffects where you add your sprite and also, change the position of your sprite.
This is simple, i do not need give the code because all code is in the examplemod.

edit: sorry for my word, i go very fast angry ><

............HELP I cant go to Terrarai it not letting me ???

It keep saying go to steam client but I do that and it still NOT working ;-; HELP!!!!
I do not understand your question.

Heyo, I have a question.
Do I have to create a new map every time I install a mod? ( Talking about the ores and so on )
Thanks
If the mod include ores when you generate the world, yes, you need.
 
Last edited:
uuuuhhhhhhh... ok... ill check dat out later
 
Hello,
I have an error on my ubuntu server (Ole32.dll)
There are an solution to fix this ?

thk
 
How do I make a custom animation for an NPC? I've seen @bluemagic123 say to use FindFrame, but how do I use it?

EDIT: I found out how:
Code:
public override void FindFrame(int frameHeight)
{
npc.frameCounter++;
if (npc.frameCounter >= ##) // Height of frame in pixels
{
npc.frame.Y = (npc.frame.Y + 50);
npc.frameCounter = 0;
}
if (npc.frame.Y >= ###) // the pixel number from top of png of where to end the animation loop
{
npc.frame.Y = 0;
}
}
 
Last edited:
Back
Top Bottom