Standalone [1.3] tModLoader - A Modding API

So...One of the main reasons I still play terraria is to display armor seta in mannequins and stuff like that, creating a big display room for my character's collection. It's very frustrating that some modded itens don't work on their display furniture so I was thinking if it's possible within tmodloader to create a modded working mannequin ou weapon rack that could be used as a replacement for vanilla ones. I have made a couple mods but am not an expert so any help ou direction would be very much appreciated. Sorry about my English btw, hope it's understandable
 
This is probably a dumb question but how do I make a boss summoning item spawn the boss in front of the player?

The code has changed since the last time I've done this so thats why I'm asking this.
 
Thank you so much!i!
Fair warning, that version had to have massive changes to allow for 64 bit compatability, and as such has numerous issues with many mods at the moment. Be careful what you install, and don't expect a lot of help for any bugs you encounter from mod authors while using it.
 
I have these bugs:

c:\Users\I decided to hide my irl name here.\Documents\My Games\Terraria\ModLoader\Mod Sources\testingmod\Items\Suspicious Looking Electric Cube.cs(5,22) : error CS1514: { expected!

Code is this:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Suspicious Looking Electric Cube.Items // Changed from my mod name to this due to bug, stopped getting the bug
{
    public class ItemName : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Suspicious Looking Cube";
            item.width = 100;
            item.height = 100;
            item.maxStack = 10;
            AddTooltip("Summons Cube Bunk");
            item.value = 5000;
            item.rare = 1;
        }
    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(ItemID.DirtBlock, 10);
        recipe.AddTile(TileID.WorkBenches);
        recipe.SetResult(this);
        recipe.AddRecipe()
        }
    }
}
 
I have these bugs:

c:\Users\I decided to hide my irl name here.\Documents\My Games\Terraria\ModLoader\Mod Sources\testingmod\Items\Suspicious Looking Electric Cube.cs(5,22) : error CS1514: { expected!

Code is this:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Suspicious Looking Electric Cube.Items // Changed from my mod name to this due to bug, stopped getting the bug
{
    public class ItemName : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Suspicious Looking Cube";
            item.width = 100;
            item.height = 100;
            item.maxStack = 10;
            AddTooltip("Summons Cube Bunk");
            item.value = 5000;
            item.rare = 1;
        }
    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(ItemID.DirtBlock, 10);
        recipe.AddTile(TileID.WorkBenches);
        recipe.SetResult(this);
        recipe.AddRecipe()
        }
    }
}

