• Labor of Love is here! Visit our Labor of Love thread for a special message from the team, a look at brand new Labor of Love merch, and the changelog (minus a few surprises 😉)

tAPI Getting Started with Modding

Status
Not open for further replies.

blushiemagic

Retinazer
tModLoader
Hey, I'm trying to compile a texture pack based off of a tutorial by MiraiMai, but I get this error whenever I try to compile:
Terraria 1.2.4.1, tAPI Builder r14a

========================================
Building mod CrimsonPack

Validating Jsons...
Compiling code...
MBase.cs (4,36)
} expected
}
^
Failed to build CrimsonPack.

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

Built 0 mods.
Here is the MBase.cs
Code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace CrimsonPack
{
    public class MBase : TAPI.ModBase //MBase can be any name
    {
        public override void OnLoad(){ } //Called when the mod is first loaded.
        public override void OnUnload(){ } //Called when the mod is unloaded.
        public override void OnAllModsLoaded() //Called when all mods are loaded.
        {
        // Replace Corruption with Crimson textures
        if(!Main.dedServ) {
            Main.tileTexture[21] = textures["Images/Tiles_21"];
            Main.tileTexture[82] = textures["Images/Tiles_82"];          
            Main.tileTexture[83] = textures["Images/Tiles_83"];
            Main.tileTexture[84] = textures["Images/Tiles_84"];          
            Main.itemTexture[273] = textures["Image/Item_273"];
            Main.itemTexture[274] = textures["Image/Item_274"];
            Main.itemTexture[310] = textures["Image/Item_310"];
            Main.itemTexture[316] = textures["Image/Item_316"];
            Main.itemTexture[328] = textures["Image/Item_328"];
            Main.itemTexture[329] = textures["Image/Item_329"];
            Main.itemTexture[675] = textures["Image/Item_675"];      
            Main.npcTexture[47] = textures["Image/NPC_47"];              
            Main.npcTexture[79] = textures["Image/NPC_79"];
            Main.npcTexture[85] = textures["Image/NPC_85"];              
            Main.npcTexture[140] = textures["Image/NPC_140"];          
        }
        public override void PreGameDraw(SpriteBatch sb) { } //Called before all game drawing.
        public override void PostGameDraw(SpriteBatch sb) { } //Called after all game drawing is finished.

        public override void ChooseTrack(ref string current) { } //Called when the music track updates.

        public override void OptionChanged(Option option) { } // Called when leaving the options page on all options for this mod with notify (ie recently changed)
        public override List<string> OptionList(Option option) // Called on Dynamic options for this mod to fill possibleValues.
        {
            if (option.name == "codedValue")
            {
                List<string> list = new List<string>();
                list.AddRange(new string[] { "Derp", "> 9000", "much choice", "I don't even", "NOPE" });
                return list;
            }
            return null;
        }

        public override object OnModCall(TAPI.ModBase mod, params object[] args) { return base.OnModCall(mod, args);  } //Called when another mod calls this on your mod. (used for inter-mod communicating)
    }
}
I think you need another } after the big if statement.
 

-=+Seth+=-

Skeletron Prime
I think you need another } after the big if statement.
Does anyone know what this means

TAPI.Mods+LoadException: Zirconium+.tapi: TAPI.Mods+LoadException: Json "JsonData object" Missing default texture: Items/ZirconiumSword
at TAPI.ModJsonHandler.PropTexture(JsonData j, String key, IDictionary`2 dict, String defaultKey)
at TAPI.ModJsonHandler.HandleItem(ModBase modBase, JsonData j, String fname)
at TAPI.ModJsonHandler.Handle(ModBase modBase)
at TAPI.Mod.<Load>b__0(BinBuffer bb)
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action)
at TAPI.Mods.HandleModFile(FPath path, Action`1 action)
at TAPI.Mod.Load()
at TAPI.Mods.Load()
at TAPI.Mods.Load()
[DOUBLEPOST=1422158651][/DOUBLEPOST]
Thanks for the tutorial about changing vanilla recipes! That really helped me out ;)
Do you know what this means?

TAPI.Mods+LoadException: Zirconium+.tapi: TAPI.Mods+LoadException: Json "JsonData object" Missing default texture: Items/ZirconiumSword
at TAPI.ModJsonHandler.PropTexture(JsonData j, String key, IDictionary`2 dict, String defaultKey)
at TAPI.ModJsonHandler.HandleItem(ModBase modBase, JsonData j, String fname)
at TAPI.ModJsonHandler.Handle(ModBase modBase)
at TAPI.Mod.<Load>b__0(BinBuffer bb)
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action)
at TAPI.Mods.HandleModFile(FPath path, Action`1 action)
at TAPI.Mod.Load()
at TAPI.Mods.Load()
at TAPI.Mods.Load()
 

