Standalone [1.3] tModLoader - A Modding API

I think ive nearly been banned from every place on earth now.. just for being very good yet not famous lol. why? does the entire community have a deep inferiority complex or something? is it in the water? I don't get it.
 
I'm pretty sure we fixed that recently. Are you on 0.10.1.4? If so, we'll probably have to revisit our fix.
upload_2018-6-11_19-21-31.png

Yhup.
 
public override void onConsumeAmmo(Player player)
i cant use this,even example mod cant be made up because this,so when can i use it?
 
I appear to be experiencing a rather sudden and confusing error. Not long ago, I crashed while attempting to reproduce a crash involving Magic Storage. Upon reloading Terraria, suddenly TModloader is upset that Secret Dyes, Hair Dye For Armor, and Item Customizer were made for 0.10.1.3 when I am running 0.10.1.4, and automatically disables them. This message continues to pop up whenever I attempt to re-enable them.

Now, this would make sense... Except that I have not updated tModloader or any mods, and they were functioning perfectly fine for multiple weeks beforehand in my install, on this exact same version, and they were the exact same version. I reloaded my mods many times, started Terraria many times, and never got this message before, even earlier today.

Edit: Actually, while I'm here, I have a slight grievance with tModLoader's UI.
When scrolling with my mouse wheel, often the scroll bar will jump wildly down or up, much further than it should, causing me to skip upward of 10 mods when browsing in the Mod Browser, or skipping to the end of my modlist in the Mods UI, instead of scrolling up or down 3 or so mods like it should. This is not an issue with my mouse, as no other program has this issue.
 
Last edited:
were made for 0.10.1.3 when I am running 0.10.1.4
That 'was built for this version' text should be precautinary text that isn't related to the actual error - post whats noted as the 'actual error' text (or a screenshot of the whole thing) here and we could probably tell you whats wrong.
 
Whether I am hosting a game thru the server exe or the game, I have around 3 fps. However, singleplayer is perfectly fine. I have 16 gigs of ram and a Ryzen 5, and I am playing on Windows 7. I realize that this is an old issue, but I've tried everything I've heard so far, and nothing has worked.
 
Hey. I'm having issues with this program. it wont even install it keeps saying that theres no place to install it. its in my terraria folder but it keeps saying the same thing that it cant install im using the most recent version of tModloader and my terraria version is the most recent one too
 
That 'was built for this version' text should be precautinary text that isn't related to the actual error - post whats noted as the 'actual error' text (or a screenshot of the whole thing) here and we could probably tell you whats wrong.
Ah, pardon me. It was late when I wrote that. The message itself is in error, I feel, as nothing in my mod setup, or tModLoader setup, changed at all, yet it suddenly determined these mods (of which the same versions worked fine on 0.10.1.4 for multiple weeks) are incompatible, despite working fine when I was using them earlier that same day, and many days beforehand.
I know it's not technically an error, but the fact that it began suddenly and now refuses to let me enable these mods, the same mods, and same versions of those very mods, that I have been using fine in this same version of tModloader, on this same computer, for weeks, feels like it may be some kind of strange bug. There was some error-like text in the display about not being able to access certain features of tModloader or something as well but I could not get a screenshot at the time.

At the very least, it would be nice to have an "Enable anyway" button, rather than it force-disabling the mods, perhaps with warning text stating it may cause issues if they are enabled in the wrong version.

That said, I cannot screenshot the message now because... I just went to reproduce it again to get a screenshot, and... It worked?
I have absolutely no idea how or why, but I recieved no such message this time, and the mods all enabled without issue, just like they had every time except last night.
Which is arguably even stranger. I'm baffled. Apologies for the waste of time.
 
I'm trying to make a boss with 2 forms. I don't know what to do, or where to start. It already does the spinning animation, because I am using eye of cthulhu AI. All I need is to get the boss to change its look. My code looks like this:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MoreAwesomeStuffpeeps.NPCs.Boss
{
    [AutoloadBossHead]
    public class TheSeer : ModNPC
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("The Seer");
            Main.npcFrameCount[npc.type] = 6;
        }
        public override void SetDefaults()
        {
            npc.aiStyle = 4; //Eye of Cthulhu AI
            npc.lifeMax = 200000;
            npc.damage = 80;
            npc.defense = 30;
            npc.knockBackResist = 0f;
            npc.width = 100;
            npc.height = 110;
            npc.value = 10000;
            npc.npcSlots = 1f;
            npc.boss = true;
            npc.lavaImmune = true;
            npc. noGravity = true;
            npc.noTileCollide = true;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            music = MusicID.Boss1;
            bossBag = mod.ItemType("TheSeerTreasureBag");
        }
        public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
        {
            npc.lifeMax = (int)(npc.lifeMax * 0.500f * bossLifeScale);
            npc.damage = (int)(npc.damage * 0.5f);
            npc.defense = (int)(npc.defense + numPlayers);
        }

        public override void FindFrame(int frameHeight)
        {
            npc.frameCounter += 1.0;
            npc.frameCounter %= 10;
            int frame = (int)(npc.frameCounter / 2.0);
            if (frame >= Main.npcFrameCount[npc.type]) frame = 0;
            npc.frame.Y = frame * frameHeight;
        }
        public override void NPCLoot()
        {
            if (Main.expertMode)
            {
                npc.DropBossBags();
            }
            else
            {
                if (Main.rand.Next(3) == 0)
                {
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LuminiteSlimeSword"));
                }
                else
                {
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialPickaxe"));
                }
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialBar"), 5);
            }
        }
    }
}
I have compiled this code, and it works (except for the second form texture). I just need to get the boss to change its look. I need help. :confused:
Still
 
