Standalone [1.3] tModLoader - A Modding API

small question about the steam version of TML.
it doesn't seem to handle high DPI settings at all.
with vanilla Terraria i just rightclicked the executable and changed the DPI Settings to "extended" so everything is scaled up, but that same method doesn't work for TML.
obviously i can still use the sliders ingame to adjust the scaling of the UI and the Zoom, but the main menu and everything there is still much smaller than it should be.
Pcrgl1L.jpg
1LsZPWr.jpg
(i put the images inside spoilers because i don't like giant pictures taking up half the screen when just scrolling through a page.)

otherwise it works perfectly fine.
 
I have a question. I've had someone contact me to do a translation of my mod. I like the idea of a translation, but I don't want to just give away the source code of my mod. Is there a way that I could make it easy for someone to make a dependant mod that translates everything in my mod? Thanks.
 
So I've already got an idea of what my issue is from other sources but I wanted to post here and get other people's opinions. So tmodloader runs just fine and smooth and max graphics. When I tried installing the 64 bit version and tried playing the game, even with 0 mods installed my fps dropped to 30-45FPS on the lowest graphics setting. These are my PC's specs, anyone know what the issue may be?
Intel i7-8750H CPU @ 2.20GHz
16GB Ram
64 bit OS Windows 10
GeForce® GTX 1070 with 8GB GDDR5
it may be because your cpu is 2.20 ghz, im not sure because mine is 2.59 ghz, but can go up to 3 ghz, i know terraria is a cpu intensive game which is why i was thinking it could be the cpu
 
So is there a fix for Cursor movement being tied to zoom scale?
 
Have we heard anything about the update yet?
 
How do you download the mod
 
So I've already got an idea of what my issue is from other sources but I wanted to post here and get other people's opinions. So tmodloader runs just fine and smooth and max graphics. When I tried installing the 64 bit version and tried playing the game, even with 0 mods installed my fps dropped to 30-45FPS on the lowest graphics setting. These are my PC's specs, anyone know what the issue may be?
Intel i7-8750H CPU @ 2.20GHz
16GB Ram
64 bit OS Windows 10
GeForce® GTX 1070 with 8GB GDDR5

Sounds like Windows is being silly and is using your Intel cpu's integrated graphics to run the game, a laptop with that spec should be able to max out this game like its nothing.
 
tModLoader has been updated several times since the 1.4 update.
Pretty sure they were asking about the status of the 1.4 update for tModLoader itself.
 
What about on a mobile device?
 
This issue has been getting annoying. Error CS0103: The name 'player' does not exist in the current context. Like, how?

C:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader.IO;
using Terraria.UI;
using Terraria.Utilities;
using NewJourney.Tiles;
using Terraria;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using NewJourney.Projectiles;

namespace NewJourney.NPCs
{
    public class StuffedSlime : ModNPC
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Stuffed Slime");
    }
        public override void SetDefaults()
        {
            npc.width = 20;
            npc.height = 20;
            npc.damage = 6;
            npc.defense = 4;
            npc.lifeMax = 60;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            npc.value = 50f;
            npc.knockBackResist = 1f;
        npc.noGravity = false;
        npc.scale = 1f;
        npc.aiStyle = -1;
        npc.buffImmune[20] = true;
        npc.buffImmune[24] = true;
            Main.npcFrameCount[npc.type] = 2;
            animationType = 535;
        }

        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
        if (spawnInfo.player.ZoneOverworldHeight && Main.dayTime)
           return SpawnCondition.OverworldDaySlime.Chance * 0.1f;
            return SpawnCondition.OverworldNight.Chance * 0.05f;   
        }

        public override void NPCLoot()
        {
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 23, Main.rand.Next(1, 20));
    }

    private const int AI_State_Slot = 0;
    private const int AI_Timer_Slot = 1;
    private const int AI_Shoot_Time_Slot = 2;

    private const int State_Asleep = 0;
    private const int State_Slime = 1;
    private const int State_ShootSlime = 2;

    public float AI_State {
        get => npc.ai[AI_State_Slot];
        set => npc.ai[AI_State_Slot] = value;
    }
    public float AI_Timer {
        get => npc.ai[AI_Timer_Slot];
        set => npc.ai[AI_Timer_Slot] = value;
    }

    public float AI_ShootTime {
        get => npc.ai[AI_Shoot_Time_Slot];
        set => npc.ai[AI_Shoot_Time_Slot] = value;
    }

    public override void AI()
        {
        if (AI_State == State_Asleep) {
            npc.TargetClosest(true);
            if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f) {
                AI_State = State_Slime;
                AI_Timer = 0;
                Main.PlaySound(SoundID.NPCHit1, npc.position);
            }
        }
        else if (AI_State == State_Slime) {
            if (Main.player[npc.target].Distance(npc.Center) < 750f) {
                AI_Timer++;
                if (AI_Timer == 1) {
                    npc.TargetClosest(true);
                    npc.velocity = new Vector2(npc.direction * 2, -2f);
                }
                else if (AI_Timer >= 360) {
                    Vector2 velocity = player.Center - npc.Center;
                    float magnitude = Magnitude(velocity);
                    int type = 468;
                    if (magnitude > 0)
                    {
                        velocity *= 18 / magnitude;
                    }
                    else
                    {
                        velocity = new Vector2(0f, 5f);
                    }
                        Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, mod.ProjectileType("SlimeBall"), 30, 3f, Main.myPlayer, 1, 8);
                        Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, 605, 30, 3f, Main.myPlayer, 4, 4);
                    AI_State = State_ShootSlime;
                    AI_Timer = 0;
                    Main.PlaySound(SoundID.NPCHit1, npc.position);
                }
            }
        }
        else if (AI_State == State_ShootSlime) {
            npc.aiStyle = -1;
            AI_Timer += 1;
            if (AI_Timer == 1 && Main.netMode != NetmodeID.MultiplayerClient) {
                AI_ShootTime = Main.rand.NextBool() ? 150 : 200;
                npc.netUpdate = true;
                Vector2 velocity = player.Center - npc.Center;
                float magnitude = Magnitude(velocity);
                int type = 468;
                if (magnitude > 0)
                {
                    velocity *= 18 / magnitude;
                }
                else
                {
                velocity = new Vector2(0f, 5f);
                }
                Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, mod.ProjectileType("SlimeBall"), 30, 3f, Main.myPlayer, 1, 8);
                Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, 605, 30, 3f, Main.myPlayer, 4, 4);
            }
            if (AI_Timer > AI_ShootTime) {
                AI_State = State_Slime;
                AI_Timer = 0;
                Main.PlaySound(SoundID.NPCHit1, npc.position);
            }
        }
    }
    private const int Frame_Slime_1 = 0;
    private const int Frame_Slime_2 = 1;

    public override void FindFrame(int frameHeight) {
        npc.spriteDirection = npc.direction;
        npc.frameCounter++;
        if (npc.frameCounter < 10) {
            npc.frame.Y = Frame_Slime_1 * frameHeight;
        }
        else if (npc.frameCounter < 20) {
            npc.frame.Y = Frame_Slime_2 * frameHeight;
        }
        else {
            npc.frameCounter = 0;
        }
    }
    }
}
Apparently, the code doesn't like it when I replace 'player' with 'Player', because it gives me another error. Error CS0120: An object reference was required for the non-static field, method, or property, 'Entity.Center'