-=+Seth+=-

Skeletron Prime
What does this mean!!!!!!!!!!!!!!
TAPI.Mods+LoadException: Zirconium+.tapi: TAPI.Mods+LoadException: Json "JsonData object" Missing default texture: Items/ZirconiumSword
at TAPI.ModJsonHandler.PropTexture(JsonData j, String key, IDictionary`2 dict, String defaultKey)
at TAPI.ModJsonHandler.HandleItem(ModBase modBase, JsonData j, String fname)
at TAPI.ModJsonHandler.Handle(ModBase modBase)
at TAPI.Mod.<Load>b__0(BinBuffer bb)
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action)
at TAPI.Mods.HandleModFile(FPath path, Action`1 action)
at TAPI.Mod.Load()
at TAPI.Mods.Load()
at TAPI.Mods.Load()
 

blushiemagic

Retinazer
tModLoader
Does anyone know what this means

TAPI.Mods+LoadException: Zirconium+.tapi: TAPI.Mods+LoadException: Json "JsonData object" Missing default texture: Items/ZirconiumSword
at TAPI.ModJsonHandler.PropTexture(JsonData j, String key, IDictionary`2 dict, String defaultKey)
at TAPI.ModJsonHandler.HandleItem(ModBase modBase, JsonData j, String fname)
at TAPI.ModJsonHandler.Handle(ModBase modBase)
at TAPI.Mod.<Load>b__0(BinBuffer bb)
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action)
at TAPI.Mods.HandleModFile(FPath path, Action`1 action)
at TAPI.Mod.Load()
at TAPI.Mods.Load()
at TAPI.Mods.Load()
[DOUBLEPOST=1422158651][/DOUBLEPOST]
Do you know what this means?

TAPI.Mods+LoadException: Zirconium+.tapi: TAPI.Mods+LoadException: Json "JsonData object" Missing default texture: Items/ZirconiumSword
at TAPI.ModJsonHandler.PropTexture(JsonData j, String key, IDictionary`2 dict, String defaultKey)
at TAPI.ModJsonHandler.HandleItem(ModBase modBase, JsonData j, String fname)
at TAPI.ModJsonHandler.Handle(ModBase modBase)
at TAPI.Mod.<Load>b__0(BinBuffer bb)
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action)
at TAPI.Mods.HandleModFile(FPath path, Action`1 action)
at TAPI.Mod.Load()
at TAPI.Mods.Load()
at TAPI.Mods.Load()
That means you need to make an image for your sword, then put it in the Items folder. Make sure the image is called ZirconiumSword.png.
 

-=+Seth+=-

Skeletron Prime
That means you need to make an image for your sword, then put it in the Items folder.
i have one
Zirconium Sword.png

[DOUBLEPOST=1422159034][/DOUBLEPOST]
That means you need to make an image for your sword, then put it in the Items folder. Make sure the image is called ZirconiumSword.png.
do i make it smaller? call it something else
 

-=+Seth+=-

