Standalone [1.3] tModLoader - A Modding API

Never mind this won't work because you need to set the permission to run this file and i don't know how to automate that.

PS. I don't think Mac version can build mods. Log says its looking for mono files that even though I have mono installed. Cant build example mod or very simple 1 item mods i made to test it.
If that happens on a Mac, what you'll have to do is compile your mod into a dll file by yourself, then in build.txt set noCompile to true and include your dll file in the folder instead of your code. (That's actually the reason I added support for building dll files into mods.)
 
So I need some help. I got the
Code:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
error and since I'm new to coding I have no idea on how to fix this error. I have the sprite in the same folder but I just can't figure out how to get it to work.
 
So I need some help. I got the
Code:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
error and since I'm new to coding I have no idea on how to fix this error. I have the sprite in the same folder but I just can't figure out how to get it to work.
Need the whole error to give an accurate solution, I think.
 
I fixed my mac installer its now a automator .app that uses applescript to call upon shell scripts to check if mono is installed. If mono is installed it opens up the installer by using the terminal command if it isn't installed it shows a dialogue window with a link to the download page for mono.

Here are screenshots:
1wUw27F.png

lK0ocvU.png
 

Attachments

  • tMod.zip
    1.7 MB · Views: 117
Last edited:
Hate to pile on the mountain of questions here, but I get a "no method to override" when I try drawHair.
9mUFRAv.png

Code:
public override void DrawHair(Item item, ref bool drawHair, ref bool drawAltHair) {
        drawHair = true;
        }

Then there's the fact that I'm not sure if I'm using this right
 
Hate to pile on the mountain of questions here, but I get a "no method to override" when I try drawHair.
9mUFRAv.png

Code:
public override void DrawHair(Item item, ref bool drawHair, ref bool drawAltHair) {
        drawHair = true;
        }

Then there's the fact that I'm not sure if I'm using this right
The correct function to override would be:
Code:
public override void DrawHair(ref bool drawHair, ref bool drawAltHair)
So without the Item.
 
  • Like
Reactions: Qw2
Are you trying to shoot a projectile with an item, ex. a spell? If so, in SetDefaults(), just add

Code:
item.shoot = mod.ProjectileType("MyProjectile");

for a projectile in your mod or

Code:
item.shoot = <x>;

for a projectile in vanilla.
thanks! I'll use it!
I need 1 more help;
is this timer ok?
Code:
TimeSpan.FromMilliseconds(100);
 
Depends on what you're trying to do with it and where you're calling it?
my entire code:
Code:
using System;
using System.Windows.Input;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Trekko727Mod.Items
{
    public class SASKnife : ModItem
    {

        int stylenumber = 1;
        public override void SetDefaults()
        {
            item.name = "SAS Knife";
            item.damage = 35;
            item.melee = true;
            item.width = 36;
            item.height = 36;
            item.position.Y = 2;
            item.toolTip = "This is a modded sword.";
            item.useTime = 18;
            item.useAnimation = 20;
            item.useStyle = stylenumber;
            item.knockBack = 6;
            item.value = 10000;
            item.channel = true;
            item.rare = 2;
            item.useSound = 1;
            item.autoReuse = false;
            }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
        public override void UseStyle(Player player)
        {
                int counter = 0; //charge-up counter
                int Power = 6; //projectile speed
                int counterLimit = 10; //say every "charge" is per 0.1 sec which makes the limit to 1 second (full charge)
                //int PenBase = 3; //defense reduction
                if (counter > 1 && item.channel == true)
                {
                    stylenumber = 4;
                    } else if (counter >10 && item.channel == true){
                    stylenumber = 5;
                    item.shootSpeed = Power;
                    item.
                    item.shoot = mod.ProjectileType("SASKnife");
                    } else if (item.channel == true){
                        if (counter < counterLimit)
                        {
                            TimeSpan.FromMilliseconds(100);
                            Power++;
                            counter++;
                        }
                    } else {
                    stylenumber = 1;
                }
        }
    }
}
its purpose is to wait for 0.1s then adding counter +1 and Power +1 to "charge" the the speed of the knife
EDIT: I want to add the "aiStyle" for the knife and idk how
 
