tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Has it been already reported that Reindeer Bells crash tAPI on drop? Ice Queen's drops misspell it as "Reindeer Balls", crashing the game
 
got this error recently was trying to test something in server, I'm aware that tAPI is severly broken in that regards, I was the only one on my server. My character got deleted in the process <.<

>>> 01:26:15 <<<
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Texture2D'.
at Microsoft.Xna.Framework.Helpers.CheckDisposed(System.Object obj, System.IntPtr pComPtr)
at Microsoft.Xna.Framework.Graphics.TextureCollection.set_Item(System.Int32 index, Microsoft.Xna.Framework.Graphics.Texture value)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Microsoft.Xna.Framework.Graphics.Texture2D texture, Microsoft.Xna.Framework.Graphics.SpriteBatch+SpriteInfo[] sprites, System.Int32 offset, System.Int32 count)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.Flush()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at TAPI.Menu.DrawMenu()
at Terraria.Main.Draw(Microsoft.Xna.Framework.GameTime gameTime)


>>> 01:26:15 <<<
System.InvalidOperationException: Begin cannot be called again until End has been successfully called.
at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(Microsoft.Xna.Framework.Graphics.SpriteSortMode sortMode, Microsoft.Xna.Framework.Graphics.BlendState blendState, Microsoft.Xna.Framework.Graphics.SamplerState samplerState, Microsoft.Xna.Framework.Graphics.DepthStencilState depthStencilState, Microsoft.Xna.Framework.Graphics.RasterizerState rasterizerState, Microsoft.Xna.Framework.Graphics.Effect effect, Microsoft.Xna.Framework.Matrix transformMatrix)
at Terraria.Main.Draw(Microsoft.Xna.Framework.GameTime gameTime)


>>> 04:58:48 <<<
System.NullReferenceException: Object reference not set to an instance of an object.
at Shockah.Insight.ChestCache.InitChest()
at Shockah.Insight.MPlayer.Save(TAPI.BinBuffer bb)
at Terraria.Player.SavePlayer(Terraria.Player p, System.String playerPath, System.Boolean skipMapSave = False)
at Terraria.WorldGen.saveToonWhilePlayingCallBack(System.Object threadContext)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object state)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
 
Every time I launch through Game Launcher this error shows up in the mods menu:

System.IO.FileLoadException: Could not load file or assembly 'Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c'
at TAPI.Mods.LoadModInfos(String folderpath)
at TAPI.Menu.<CreateMenus>b__133()
at TAPI.Menu.MoveTo(String page, Boolean silent)
at TAPI.MenuButton.<.ctor>b__3()
at TAPI.MenuPage.Draw(SpriteBatch SP)
at TAPI.Menu.DrawMenu()
at Terraria.Main.Draw(GameTime gameTime)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

If someone could tell me what this is and how to fix it, I'd be grateful.
 
please help! I made a sword and it wont work ! I get this error when I build my mod

Terraria 1.2.4.1, tAPI Builder r14a

========================================

LitJson.JsonException: ModInfo Error: Invalid character 'F' in input string ---> LitJson.JsonException: Invalid character 'F' in input string
at LitJson.Lexer.NextToken()
at LitJson.JsonReader.ReadToken()
at LitJson.JsonReader.Read()
at LitJson.JsonMapper.ReadValue(WrapperFactory factory, JsonReader reader)
at LitJson.JsonMapper.ToObject(String json)
at tAPI_Builder.MainWindow.<>c__DisplayClass8.<BtnBuild_Click>b__0()
--- End of inner exception stack trace ---
at tAPI_Builder.MainWindow.<>c__DisplayClass8.<BtnBuild_Click>b__0()

and here's my code

{
"displayName": "King Slimes Sword",
"size": [32,32],
"value": [0,2,50,99],
"rare": 6,
"tooltip": "A sword for King Slime!",
"useStyle": 1,
"useAnimation": 16,
"useTime": 16,
"damage": 34,
"knockback": 7,
"useSound": 1,
"autoReuse": true,
"melee": true,
"recipes":
[{
"items": { "Gel": 200, "Gold Bar": 15, "Gold Crown": 1 },
"tiles": [ "Anvil" ],
"creates": 1
},
{
"items": { "Gel": 200, "Gold Bar": 15, "Platinum Crown": 1 },
"tiles": [ "Anvil" ],
"creates": 1
}]
}