Skeletron Prime
Does anyone know how to fix this?
Code:
{
"displayName": "Bone Shark",
"size": [60, 28],
"maxStack": 1
"value": [1, 0, 0, 0,],
"rare": 8,
"tooltip": "Megashark and Minisharks long dead Father",
"useStyle": 5,
"useAnimation": 8,
"useTime": 8,
"damage": 50,
"knockback": 8,
"autoReuse": true,
"noMelee": true,
"shoot": 14,
"shootSpeed" 20,
"useAmmo": 14,
"ranged": true,

"recipes":
[{
"items": { "Dirt Block": 1,
"tiles": [ "Work Bench" ],
"creates": 1
]}
]

On json editor online it says
Error: Parse error on line 4:
...8],
"maxStack": 1
"value": [1, 0, 0, 0
---------------------^
Expecting 'EOF', '}', ',', ']', got 'STRING'
Error: Parse error on line 4:
 

blushiemagic

Retinazer
tModLoader
Does anyone know how to fix this?
Code:
{
"displayName": "Bone Shark",
"size": [60, 28],
"maxStack": 1
"value": [1, 0, 0, 0,],
"rare": 8,
"tooltip": "Megashark and Minisharks long dead Father",
"useStyle": 5,
"useAnimation": 8,
"useTime": 8,
"damage": 50,
"knockback": 8,
"autoReuse": true,
"noMelee": true,
"shoot": 14,
"shootSpeed" 20,
"useAmmo": 14,
"ranged": true,

"recipes":
[{
"items": { "Dirt Block": 1,
"tiles": [ "Work Bench" ],
"creates": 1
]}
]

On json editor online it says
Error: Parse error on line 4:
...8],
"maxStack": 1
"value": [1, 0, 0, 0
---------------------^
Expecting 'EOF', '}', ',', ']', got 'STRING'
Error: Parse error on line 4:
Replace
"value": [1, 0, 0, 0,],
with
"value": [1, 0, 0, 0],

Remember, commas are used to separate things in lists. Don't use a comma right after the last thing in a list.
 

blushiemagic

Retinazer
tModLoader
Error: Parse error on line 4:
...8],
"maxStack": 1
"value": [1, 0, 0, 0
---------------------^
Expecting 'EOF', '}', ',', ']', got 'STRING'
validated by jsonlint
Ok, found more errors. Try this:
Code:
{
"displayName": "Bone Shark",
"size": [60, 28],
"maxStack": 1,
"value": [1, 0, 0, 0],
"rare": 8,
"tooltip": "Megashark and Minisharks long dead Father",
"useStyle": 5,
"useAnimation": 8,
"useTime": 8,
"damage": 50,
"knockback": 8,
"autoReuse": true,
"noMelee": true,
"shoot": 14,
"shootSpeed": 20,
"useAmmo": 14,
"ranged": true,

"recipes":
[{
"items": { "Dirt Block": 1},
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
The main problem is that you keep either using too many commas, or keep forgetting your commas and colons. Next time, please try to check for these, since it takes a long time to ask other people about every problem.
 

-=+Seth+=-

Skeletron Prime
Ok, found more errors. Try this:
Code:
{
"displayName": "Bone Shark",
"size": [60, 28],
"maxStack": 1,
"value": [1, 0, 0, 0],
"rare": 8,
"tooltip": "Megashark and Minisharks long dead Father",
"useStyle": 5,
"useAnimation": 8,
"useTime": 8,
"damage": 50,
"knockback": 8,
"autoReuse": true,
"noMelee": true,
"shoot": 14,
"shootSpeed": 20,
"useAmmo": 14,
"ranged": true,

"recipes":
[{
"items": { "Dirt Block": 1}
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
The main problem is that you keep either using too many commas, or keep forgetting your commas and colons. Next time, please try to check for these, since it takes a long time to ask other people about every problem.
I found this
Error: Parse error on line 25:
... ],
"creates": 1
}]
}
---------------------^
Expecting '}', ',', got ']'
[DOUBLEPOST=1422163448][/DOUBLEPOST]
Ok, found more errors. Try this:
Code:
{
"displayName": "Bone Shark",
"size": [60, 28],
"maxStack": 1,
"value": [1, 0, 0, 0],
"rare": 8,
"tooltip": "Megashark and Minisharks long dead Father",
"useStyle": 5,
"useAnimation": 8,
"useTime": 8,
"damage": 50,
"knockback": 8,
"autoReuse": true,
"noMelee": true,
"shoot": 14,
"shootSpeed": 20,
"useAmmo": 14,
"ranged": true,

"recipes":
[{
"items": { "Dirt Block": 1}
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
The main problem is that you keep either using too many commas, or keep forgetting your commas and colons. Next time, please try to check for these, since it takes a long time to ask other people about every problem.
Found it out NVM thanks
 

-=+Seth+=-

Skeletron Prime
Replace
"value": [1, 0, 0, 0,],
with
"value": [1, 0, 0, 0],

Remember, commas are used to separate things in lists. Don't use a comma right after the last thing in a list.
Now look
TAPI.Mods+LoadException: No item "tiles" found for recipe of item "Zirconium+:BoneShark"
at TAPI.RecipeResolver.Resolve()
at TAPI.ResolverQueue.ResolveAll()
at TAPI.Mods.Load()
 

blushiemagic

Retinazer
tModLoader
Now look
TAPI.Mods+LoadException: No item "tiles" found for recipe of item "Zirconium+:BoneShark"
at TAPI.RecipeResolver.Resolve()
at TAPI.ResolverQueue.ResolveAll()
at TAPI.Mods.Load()
Did you see the latest changes I made to my previous post? Remember to always place commas in the right place. Commas always come after an entry in a list if there is another entry afterwards. If there's some weird kind of error, make sure you have the right syntax. You also need to make sure your brackets are in the correct places. It looks to me like you did something wrong with the brackets. If you're having this much trouble, you might want to look up some tutorials on .json syntax and study them.
 

-=+Seth+=-

Skeletron Prime
Did you see the latest changes I made to my previous post? Remember to always place commas in the right place. Commas always come after an entry in a list if there is another entry afterwards. If there's some weird kind of error, make sure you have the right syntax. You also need to make sure your brackets are in the correct places. It looks to me like you did something wrong with the brackets. If you're having this much trouble, you might want to look up some tutorials on .json syntax and study them.

it's fine i did it. I don't know how to mod AT ALL! i'm just trying to use this tutorial (and other people). also i need a tutorial on pickaxe, axe, and a Hammer
 
Status
Not open for further replies.
Top Bottom