And just in case you are asking: Yes, I have had this issue a few times before.
 
This issue has been getting annoying. Error CS0103: The name 'player' does not exist in the current context. Like, how?

C:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader.IO;
using Terraria.UI;
using Terraria.Utilities;
using NewJourney.Tiles;
using Terraria;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using NewJourney.Projectiles;

namespace NewJourney.NPCs
{
    public class StuffedSlime : ModNPC
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Stuffed Slime");
    }
        public override void SetDefaults()
        {
            npc.width = 20;
            npc.height = 20;
            npc.damage = 6;
            npc.defense = 4;
            npc.lifeMax = 60;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            npc.value = 50f;
            npc.knockBackResist = 1f;
        npc.noGravity = false;
        npc.scale = 1f;
        npc.aiStyle = -1;
        npc.buffImmune[20] = true;
        npc.buffImmune[24] = true;
            Main.npcFrameCount[npc.type] = 2;
            animationType = 535;
        }

        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
        if (spawnInfo.player.ZoneOverworldHeight && Main.dayTime)
           return SpawnCondition.OverworldDaySlime.Chance * 0.1f;
            return SpawnCondition.OverworldNight.Chance * 0.05f;  
        }

        public override void NPCLoot()
        {
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 23, Main.rand.Next(1, 20));
    }

    private const int AI_State_Slot = 0;
    private const int AI_Timer_Slot = 1;
    private const int AI_Shoot_Time_Slot = 2;

    private const int State_Asleep = 0;
    private const int State_Slime = 1;
    private const int State_ShootSlime = 2;

    public float AI_State {
        get => npc.ai[AI_State_Slot];
        set => npc.ai[AI_State_Slot] = value;
    }
    public float AI_Timer {
        get => npc.ai[AI_Timer_Slot];
        set => npc.ai[AI_Timer_Slot] = value;
    }

    public float AI_ShootTime {
        get => npc.ai[AI_Shoot_Time_Slot];
        set => npc.ai[AI_Shoot_Time_Slot] = value;
    }

    public override void AI()
        {
        if (AI_State == State_Asleep) {
            npc.TargetClosest(true);
            if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f) {
                AI_State = State_Slime;
                AI_Timer = 0;
                Main.PlaySound(SoundID.NPCHit1, npc.position);
            }
        }
        else if (AI_State == State_Slime) {
            if (Main.player[npc.target].Distance(npc.Center) < 750f) {
                AI_Timer++;
                if (AI_Timer == 1) {
                    npc.TargetClosest(true);
                    npc.velocity = new Vector2(npc.direction * 2, -2f);
                }
                else if (AI_Timer >= 360) {
                    Vector2 velocity = player.Center - npc.Center;
                    float magnitude = Magnitude(velocity);
                    int type = 468;
                    if (magnitude > 0)
                    {
                        velocity *= 18 / magnitude;
                    }
                    else
                    {
                        velocity = new Vector2(0f, 5f);
                    }
                        Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, mod.ProjectileType("SlimeBall"), 30, 3f, Main.myPlayer, 1, 8);
                        Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, 605, 30, 3f, Main.myPlayer, 4, 4);
                    AI_State = State_ShootSlime;
                    AI_Timer = 0;
                    Main.PlaySound(SoundID.NPCHit1, npc.position);
                }
            }
        }
        else if (AI_State == State_ShootSlime) {
            npc.aiStyle = -1;
            AI_Timer += 1;
            if (AI_Timer == 1 && Main.netMode != NetmodeID.MultiplayerClient) {
                AI_ShootTime = Main.rand.NextBool() ? 150 : 200;
                npc.netUpdate = true;
                Vector2 velocity = player.Center - npc.Center;
                float magnitude = Magnitude(velocity);
                int type = 468;
                if (magnitude > 0)
                {
                    velocity *= 18 / magnitude;
                }
                else
                {
                velocity = new Vector2(0f, 5f);
                }
                Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, mod.ProjectileType("SlimeBall"), 30, 3f, Main.myPlayer, 1, 8);
                Projectile.NewProjectile((int)npc.position.X, (int)npc.position.Y, 0, -1, 605, 30, 3f, Main.myPlayer, 4, 4);
            }
            if (AI_Timer > AI_ShootTime) {
                AI_State = State_Slime;
                AI_Timer = 0;
                Main.PlaySound(SoundID.NPCHit1, npc.position);
            }
        }
    }
    private const int Frame_Slime_1 = 0;
    private const int Frame_Slime_2 = 1;

    public override void FindFrame(int frameHeight) {
        npc.spriteDirection = npc.direction;
        npc.frameCounter++;
        if (npc.frameCounter < 10) {
            npc.frame.Y = Frame_Slime_1 * frameHeight;
        }
        else if (npc.frameCounter < 20) {
            npc.frame.Y = Frame_Slime_2 * frameHeight;
        }
        else {
            npc.frameCounter = 0;
        }
    }
    }
}
Apparently, the code doesn't like it when I replace 'player' with 'Player', because it gives me another error. Error CS0120: An object reference was required for the non-static field, method, or property, 'Entity.Center'