please help!
What is wrong with this coding? It's my brothers and I can't find anything wrong with it. Please help.





Code:
{
    "internalName": "DaBomb",
    "displayName": "DaBomb",
    "texture": "Items/DaBomb",
    "size": [20,20],
    "maxStack": 1,
    "value": [99,99,99,99],
    "useStyle": 1,
    "useAnimation": 1,
    "useTime": 1,
    "damage": 900,
    "knockBack": 5,
    "useSound": 1,
    "autoReuse": true,
    "useTurn": true,
    "melee": true,
  
    "recipes":
    [{
        "items": { "Dirt Block": 10 },
        "creates": 1
    }]
  
  
}
whats the error i could help!
"texture": "items/DaBomb" is useless the png you made needs to be the same name as the json file.
and in recipes, in between creates and items you need to put "tiles": [ "Work Bench" ]
if this doesnt work search TAPI - getting started with modding
hope this helped!
oh and internalname is useless
 
I want to make a prefix, but I get this: Key "allCrit" is missing or is not a Bool!

Here is the code:

{
"displayname": "George's",
"allDamage": 1.08,
"moveSpeed": 1.08,
"allCrit": 8,
"maxLife": 8,
"maxMana": 8,
"meleeSpeed": 1.08,
"tier": 8,
"value": 8.0,
"type": ["Accessory"] }

What am I doing wrong???
 
I want to make a prefix, but I get this: Key "allCrit" is missing or is not a Bool!

Here is the code:

{
"displayname": "George's",
"allDamage": 1.08,
"moveSpeed": 1.08,
"allCrit": 8,
"maxLife": 8,
"maxMana": 8,
"meleeSpeed": 1.08,
"tier": 8,
"value": 8.0,
"type": ["Accessory"] }

What am I doing wrong???
hm are you using cs or json file?
 
How do you make a projectile die if another instance of it exists in the world?
First you'd have to iterate through the first 1000 entries of the Main.projectile array, checking the type and active fields of every projectile. Also make sure you don't check the projectile against itself. Then if you find a different projectile with the same type and that's active, then you can either set that projectile's active variable to false, or call Kill on it.
Another way would be to iterate through this array before the projectile is created, and do any removing you need to do then.
 
First you'd have to iterate through the first 1000 entries of the Main.projectile array, checking the type and active fields of every projectile. Also make sure you don't check the projectile against itself. Then if you find a different projectile with the same type and that's active, then you can either set that projectile's active variable to false, or call Kill on it.
Another way would be to iterate through this array before the projectile is created, and do any removing you need to do then.
This worked. Thanks!
 
Hey, I've got a mod germinating and I'm trying to decide whether to make it a tAPI or standalone mod. Broadly speaking, what sorts of things aren't currently possible with tAPI? Can vanilla events be interrupted or cancelled? Like, could I make a mod that tweaks existing mechanics in addition to adding new content?
 