I have not tried that. I'll try. But I do not know how to use a JSON file. I have only used C# files.
JSON allows you to easily group your keys.
JSON example:
Code:
{
    "ItemName" : {
        "PhantomSword" : "Phantom sword",
        "PhantomStaff" : "Phantom staff"
    },
    "ItemToolTip" : {
        "PhantomSword" : "This is a phantom sword",
        "PhantomStaff" : "This is a phantom staff"
    }
}
LANG example:
Code:
ItemName.PhantomSword=Phantom sword
ItemName.PhantomStaff=Phantom staff
ItemToolTip.PhantomSword=This is a phantom sword
ItemToolTip.PhantomStaff=This is a phantom staff
In addition, terraria itself uses JSON for localization.
 
We decided against json for mods because the syntax is too easily broken. We wanted it to be as easy as possible for non computer savvy translators to contribute translations.

If the grouping bothers you just put a blank line between groups.
 
We decided against json for mods because the syntax is too easily broken. We wanted it to be as easy as possible for non computer savvy translators to contribute translations.
I do not understand. Can you explain to me, why do you think LANG is more convenient for "non computer savvy translators"?

If the grouping bothers you just put a blank line between groups.
...and I still have a few bunches of merged text.

Is it so important to comment your en-US.lang that you are ready to sacrifice convenience? Well then, at least, add the ability to use JSON to those who need it.
 
I do not understand. Can you explain to me, why do you think LANG is more convenient for "non computer savvy translators"?


...and I still have a few bunches of merged text.

Is it so important to comment your en-US.lang that you are ready to sacrifice convenience? Well then, at least, add the ability to use JSON to those who need it.
You can comment json anyway, so that's not it.

Getting the quotes, colon, commas, and curly braces syntactically correct is always a pain.

Anyway, we consulted other modding api and learned that .lang file-type formatting are the norm, so that is another reason.

Another thing is the grouping of keys might be counter-intuitive for most situations. For example, why would you want to force ItemName entries to be separate from ItemToolTip entries? That would just mean that all the info common to an item has to be spread apart really far. With the simpler setup, the modder can decide how they want to group things. Believe me, we discussed the JSON structure for weeks worrying about which structure works best before we decided that it was a bad idea either way.
 
Getting the quotes, colon, commas, and curly braces syntactically correct is always a pain.
Vanila works fine with JSON.
Quotes:
Screenshot_7.png

Colon:
Screenshot_8.png

Commas: wat?
Curly braces:
Screenshot_6.png

As you can see, there are nothing painful (except typing slash before quotes inside string, omg!)

Another thing is the grouping of keys might be counter-intuitive for most situations. For example, why would you want to force ItemName entries to be separate from ItemToolTip entries? That would just mean that all the info common to an item has to be spread apart really far. With the simpler setup, the modder can decide how they want to group things. Believe me, we discussed the JSON structure for weeks worrying about which structure works best before we decided that it was a bad idea either way.
Let me give you an example. We are creating mod about magic. Each spell have it's own name and description. We describe them not as SpellName.ExampleSpell and SpellDescription.ExampleSpell, but as ExampleSpell.SpellName and ExampleSpell.SpellDescription (field is inside class, as it should be). In this case you don't need to separate data about one item into different parts of document.

LANG has more disadvantages than advantages:
  • you can't group items with tabulation;
  • you need to search for '=' to determine where content starts;
  • key and content strings are merged;
  • you need to type same keys many (many) times;
  • there are many programs to easily edit JSON file (even in online), while for LANG I found only a couple of applications of questionable quality;
  • with your implementation there, you also need to break the document into parts of 2 lines each (ItemName + ItemToolTip).
 
Last edited:
Back
Top Bottom