Standalone [1.3] tModLoader - A Modding API

I only found this:
NetMessage.SendData



If you are using a method that had “” as the string parameter, you can just change “” to null.



If you are using MessageID.ChatText, aka “25”, to send a chat string, you need to change it like this:



if (Main.netMode == 0)

{

Main.NewText(Lang.misc[29].Value, 50, 255, 130, false);

}

if (Main.netMode == 2)

{

NetMessage.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130), -1);

}



If you weren’t using a vanilla message, you would first add a ModTranslation in Load and then use that:

Mod.Load:

ModTranslation text = CreateTranslation("VolcanoWarning");

text.SetDefault("Did you hear something....A Volcano! Find Cover!");

AddTranslation(text);

Usage:

string key = "Mods.ExampleMod.VolcanoWarning";

Color messageColor = Color.Orange;

if (Main.netMode == 2) // Server

{

NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);

}

else if (Main.netMode == 0) // Single Player

{

Main.NewText(Language.GetTextValue(key), messageColor);

}

I tried to use .ToNetworkText() after Main.chest[player.chest].name , but it didn't work and now I'm stuck again
That part of the guide contains more information about NetworkText than I do... but I've just had a quick little look myself to see if I can work something out.

.ToNetworkText() will only work on things in the Localization class and cannot be applied directly to a string. I think that something like 'Terraria.Localization.Language.GetText("ItemName." + Main.chest[player.chest].name).ToNetworkText()' may work in place of '
Main.chest[player.chest].name', but I haven't tested this. If all else fails, just use null in all NetMessages instead of a string. I really can't be of any more help.
 
I figured it out, seemed like all i had to do was just copy the files and any that "seemed" to be duplicates, i just raw copied it no execptions and it works ;3
 
Hey! When my friend tries to install mods(Thorium and Tremor), he gets this error (same error with Thorium). I have installed mods successfully at one attempt. What could we do?
IPaWtxZrxAM.jpg
 
Running into the same problem as HyperFlame across numerous mods. Seems like anything can be affected sporadically, but then is just as likely to load correctly and have something else break on the next attempt. I'm even hitting crashes during world creation.
 
Hello, i have a problem where i do not found fix.
When i loading a mod than i have build without error(after try to update to 0.10), Terraria crash without says nothing.

Visual studio say than this is System.NullReferenceException: "Object reference not set to an instance of an object."
Also, on my Visual Studio project, he do not found any errors or warnings for that.

Thank you for listen me.
For know, if a guy know where i have missed the update?

Thank you!
 
The issue i have is I load up fine doing that method but when i join my friend's server it goes through the process again and gives an error like above before all mods are initialized again.
 
ram. And doing 1 at a time is the worst thing you can do. Enable all the ones you want to use, close and reopen terraria for best results.
It's true that restarts help, although this message will crop-up immediately if I'm enabling/disabling/installing/uninstalling any mods -- even without ever getting to play in-game. Restarts are now mandatory if I'm doing anything other than immediately playing the game.

While I have plenty of ram I know the issue of Terraria being a 32-bit program is always a problem while running a lot of mods. But I'm now consistently getting this problem while using only 2 large mods. Back before tMod 0.10, I could run 4+ large mods without ever getting bugs like these. Is Terraria 1.3.5 that much more ram intensive than 1.3.4? Or is there something specifically about tModLoader that makes it harder to run large mods simultaneously than it was before?
 
It's true that restarts help, although this message will crop-up immediately if I'm enabling/disabling/installing/uninstalling any mods -- even without ever getting to play in-game. Restarts are now mandatory if I'm doing anything other than immediately playing the game.

While I have plenty of ram I know the issue of Terraria being a 32-bit program is always a problem while running a lot of mods. But I'm now consistently getting this problem while using only 2 large mods. Back before tMod 0.10, I could run 4+ large mods without ever getting bugs like these. Is Terraria 1.3.5 that much more ram intensive than 1.3.4? Or is there something specifically about tModLoader that makes it harder to run large mods simultaneously than it was before?
The large mods keep adding more music, that's pretty much the whole problem.
 
i'm sure this has been answered before but every time i load a mod it says System.Net.WebException: The remote server returned an error: (503) Server Unavailable. i don't understand what that means, any help would be greatly appreciated, thanks
 
Can anyone help?

I made a mod called Sorcerer's Seceret on a dif computer and published it,but now i have to be on a dif computer,so how do i get my mod back where i don't have to publish it again? am i screwed and do i have to re-publish it?
 
Me , my friend and a lot of other mac users cant create a server. It always get stuck on "starting server" for hours. With out Tmodloader all works just fine. I can join people perfectly fine.

Also TheHyperFlame had the same problem but after some time its gonne. No idea what that was
 
Me , my friend and a lot of other mac users cant create a server. It always get stuck on "starting server" for hours. With out Tmodloader all works just fine. I can join people perfectly fine.

Also TheHyperFlame had the same problem but after some time its gonne. No idea what that was
But I never stucked at server starting...
However, new version of TModLoader has an INSANE amount of errors
 
c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\Buffs\Frostbite.cs(21,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'GetModInfo' and no extension method 'GetModInfo' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\NPCs\NPCsGLOBAL.cs(13,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'GetModInfo' and no extension method 'GetModInfo' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\NPCs\NPCsGLOBAL.cs(18,21) : error CS1061: 'Terraria.NPC' does not contain a definition for 'GetModInfo' and no extension method 'GetModInfo' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

Frostbite
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using JoshuasMod.NPCs;

namespace JoshuasMod.Buffs
{
    public class Frostbite : ModBuff
    {
        public override void SetDefaults()
        {
            DisplayName.SetDefault("Frostbite");
            Main.debuff[Type] = true;
            Main.pvpBuff[Type] = true;
            Main.buffNoSave[Type] = true;
            longerExpertDebuff = true;
        }

        public override void Update(NPC npc, ref int buffIndex)
        {
            npc.GetModInfo<NPCsINFO>(mod).customdebuff = true;
            int num1 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.PinkFlame);
            Main.dust[num1].scale = 2.9f;
            Main.dust[num1].velocity *= 3f;
            Main.dust[num1].noGravity = true;
        }
        public override void Update(Player player, ref int buffIndex)
        {
            player.GetModPlayer<MyPlayer>(mod).customdebuff = true;
            int num1 = Dust.NewDust(player.position, player.width, player.height, DustID.PinkFlame);
            Main.dust[num1].scale = 2.9f;
            Main.dust[num1].velocity *= 3f;
            Main.dust[num1].noGravity = true;
        }

    }
}

NPCsGLOBAL
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoshuasMod.NPCs
{
    public class NPCsGLOBAL : GlobalNPC
    {

        public override void ResetEffects(NPC npc)
        {
            npc.GetModInfo<NPCsINFO>(mod).customdebuff = false;
        }

        public override void UpdateLifeRegen(NPC npc, ref int damage)
        {
            if (npc.GetModInfo<NPCsINFO>(mod).customdebuff)
            {
                npc.lifeRegen -= 30;
                if (damage < 2)
                {
                    damage = 4;
                }
            }
        }
    }
}

Did the tModLoader change "GetModInfo" to something else?
 
Back
Top Bottom