tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Upon launching tAPI, it crashes, giving
Problem Event Name: CLR20r3
Problem Signature 01: tapi.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 543c72aa
Problem Signature 04: tAPI
Problem Signature 05: 1.0.0.0
Problem Signature 06: 543c72aa
Problem Signature 07: 8d5
Problem Signature 08: 11
Problem Signature 09: System.NullReferenceException
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Nor a mod folder for tAPI be made.
 
How would someone give an NPC drops similarly to a Mimic or Plantera?
Like if it drops one item there would be no chance it would simultaneously drop another item?
you could use a switch case, and make it break out if one of the cases are true[DOUBLEPOST=1413743745][/DOUBLEPOST]
Upon launching tAPI, it crashes, giving
~snip~
Nor a mod folder for tAPI be made.
Try deleting your existing players and worlds from r10
 
@Up
Because Vanilla Characters and Worlds is not compatible with tApi

@Edit
And world for tApi is in other folder
 
Hello beloved tAPI Team, how would you make a pickaxe. I'm adding items into the game and I'd like one to be a pick, and also I'd like to know how to make a crafting recipe using my modded items. Like, if I made a rock, I'd like to use it in crafting.
 
I'm having trouble with tApi. It's not even working, it just crashes the second it launches. I've tried completely redownloading and installing Terraria, GL, tApi, and MCT 7 times and it just keeps doing that.

EDIT: I seem to have got it to work now. Apparently I needed to delete everything inside My Games, because it kept screwing something up in there. It did it right this time, it seems.
 
Last edited:
Hello beloved tAPI Team, how would you make a pickaxe. I'm adding items into the game and I'd like one to be a pick, and also I'd like to know how to make a crafting recipe using my modded items. Like, if I made a rock, I'd like to use it in crafting.
To make a pickaxe, make a sword with a pickaxe texture and put a pick value in the JSON.
"pick": "100" for instance, that would give it 100% pickaxe power

As for putting custom items into recipes, I do that all the time!
When writing the recipe, instead of putting in
"items": { "Wood": 10, "Rock": 1 } <- that would not work
but instead
"items": { "Wood": 10, "internalModname:Rock" 1 } <- that will work

If you don't know your mod's internal name, you can find out in the ModInfo file your mod has.
 
Anyone able to help with the problem I'm having?

MNPC.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using TAPI;
using Terraria;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace jMod
{
    public sealed class MNPC : ModNPC
    {
        public override void NPCLoot()
        {
            if (npc.type == 68)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, (int)npc.width, (int)npc.height, 1, 1, false, 0, false);
            }
        }
    }
}
I'm trying to make it so the dungeon guardian drops a pickaxe on death. Problem is, he just drops the bone key as usual. Would love if someone could point me in the right direction.
 
To make a pickaxe, make a sword with a pickaxe texture and put a pick value in the JSON.
"pick": "100" for instance, that would give it 100% pickaxe power

As for putting custom items into recipes, I do that all the time!
When writing the recipe, instead of putting in
"items": { "Wood": 10, "Rock": 1 } <- that would not work
but instead
"items": { "Wood": 10, "internalModname:Rock" 1 } <- that will work

If you don't know your mod's internal name, you can find out in the ModInfo file your mod has.
You might want to try without the internal name. I think we managed to handle that.

Anyone able to help with the problem I'm having?

MNPC.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using TAPI;
using Terraria;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace jMod
{
    public sealed class MNPC : ModNPC
    {
        public override void NPCLoot()
        {
            if (npc.type == 68)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, (int)npc.width, (int)npc.height, 1, 1, false, 0, false);
            }
        }
    }
}
I'm trying to make it so the dungeon guardian drops a pickaxe on death. Problem is, he just drops the bone key as usual. Would love if someone could point me in the right direction.
The class has to be marked with a [GlobalMod] attribute. So:
Code:
[GlobalMod] public sealed class MNPC : ModNPC
Also, by convention, namespaces shouldn't start with a lowercase letter. It'll work, but yeah. Just saying.