And just in case you are asking: Yes, I have had this issue a few times before.
Looking through your code, you have several different references to player. Main.player[npc.target] and player.Center. Main.player[npc.target] is a reference to a specific player in the player array, but player.Center has nothing before it to say which player is being targeted. I don't know exactly what all of your code is for, but you may want to use Main.player[npc.target].Center.
 
hi Jofairden
Tmodloader browser is down for me when i click download on a mod it show that its downloading then it just returns to the browser.

i think it has something to do with my computer running off of Ubuntu Linux

i've tried re-installing Tmodloader but it doesn't work

do you know why its not working?
 
Anybody know how to make an item have a chance to place different tiles? I want to make a watermelon that can place 4 different tiles, all are watermelon. I'd greatly appreciate any help that is sent!
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace NewJourney.Items.Placeable
{
    public class Watermelon : ModItem
    {
        public override void SetStaticDefaults()
        {
            ItemID.Sets.SortingPriorityMaterials[item.type] = 58;
            DisplayName.SetDefault("Watermelon");
            Tooltip.SetDefault("");
        }

        public override void SetDefaults()
        {
            item.useStyle = ItemUseStyleID.SwingThrow;
            item.useTurn = true;
            item.useAnimation = 15;
            item.useTime = 10;
            item.autoReuse = true;
            item.maxStack = 999;
            item.consumable = true;
            item.width = 12;
            item.height = 12;
            item.value = 3000;
            item.rare = 1;
            if (Main.rand.NextBool(4)) {
                item.createTile = TileType<Tiles.WatermelonTile1>();
            }
            else if (Main.rand.NextBool(4)) {
                item.createTile = TileType<Tiles.WatermelonTile2>();
            }
            else if (Main.rand.NextBool(4)) {
                item.createTile = TileType<Tiles.WatermelonTile3>();
            }
            else if (Main.rand.NextBool(4)) {
                item.createTile = TileType<Tiles.WatermelonTile4>();
            }
        }
    }
}
I believe I need something more complicated then just that...
 
I checked the github for new releases and it says tmodloader has been updated for 1.4 on steam, but when I launch tmodloader on steam it says 1.3.5.3. Any reason why?
 
I checked the github for new releases and it says tmodloader has been updated for 1.4 on steam, but when I launch tmodloader on steam it says 1.3.5.3. Any reason why?
It never said that it was updated to 1.4. Please re-read what it said.
 
I checked the github for new releases and it says tmodloader has been updated for 1.4 on steam, but when I launch tmodloader on steam it says 1.3.5.3. Any reason why?
z4ho84U.png
 
Back
Top Bottom