Ok here is the error I got when trying to load it
Missing texture Pletharia_Plus/Items/Weapons/SaberOfTraitors
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
my entire code:
Code:
using System;
using System.Windows.Input;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Trekko727Mod.Items
{
    public class SASKnife : ModItem
    {

        int stylenumber = 1;
        public override void SetDefaults()
        {
            item.name = "SAS Knife";
            item.damage = 35;
            item.melee = true;
            item.width = 36;
            item.height = 36;
            item.position.Y = 2;
            item.toolTip = "This is a modded sword.";
            item.useTime = 18;
            item.useAnimation = 20;
            item.useStyle = stylenumber;
            item.knockBack = 6;
            item.value = 10000;
            item.channel = true;
            item.rare = 2;
            item.useSound = 1;
            item.autoReuse = false;
            }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
        public override void UseStyle(Player player)
        {
                int counter = 0; //charge-up counter
                int Power = 6; //projectile speed
                int counterLimit = 10; //say every "charge" is per 0.1 sec which makes the limit to 1 second (full charge)
                //int PenBase = 3; //defense reduction
                if (counter > 1 && item.channel == true)
                {
                    stylenumber = 4;
                    } else if (counter >10 && item.channel == true){
                    stylenumber = 5;
                    item.shootSpeed = Power;
                    item.
                    item.shoot = mod.ProjectileType("SASKnife");
                    } else if (item.channel == true){
                        if (counter < counterLimit)
                        {
                            TimeSpan.FromMilliseconds(100);
                            Power++;
                            counter++;
                        }
                    } else {
                    stylenumber = 1;
                }
        }
    }
}
its purpose is to wait for 0.1s then adding counter +1 and Power +1 to "charge" the the speed of the knife
EDIT: I want to add the "aiStyle" for the knife and idk how
My lucky guess is that that's not going to work anyways, since you're setting 'counter' in the function to 0, so if you add a value to it, the value will be 0 on the next update once again. If I were you, I'd make a plan (on how to go about what you're trying to do) on paper or something first. That'll save you a lot of brain aches.
Anyway, if you want it to wait for a set amount of time, do not use TimeSpan...
Just make a value and add to it every tick, then look if it's larger than the value you want ('6' in this case would be 0.1 second).

Ok here is the error I got when trying to load it
Missing texture Pletharia_Plus/Items/Weapons/SaberOfTraitors
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
You've probably misplaced the texture or named it wrong. Is your texture called 'SaberOfTraitors.png' and does it correspond with the namespace of your item?
 
Last edited:
You've probably misplaced the texture or named it wrong. If your texture called 'SaberOfTraitors.png' and does it correspond with the namespace of your item
Yeah I've got SaberOfTraitors.png and SaberOfTraitors.cs in my folder.
 
Also, can someone show how to use the AI() method to mimic the bosses already in Terraria rather than using aiStyle field? I would use it to make some bosses very similar to real bosses. (I need Eye of Cuthulu, Retinizer, and Spazmatism, but providing others would be nice, and posting it to the public)

If that could be done, that would be great!
The problem with that is, that's the part where people are supposed to be skilled (not just knowledgeable) about programming.

I want to set the axe power of a tool to 140. When I enter 140, it says on the item its 300 or something. Help me...
For some reason Terraria multiplies axe power by 5 or something like this. The vanilla axes account for this, so you'll have to account for this too.
 
The problem with that is, that's the part where people are supposed to be skilled (not just knowledgeable) about programming.


For some reason Terraria multiplies axe power by 5 or something like this. The vanilla axes account for this, so you'll have to account for this too.
140 / 5 is 28. If I enter 28, will it actually have 140? Or will it have 28 but the item says 140?
 
Back
Top Bottom