I'm having trouble with tApi. It's not even working, it just crashes the second it launches. I've tried completely redownloading and installing Terraria, GL, tApi, and MCT 7 times and it just keeps doing that.

EDIT: I seem to have got it to work now. Apparently I needed to delete everything inside My Games, because it kept screwing something up in there. It did it right this time, it seems.
Yeah, r10 worlds and players were not compatible, and we didn't handle some exceptions properly - normally we try to pass all exceptions to the ErrorHandling class, which in turn opens the crash page menu in-game. We just missed this one.

@Up
Because Vanilla Characters and Worlds is not compatible with tApi

@Edit
And world for tApi is in other folder
We're still discussing a feature to import/export player and world files.
 
Another quick question shockah: I have created a MBase file that changes textures of default stuff, however at first when I log in npcs don't have the new texture. Reloading mods and returning to the world fixes this, however may be considered inconvenient for some. Is there any reason as to why this would be happening?

MBase.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using TAPI;
using Terraria;
using jLib;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace jMod
{
    public sealed class MBase : ModBase
    {
        internal static MBase BaseInstance;
        public override void OnLoad() 
        { 
            BaseInstance = this;
            DateTime now = DateTime.Now;
            int day = now.Day;
            int month = now.Month;
            if (day == 20 && month == 10)
            {
                Main.npcTexture[5] = Main.goreTexture[GoreDef.gores["jMod:Stuff"]];
                Main.npcTexture[6] = Main.goreTexture[GoreDef.gores["jMod:Stuff2"]];
            }
        }
    }
}
Is OnLoad not sufficient for what I want?
 
It should be fine... ;o Sorry, I'm not really sure why would that happen.
Anyway... Why are you using gore for NPC textures? Each .png file is stored in ModBase.textures dictionary.
Examples:
MyImage.png - key in dictionary is "MyImage"
Images/blahblah.png - key in dictionary is "Images/blahblah"
 
It should be fine... ;o Sorry, I'm not really sure why would that happen.
Anyway... Why are you using gore for NPC textures? Each .png file is stored in ModBase.textures dictionary.
Examples:
MyImage.png - key in dictionary is "MyImage"
Images/blahblah.png - key in dictionary is "Images/blahblah"
Is it possible that it could be a bug with tAPI? I tried doing it via MWorld, using Initialize instead but it still requires me to open world, exit and then reload mods before it actually does anything.

I had been using MBase.BaseInstance.textures, but I just went this way because it was in the tutorial I was following. Will probably end up changing for consistency sake, but for now it works.
 
Sounds like you followed some tConfig tutorial, lol.
...OH I KNOW WHAT'S WRONG. Basically, since version 1.2, Terraria postpones NPC texture loading until it's needed. It saves an array of bools for which texture is already loaded. You'd have to set the value in the bool array too.
 
Sounds like you followed some tConfig tutorial, lol.
...OH I KNOW WHAT'S WRONG. Basically, since version 1.2, Terraria postpones NPC texture loading until it's needed. It saves an array of bools for which texture is already loaded. You'd have to set the value in the bool array too.
Exactly that :p The lack of tAPI tuts so far leaves me no choice.
How would I go about doing that?
 
I'm at work, you'll have to find this one yourself. I think the method that does it is called Main.LoadNPC, but I could be wrong. Just check its code.
Also, remember to actually cache the textures and restore them in OnUnload!
 
how do I get back to the regular Terraria screen after i install tAPI.
If you installed the Game Launcher that was recommended, you could play either of the two via its menu.
If you did not - Go to your Terraria folder (either the GOG install directory or Steam/Steamapps/common/Terraria) and launch Terraria.bak.exe
You can always just delete Terraria.exe and rename Terraria.bak.exe to Terraria.exe revert to Vanilla Terraria or simply reinstall the game via Steam / GOG.
 
Status
Not open for further replies.
Back
Top Bottom