Last edited:
Hey, I've got a mod germinating and I'm trying to decide whether to make it a tAPI or standalone mod. Broadly speaking, what sorts of things aren't currently possible with tAPI? Can vanilla events be interrupted or cancelled? Like, could I make a mod that tweaks existing mechanics in addition to adding new content?
That depends on what exactly you want to do. So far, it looks like everything I want to do is possible (although at some parts you'll have to copy/paste a lot of code, unavoidable unless redundant hooks are added); I'm pretty sure that with enough creativity, anything would be possible (except maybe liquids?)
 
Tweaking certain drop rates. Specifically, The Axe and Binoculars. It's easy to say "Oh, one in 200 ain't that bad" until you're on run seventy and the boss is painfully unfarmable, like Plantera. From a game design perspective, an item will get that "pie in the sky" appeal with far fewer than 200 runs.

And the death screen lingers far too long. And there's no reason why the mushroom NPC should require an ENTIRE BIOME, a house made of mushroom blocks and furniture should be enough. And the golden crown requiring 30 gold bars is absurd, even in the late game.

But uh... I digress. Just certain things about the game are a bit iffy and I can code, so I figured I'd give it a go.



I had one or two liquids in mind, yeah. I've heard the water code is gnarly, so I guess it isn't surprising.
 
Last edited:
Tweaking certain drop rates. Specifically, The Axe and Binoculars. It's easy to say "Oh, one in 200 ain't that bad" until you're on run seventy and the boss is painfully unfarmable, like Plantera. From a game design perspective, an item will get that "pie in the sky" appeal with far fewer than 200 runs.

And the death screen lingers far too long. And there's no reason why the mushroom NPC should require an ENTIRE BIOME, a house made of mushroom blocks and furniture should be enough. And the golden crown requiring 30 gold bars is absurd, even in the late game.

But uh... I digress. Just certain things about the game are a bit iffy and I can code, so I figured I'd give it a go.



I had one or two liquids in mind, yeah. I've heard the water code is gnarly, so I guess it isn't surprising.
Changing the drop rates of items can be done by changing the LootRules that are stored for the monsters, and I'm pretty sure that recipes can be changed (and if they can't, they can be removed then another one added). From a brief glance, it looks like it might be possible to get Truffle to spawn another way (not completely sure though). But yeah, I haven't looked into the death screen, so I'm not sure if that's possible, and it would be easiest to make a standalone mod if you want to make liquids. (Although, you could make a second liquid system to run in parallel, but that would just be too much work, both for you and for the game.)
 
Changing the drop rates of items can be done by changing the LootRules that are stored for the monsters, and I'm pretty sure that recipes can be changed (and if they can't, they can be removed then another one added). From a brief glance, it looks like it might be possible to get Truffle to spawn another way (not completely sure though). But yeah, I haven't looked into the death screen, so I'm not sure if that's possible, and it would be easiest to make a standalone mod if you want to make liquids. (Although, you could make a second liquid system to run in parallel, but that would just be too much work, both for you and for the game.)
Good to know, thanks.
 
Hey, I'm making a software to port mods from tConfig to tAPI, I just finished the item porting, now I'm going to start with buffs, if anyone is interested I can post it in the forums.
 
I am trying to make an item that drops from enemies in the Underworld after the Golem is defeated. I get this message in the tAPI Builder:
Operator '&&' cannot be applied to operands of type 'bool' and 'double'
if (NPC.downedGolemBoss && Main.hellLayer)
Code:
public override void PostNPCLoot()[/FONT][/FONT]
[FONT=Courier New][FONT=Trebuchet MS]
            {
            if (NPC.downedGolemBoss && Main.hellLayer)
               {
                    if(Main.rand.Next(1, 3) == 1)
                    {
                         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width / 2, npc.height / 2, ItemDef.byName["Pumpking:EndgameEssence"].type, 1, false, 0);
                    }
               }
        }
 
I am trying to make an item that drops from enemies in the Underworld after the Golem is defeated. I get this message in the tAPI Builder:
Operator '&&' cannot be applied to operands of type 'bool' and 'double'
if (NPC.downedGolemBoss && Main.hellLayer)
Code:
public override void PostNPCLoot()[/FONT][/FONT][/FONT][/FONT]
[FONT=Courier New][FONT=Trebuchet MS][FONT=Courier New][FONT=Trebuchet MS]
            {
            if (NPC.downedGolemBoss && Main.hellLayer)
               {
                    if(Main.rand.Next(1, 3) == 1)
                    {
                         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width / 2, npc.height / 2, ItemDef.byName["Pumpking:EndgameEssence"].type, 1, false, 0);
                    }
               }
        }
The Main.hellLayer variable stores the altitude of the underworld, not whether or not the monster is in the underworld, so you'll have to check the NPC's altitude (make sure to convert it to block coordinates) to Main.hellLayer.
Edit: Specifically, to convert an NPC position to a tile position, divide the NPC's position by 16.
 
Status
Not open for further replies.
Back
Top Bottom