tModLoader Official tModLoader Help Thread

I did both ways and they never worked. With the mod content it says I cant convert from float to Microsoft.Xna.Framework.Vector2

using Beskil.Items.Accesories;
using Beskil.Projectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;

namespace Beskil
{


public class BeskilPlayer : ModPlayer
{

public bool BrainBand;

public override void UpdateBadLifeRegen()
{
if (BrainBand){

Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<CreeperBand>());
}
}

public override void ResetEffects()
{
BrainBand = false;
}
}
}



using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Beskil.Projectiles;
using Beskil;

namespace Beskil.Items.Accesories
{
public class BrainBand : ModItem
{

public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brain Band");
Tooltip.SetDefault("Shoots little Creepers");
}

public override void SetDefaults()
{
item.width = 28;
item.height = 20;
item.value = 0;
item.rare = -12;
item.accessory = true;
item.defense = 4;
}

public override void UpdateAccessory(Player player, bool hideVisual)
{
player.GetBeskilPlayer().BrainBand = true;
}
}
}
 
Then I cant really help you, like I said I havent tested this before and Im not all knowing either
The example mod has a very good example for something like this or you could just look through the terraria code.
If you were to look through the code of terrria i still recommend looking at the code of the volatile gelatin.
Your error isnt the worst error you couldve gotten and I could probably fix it with enough time.
But I dont have the time.
I wish you good luck in future projects and hope that you find a solution.
If you have a question about the extrcation of terraria you can ask me.
 
Is there a way to have an item apply a debuff to all enemies currently on screen? Or is it not possible without using projectiles or something that will touch the mob?
 
I did both ways and they never worked. With the mod content it says I cant convert from float to Microsoft.Xna.Framework.Vector2

using Beskil.Items.Accesories;
using Beskil.Projectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;

namespace Beskil
{


public class BeskilPlayer : ModPlayer
{

public bool BrainBand;

public override void UpdateBadLifeRegen()
{
if (BrainBand){

Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<CreeperBand>());
}
}

public override void ResetEffects()
{
BrainBand = false;
}
}
}



using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Beskil.Projectiles;
using Beskil;

namespace Beskil.Items.Accesories
{
public class BrainBand : ModItem
{

public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brain Band");
Tooltip.SetDefault("Shoots little Creepers");
}

public override void SetDefaults()
{
item.width = 28;
item.height = 20;
item.value = 0;
item.rare = -12;
item.accessory = true;
item.defense = 4;
}

public override void UpdateAccessory(Player player, bool hideVisual)
{
player.GetBeskilPlayer().BrainBand = true;
}
}
}
I could be wrong but I think I see the problem. Where you have this,
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<CreeperBand>());
put this instead,
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<CreeperBand>(), 0, 0);
I hope that works.
 
Seems theres still no support for packed files?
Or is there a way to build with a text/json file and have access to it even in the sideloaded state? (since Path becomes relative to steam)

Theres an ungodly amount of clutter appearing, or will appear in the future and since its all clutter caused by constructed objects I would prefer to be able to have the data stored, load it up, loop through, construct, done.
The only solution I have seen is to have a file saved in the Main.SavePath which isn't great if you want the file to already have something...
I could do a simple json database with REST but that might be overkill, and I'd also need to accommodate for lack of internet connection; other than writing to Main.SavePath.
 
Seems theres still no support for packed files?
Or is there a way to build with a text/json file and have access to it even in the sideloaded state? (since Path becomes relative to steam)

Theres an ungodly amount of clutter appearing, or will appear in the future and since its all clutter caused by constructed objects I would prefer to be able to have the data stored, load it up, loop through, construct, done.
The only solution I have seen is to have a file saved in the Main.SavePath which isn't great if you want the file to already have something...
I could do a simple json database with REST but that might be overkill, and I'd also need to accommodate for lack of internet connection; other than writing to Main.SavePath.

Are you talking about files within a packaged .tmod file, such as a json or txt file you as a modder can use? Or something that gets externally saved to Main.SavePath for the purpose of persistency? Both things are possible, the former is as easy as using the Mod.GetFileBytes method
 
Are you talking about files within a packaged .tmod file, such as a json or txt file you as a modder can use? Or something that gets externally saved to Main.SavePath for the purpose of persistency? Both things are possible, the former is as easy as using the Mod.GetFileBytes method

Ah GetFileBytes was what I wanted, but was confused when checking if the file existed and it said no ¬¬
 
Last edited:
Hey, I've started developing mods not so long ago. I've always been typing down everything by myself.
Can someone tell me how to show the code list thing?
Thank you in advance

EDIT: I found it by myself no need to answer me anymore
EDIT 2: Nevermind, it doesn't work
 
Last edited:
I am asking here:

So, i'm currently making a mod which adds "Necromanced" versions of the vanilla bosses.
But the only technique I know to give them the vanilla AIs is to set the aiType to the vanilla bosses ai types.
But doing so, I can't set a proper loot table for them to use.

Can anyone help me with that?
Thank you in advance.

(In case you need it, here is the code from my eye of cthulhu class)

C#:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using NecromancedBosses.NPCs;

namespace NecromancedBosses.NPCs.NecromancedEOC {

    [AutoloadBossHead]
    public class NecromancedEOC : ModNPC {

        public override void SetStaticDefaults() {
            DisplayName.SetDefault("Necromanced Eye of Cthulhu");
            Main.npcFrameCount[npc.type] = 6;
        }

        public override void SetDefaults() {
            npc.width = 100;
            npc.height = 110;
            npc.aiStyle = 4;
            npc.damage = 45;
            npc.defense = 36;
            npc.lifeMax = 14000;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            npc.knockBackResist = 0f;
            npc.noGravity = true;
            npc.noTileCollide = true;
            npc.boss = true;
            npc.value = 30000f;
            aiType = 4;
        }