I realised that there cant be spaces due to where it expected {
[doublepost=1549904078,1549903553][/doublepost]c:\Users\[SENSITIVE INFORMATION]\Documents\My Games\Terraria\ModLoader\Mod Sources\testingmod\Items\Suspicious Looking Electric Cube.cs(10,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
[doublepost=1549904138][/doublepost]i have that bug for no apparent reason.

i used a modding tutorial for help, same exact code style, and i have an error.
 
I realised that there cant be spaces due to where it expected {
[doublepost=1549904078,1549903553][/doublepost]c:\Users\[SENSITIVE INFORMATION]\Documents\My Games\Terraria\ModLoader\Mod Sources\testingmod\Items\Suspicious Looking Electric Cube.cs(10,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
[doublepost=1549904138][/doublepost]i have that bug for no apparent reason.

i used a modding tutorial for help, same exact code style, and i have an error.
I think that the code is invalid,
Code:
    public class NAME: ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("NAME");
            Tooltip.SetDefault("ITEMTOOLTIP");
        }

        public override void SetDefaults()
        {
            item.whatever
        }
If that doesn't fix it try adding using Microsoft.Xna.Framework; to the top of the code
 
Is there a way to make an enemy spawn after a boss from my mod is killed? For example a line reading "if(downedKingSlime = true; ) ..." but instead checks if a boss from my mod has been downed instead. Thanks in advance.
 
Last edited:
using Terraria;
using Terraria.ModLoader;
using System;

namespace Hypaxi
{
public abstract class InsanityItem : ModItem
{
public static bool insanity = true;
public override void SetDefaults()
{
item.melee = false;
item.ranged = false;
item.thrown = false;
item.magic = false;
item.summon = false;
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
var tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
if (tt != null)
{
string[] split = tt.text.Split(' ');
tt.text = split.First() + " insanity " + split.Last();
}
}
public override void GetWeaponDamage(Player player, ref int damage)
{
HypaxiPlayer modPlayer = player.GetModPlayer<HypaxiPlayer>(mod);
int originalDamage = damage;
damage = (int)(damage * modPlayer.insanityDamage);
float globalDmg = 1f;
globalDmg = player.meleeDamage - 1;
if (player.magicDamage - 1 < globalDmg)
globalDmg = player.magicDamage - 1;
if (player.rangedDamage - 1 < globalDmg)
globalDmg = player.rangedDamage - 1;
if (player.thrownDamage - 1 < globalDmg)
globalDmg = player.thrownDamage - 1;
if (player.minionDamage - 1 < globalDmg)
globalDmg = player.minionDamage - 1;
if (globalDmg > 1)
damage = damage + (int)(originalDamage * globalDmg);
}
}
}


(18,37) : error CS0246: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

Can someone help me I am making a new damage type and I do not know how to fix this?
 
Is there a way to make an enemy spawn after a boss from my mod is killed? For example a line reading "if(downedKingSlime = true; ) ..." but instead checks if a boss from my mod has been downed instead. Thanks in advance.
You would probably need to create a ModWorld class (if you don't have one already) and create a bool there that stores whether or not your boss has been killed. You can check against that bool before spawning your NPC. You'll need to use override void save and override void load to save this bool between sessions.

using Terraria;
using Terraria.ModLoader;
using System;

namespace Hypaxi
{
public abstract class InsanityItem : ModItem
{
public static bool insanity = true;
public override void SetDefaults()
{
item.melee = false;
item.ranged = false;
item.thrown = false;
item.magic = false;
item.summon = false;
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
var tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
if (tt != null)
{
string[] split = tt.text.Split(' ');
tt.text = split.First() + " insanity " + split.Last();
}
}
public override void GetWeaponDamage(Player player, ref int damage)
{
HypaxiPlayer modPlayer = player.GetModPlayer<HypaxiPlayer>(mod);
int originalDamage = damage;
damage = (int)(damage * modPlayer.insanityDamage);
float globalDmg = 1f;
globalDmg = player.meleeDamage - 1;
if (player.magicDamage - 1 < globalDmg)
globalDmg = player.magicDamage - 1;
if (player.rangedDamage - 1 < globalDmg)
globalDmg = player.rangedDamage - 1;
if (player.thrownDamage - 1 < globalDmg)
globalDmg = player.thrownDamage - 1;
if (player.minionDamage - 1 < globalDmg)
globalDmg = player.minionDamage - 1;
if (globalDmg > 1)
damage = damage + (int)(originalDamage * globalDmg);
}
}
}


(18,37) : error CS0246: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

Can someone help me I am making a new damage type and I do not know how to fix this?
I believe that you need to add using System.Collections.Generic to the other using statements. That way, the class will know what a list is.
 
Hello , thx for your work ^^

i curretly collect (atleast try) every Dev set , and i've notice some are from Tmodloader ,so where can i find the complet list of Tmodloader dev Set please ?

For now i've these one :
ed80b06d55a5e728c5138b86cd3e3e70.png

So :
-Kittykitcatcat
-dinidini
-Polyblank
-toplayz
 
Hi,I have problem when compiling a mod.
Here the .cs files and compile log.Sorry for my english because i'm a russian.
 

Attachments

  • shortswordStalkersKnife.cs
    1.4 KB · Views: 135
  • Ztalker.cs
    2.8 KB · Views: 139
  • Compile Errors.txt
    5.1 KB · Views: 146
Hi,I have problem when compiling a mod.
Here the .cs files and compile log.Sorry for my english because i'm a russian.
There are a lot of errors that come from a few things. On the shortsword code, uncomment the
Code:
public override void AddRecipes()
line and then add a closing bracket after the
Code:
recipe.AddRecipe();
line. For the Ztalker you have to comment out the last two closing brackets. If you arent using visual studio to code you should try it out. It helps alot for simple errors like these. If you are using it then you should figure out why it isnt pointing these errors out to you.
[doublepost=1552086574,1552086346][/doublepost]
Hi,I have problem when compiling a mod.
Here the .cs files and compile log.Sorry for my english because i'm a russian.
Also, the majority of errors are coming from a file called "ExamplePerson.cs" but you upload the file and i cant read the russian compile errors so i cant really help you out there.
 
Back
Top Bottom