tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Hmm.. is there a way to force the monster to appear only where there are certain tiles? If possible, please help =)
According to the Terraria wiki, forest grass is required for King Slime to spawn, so I'd think so, but I'm no coder, so I can't help with that.
 
@Yoraiz0r were you going to finish your sentence?
uYvH25E.png

  • Added Tile boolean json field "chest", used for the purpose of allowing the tile to act as a chest object (you still need to
0_0 Didn't even realize the sentence got cut when I moved it from 1 doc to another.

You still need to include the code for creating, opening and destroying the chest object yourself, this boolean only allows the chest interface to stay open if the player's chest anchor is of your tile's type. (which would otherwise close)
 
0_0 Didn't even realize the sentence got cut when I moved it from 1 doc to another.

You still need to include the code for creating, opening and destroying the chest object yourself, this boolean only allows the chest interface to stay open if the player's chest anchor is of your tile's type. (which would otherwise close)

And what exactly does that code look like...?
ZcS1CYv.png
 
Help please!
i try to launch a server on r15 and it just says "
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'tAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of it
s dependencies. The system cannot find the file specified.
at Terraria.ProgramServer.Main(String[] args)"

I don't know what I did but the tAPI application doesnt run either it is a PDB from when I installed it. I tried re-installing and redownloading and re-modding and deleting my
folder but nothing works.....
 
Help please!
i try to launch a server on r15 and it just says "
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'tAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of it
s dependencies. The system cannot find the file specified.
at Terraria.ProgramServer.Main(String[] args)"

I don't know what I did but the tAPI application doesnt run either it is a PDB from when I installed it. I tried re-installing and redownloading and re-modding and deleting my
folder but nothing works.....
This is a temporary problem that happens when people don't use the Terraria game launcher by Eikester (because in the old times we sort of assumed we'd just make it mandatory) - if you want to fix the problem for now duplicate your Terraria.exe and name it "tAPI.exe", then it will be able to find the tAPI assembly.

And what exactly does that code look like...?
ZcS1CYv.png
on placing the tile call chest.place(top left x, top left y) , make the tile return false in killtile if there's items in the chest / call the chest.DestroyChest(top left x, top left y) if you're intending to let the player mine the tile out, and make right click open the chest ... that's about it, you might want mousehover too =P
 
For a while now, I've been trying to make projectile after-images to work, however, it is currently still not working. I have narrowed it down to either PostDraw(SpriteBatch sb) for the projectile or PostGameUpdate(SpriteBatch sb). The code so far...


Code:
public override void PostDraw(SpriteBatch sb)
        {
            Color color21 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            SpriteEffects effects = SpriteEffects.None;
            int num98 = 0;
            int num99 = 0;
            float num100 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
            for(int num126 = 0; num126 < 10; num126++)
            {
                Color alpha4 = projectile.GetAlpha(color21);
                float num127 = (float)(9 - num126) / 9f;
                alpha4.R = (byte)((float)alpha4.R * num127);
                alpha4.G = (byte)((float)alpha4.G * num127);
                alpha4.B = (byte)((float)alpha4.B * num127);
                alpha4.A = (byte)((float)alpha4.A * num127);
                float num128 = (float)(9 - num126) / 9f;
                Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.oldPos[num126].X - Main.screenPosition.X + num100 + (float)num99, projectile.oldPos[num126].Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha4, projectile.rotation, new Vector2(num100, (float)(projectile.height / 2 + num98)), num128 * projectile.scale, effects, 0f);
            }
        }