        public override void ScaleExpertStats(int numPlayers, float bosslifeScale) {
            npc.lifeMax = (int)(npc.lifeMax * 0.625f * bosslifeScale);
            npc.damage = (int)(npc.damage * 0.6f);
        }

        public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) {
            scale = 1.5f;
            return null;
        }

        public override void NPCLoot() {
            if (NecromancedNPCs.DownedNEOCBoss) {
                if (Main.expertMode) {
                    npc.DropBossBags();
                } else {
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<Items.NecromancedSoul>(), 9);
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldCoin, 5);
                }
            }
        }
    }
}
 
I am asking here:

So, i'm currently making a mod which adds "Necromanced" versions of the vanilla bosses.
But the only technique I know to give them the vanilla AIs is to set the aiType to the vanilla bosses ai types.
But doing so, I can't set a proper loot table for them to use.

Can anyone help me with that?
Thank you in advance.

You need to set bossBag for DropBossBags to do something, since your boss isn't a carbon copy its just a shell, you can make custom boss bags and have whatever drop in there as well as your extra items.
 
Heyo all I don't suppose anyone could help me with this error?
I'm on Linux btw in case that's relevant

Parameter name: document
System.ArgumentNullException: Value cannot be null.
Parameter name: document
at Mono.Cecil.Cil.SequencePoint..ctor (Int32 offset, Document document) [0x00009] in data-0x7f6538f1d010
at Mono.Cecil.SignatureReader.ReadSequencePoints (Document document) [0x000f9] in data-0x7f6538f1d010
at Mono.Cecil.MetadataReader.ReadSequencePoints (MethodDefinition method) [0x0004e] in data-0x7f6538f1d010
at Mono.Cecil.Cil.PortablePdbReader.ReadSequencePoints (MethodDebugInformation method_info) [0x00000] in data-0x7f6538f1d010
at Mono.Cecil.Cil.PortablePdbReader.Read (MethodDefinition method) [0x00007] in data-0x7f6538f1d010
at Mono.Cecil.ImmediateModuleReader.ReadMethodsSymbols (TypeDefinition type, ISymbolReader symbol_reader) [0x0003d] in data-0x7f6538f1d010
at Mono.Cecil.ImmediateModuleReader.ReadTypesSymbols (Collection[T] types, ISymbolReader symbol_reader) [0x00029] in data-0x7f6538f1d010
at Mono.Cecil.ImmediateModuleReader.ReadSymbols (ModuleDefinition module) [0x00010] in data-0x7f6538f1d010
at Mono.Cecil.ModuleWriter.Write (ModuleDefinition module, Disposable[T] stream, WriterParameters parameters) [0x00039] in data-0x7f6538f1d010
at Mono.Cecil.ModuleWriter.WriteModule (ModuleDefinition module, Disposable[T] stream, WriterParameters parameters) [0x00002] in data-0x7f6538f1d010
at Mono.Cecil.ModuleDefinition.Write (String fileName, WriterParameters parameters) [0x00017] in data-0x7f6538f1d010
at Mono.Cecil.AssemblyDefinition.Write (String fileName, WriterParameters parameters) [0x00000] in data-0x7f6538f1d010
at Terraria.ModLoader.Core.ModCompile.BuildModForPlatform (BuildingMod mod, Boolean xna) [0x0025d] in tModLoader.exe
at Terraria.ModLoader.Core.ModCompile.Build (BuildingMod mod) [0x000d0] in tModLoader.exe
at Terraria.ModLoader.Core.ModCompile.Build (String modFolder) [0x00008] in tModLoader.exe
at Terraria.ModLoader.UI.UIBuildMod+<>c__DisplayClass5_0.<Build>b__0 (ModCompile mc) [0x00000] in tModLoader.exe
at Terraria.ModLoader.UI.UIBuildMod.BuildMod (Action[T] buildAction, Boolean reload) [0x0003a] in tModLoader.exe
 
Are you talking about files within a packaged .tmod file, such as a json or txt file you as a modder can use? Or something that gets externally saved to Main.SavePath for the purpose of persistency? Both things are possible, the former is as easy as using the Mod.GetFileBytes method
Got another one for you, is it possible to get ALL files in a specific directory?
Similar to Directory.GetFiles, just to reduce named searches.
 
Hello everyone, could one of y'all kind folk please help me with a problem I'm having installing Tmodloader 0.11.8.1 64 bit. (I have GoG)
I did everything as instructed and got this error:

3/9/2021 8:38:27 PM

System.DllNotFoundException: Unable to load DLL 'soft_oal.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

at Microsoft.Xna.Framework.SDL2_FNAPlatform.CreateALDevice()

at Microsoft.Xna.Framework.Audio.AudioDevice.Initialize()

at Microsoft.Xna.Framework.FrameworkDispatcher.Update()

at
Microsoft.Xna.Framework.Game..ctor()

at Terraria.Main..ctor()

at Terraria.Program.LaunchGame_()


Note: Tmodloader 32bit works just fine, aside from memory problems of course.
Please help.
 
My god i have almost the exact same error
 

Attachments

  • 20210310_151856.jpg
    20210310_151856.jpg
    3.3 MB · Views: 116
Sorry Im still learning how to code and I just cant figure out how to call the liquidType inside KillTile, if you can show me that would be great but no need to force yourself
 
Sorry Im still learning how to code and I just cant figure out how to call the liquidType inside KillTile, if you can show me that would be great but no need to force yourself
Tile tile = Main.tile[i, j];
tile.liquidType(Tile.Liquid_Water);
tile.liquid = 255;
 
Back
Top Bottom