Code:
public override void PostGameDraw(SpriteBatch sb)
        {
            for(int i = 0; i < 1000; i++)
            {
                if(Main.projectile[i].active) //Testing with all projectiles
                {
                    Color color21 = Lighting.GetColor((int)((double)Main.projectile[i].position.X + (double)Main.projectile[i].width * 0.5) / 16, (int)(((double)Main.projectile[i].position.Y + (double)Main.projectile[i].height * 0.5) / 16.0));
                    SpriteEffects effects = SpriteEffects.None;
                    int num98 = 0;
                    int num99 = 0;
                    float num100 = (float)(Main.projectileTexture[Main.projectile[i].type].Width - Main.projectile[i].width) * 0.5f + (float)Main.projectile[i].width * 0.5f;
                    for(int num126 = 0; num126 < 10; num126++)
                    {
                        Color alpha4 = Main.projectile[i].GetAlpha(color21);
                        float num127 = (float)(9 - num126) / 9f;
                        alpha4.R = (byte)((float)alpha4.R * num127);
                        alpha4.G = (byte)((float)alpha4.G * num127);
                        alpha4.B = (byte)((float)alpha4.B * num127);
                        alpha4.A = (byte)((float)alpha4.A * num127);
                        float num128 = (float)(9 - num126) / 9f;
                        Main.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].oldPos[num126].X - Main.screenPosition.X + num100 + (float)num99, Main.projectile[i].oldPos[num126].Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), alpha4, Main.projectile[i].rotation, new Vector2(num100, (float)(Main.projectile[i].height / 2 + num98)), num128 * Main.projectile[i].scale, effects, 0f);
                    }
                }
            }
        }

There seems to be nothing wrong with the code and I checked the placement of the hooks, but still can't figure out why it's not working...
 
For a while now, I've been trying to make projectile after-images to work, however, it is currently still not working. I have narrowed it down to either PostDraw(SpriteBatch sb) for the projectile or PostGameUpdate(SpriteBatch sb). The code so far...


Code:
public override void PostDraw(SpriteBatch sb)
        {
            Color color21 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            SpriteEffects effects = SpriteEffects.None;
            int num98 = 0;
            int num99 = 0;
            float num100 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
            for(int num126 = 0; num126 < 10; num126++)
            {
                Color alpha4 = projectile.GetAlpha(color21);
                float num127 = (float)(9 - num126) / 9f;
                alpha4.R = (byte)((float)alpha4.R * num127);
                alpha4.G = (byte)((float)alpha4.G * num127);
                alpha4.B = (byte)((float)alpha4.B * num127);
                alpha4.A = (byte)((float)alpha4.A * num127);
                float num128 = (float)(9 - num126) / 9f;
                Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.oldPos[num126].X - Main.screenPosition.X + num100 + (float)num99, projectile.oldPos[num126].Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha4, projectile.rotation, new Vector2(num100, (float)(projectile.height / 2 + num98)), num128 * projectile.scale, effects, 0f);
            }
        }
Code:
public override void PostGameDraw(SpriteBatch sb)
        {
            for(int i = 0; i < 1000; i++)
            {
                if(Main.projectile[i].active) //Testing with all projectiles
                {
                    Color color21 = Lighting.GetColor((int)((double)Main.projectile[i].position.X + (double)Main.projectile[i].width * 0.5) / 16, (int)(((double)Main.projectile[i].position.Y + (double)Main.projectile[i].height * 0.5) / 16.0));
                    SpriteEffects effects = SpriteEffects.None;
                    int num98 = 0;
                    int num99 = 0;
                    float num100 = (float)(Main.projectileTexture[Main.projectile[i].type].Width - Main.projectile[i].width) * 0.5f + (float)Main.projectile[i].width * 0.5f;
                    for(int num126 = 0; num126 < 10; num126++)
                    {
                        Color alpha4 = Main.projectile[i].GetAlpha(color21);
                        float num127 = (float)(9 - num126) / 9f;
                        alpha4.R = (byte)((float)alpha4.R * num127);
                        alpha4.G = (byte)((float)alpha4.G * num127);
                        alpha4.B = (byte)((float)alpha4.B * num127);
                        alpha4.A = (byte)((float)alpha4.A * num127);
                        float num128 = (float)(9 - num126) / 9f;
                        Main.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].oldPos[num126].X - Main.screenPosition.X + num100 + (float)num99, Main.projectile[i].oldPos[num126].Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), alpha4, Main.projectile[i].rotation, new Vector2(num100, (float)(Main.projectile[i].height / 2 + num98)), num128 * Main.projectile[i].scale, effects, 0f);
                    }
                }
            }
        }

There seems to be nothing wrong with the code and I checked the placement of the hooks, but still can't figure out why it's not working...
Both of your methods are fine, though unclean...the reason neither of them work is because by default terraria doesn't update the oldPos array for all the projectiles, just those who 'need' it.

Honestly I'd suggest just making and managing your own array of old positions, you can have it be as lengthy as you want that way or only update it when necessary =P

(Made a quick check, you can't trigger the vanilla updater on, using the AI hook to update the old positions or postAI should be satisfactory)
 
Wanted to add another little bug I noticed. It seems that now all vanilla worlds can be imported for some odd reason. In the list, I'm missing about half the worlds I have in vanilla, so I don't know why that would occur. Hope this will get fixed as well. Still, r15 works nicely despite these bugs!
 
Both of your methods are fine, though unclean...the reason neither of them work is because by default terraria doesn't update the oldPos array for all the projectiles, just those who 'need' it.

Honestly I'd suggest just making and managing your own array of old positions, you can have it be as lengthy as you want that way or only update it when necessary =P

(Made a quick check, you can't trigger the vanilla updater on, using the AI hook to update the old positions or postAI should be satisfactory)
Thank you so much! After a little bit of digging, I found out how the oldPos vectors were stored, so I copied that over and just put that for loop within the PostAI() function and it worked, which means that I didn't need to make my own oldPos vector array after all. In the future though, I might make my own array for oldPos in the future.
 
This is a temporary problem that happens when people don't use the Terraria game launcher by Eikester (because in the old times we sort of assumed we'd just make it mandatory) - if you want to fix the problem for now duplicate your Terraria.exe and name it "tAPI.exe", then it will be able to find the tAPI assembly.
Well I re-named Terraria in my Steam folder and the server still doesn't seem to be working. :I
 
My tAPI builder wont work (tried reinstalling terraria, and tAPI) it just opens as a "Program has stopped working" please help. I dont have a screen shot program so sorry about that.




More info:
I'm on Windows 8(not 8.1)
I'm missing a hard drive (manually downloaded the graphics driver so I can download, and I have space via a ssd)
Info about the crash:

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: tAPI Builder.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 5536825f
Problem Signature 04: PresentationFramework
Problem Signature 05: 4.0.30319.34209
Problem Signature 06: 5348b261
Problem Signature 07: 7fec
Problem Signature 08: ee
Problem Signature 09: System.Windows.Markup.XamlParse
OS Version: 6.3.9600.2.0.0.768.101
Locale ID: 1033
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: dba6
Additional Information 4: dba6f3f51243e7af8337f6bced10f1a2
 
is it poossible to change a texture of a mob with Tapi now?
I'd assume you'd just have to set Main.npcTexture[npcID] to the desired image.
So for example, if you put this in your ModBase class's OnLoad method,
Main.npcTexture[npcID] = textures["imageName"];
 
OK, new to tAPI but OK at C#. Having difficulty finding all the hooks that are available so this is what I'm trying to do:

On a pickaxe/axe/weapon item only enable the tool functions whilst LeftAlt is pressed (tired of destroying my house when a boss randomly spawns within)

so....

if (KState.Special.Alt.Down())
{
// disable shoot functions if L-Alt down
// and add "pick": 100, "axe": 100
}
else
{
// add "shoot":
// remove "pick": and "axe":
}

1) Is this possible?
2) Where would I put it?

TIA, Glyn.
 
anyone know how to import vanilla map? i want to download builders workshop, can anyone help me? please?

Start a game then, after selecting your player, on the World Select you choose <Import Vanilla>

Game will then display a list of worlds it has found in the vanilla Worlds folder (i.e. My Games/Terraria/Worlds) and you can choose one of those.

That World is now loaded, converted and saved (to My Games/Terraria/tAPI/Worlds) and you return to the World selector again (with the imported map listed.)
 
Status
Not open for further replies.
Back
Top Bottom