tAPI Getting Started with Modding

Status
Not open for further replies.
I am having an issue getting recipes for current vanilla items working, I know I need to make a .cs file and put it in my items folder i think? This is what I have so far, it is just Berb's template.

Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace GriffinPerilsMod.Items //replace "berberborscing" with your mod's internal name
{
    public class Recipes : ModBase
    {
        public override void OnLoad()
        {    ///Slime Staff
            Recipe.newRecipe.createItem.SetDefaults(1309, false); //This is where the item you want to add a recipe to goes. "1309" is the ID of the Slime Staff.
            Recipe.newRecipe.createItem.stack = 1; //This is how many are produced by this recipe.
            Recipe.newRecipe.requiredItem.Add(new Item().SetDefaults(9, false)); //This is the first item used in the recipe. "9" is the ID for Wood.
            Recipe.newRecipe.requiredItem[0].stack = 15; //This is how much Wood we need, 15. the [0] notes that this is the first material in the recipe.
            Recipe.newRecipe.requiredItem.Add(new Item().SetDefaults(23, false)); //This is the second item used in the recipe. "23" is the ID for Gel.
            Recipe.newRecipe.requiredItem[1].stack = 80; //We need 80 Gel. The [1] means it is the second material in the recipe. It goes up from there.
            Recipe.newRecipe.requiredItem.Add(new Item().SetDefaults(29, false)); //"29" is the ID for Life Crystal. Get it now?
            Recipe.newRecipe.requiredItem[2].stack = 1; //We need 1 Heart Crystal.
            Recipe.newRecipe.requiredTile.Add(18); //This is where the crafting station you need goes. "18" is the ID for the Work Bench.
            Recipe.AddRecipe(); //This tidbit of code adds the recipe into the game.
            ///Poison Dart
            Recipe.newRecipe.createItem.SetDefaults(1310, false); //Poison Dart
            Recipe.newRecipe.createItem.stack = 5; //Create 5 Poison Darts
            Recipe.newRecipe.requiredItem.Add(new Item().SetDefaults(22, false)); //Needs Iron Bars
            Recipe.newRecipe.requiredItem[0].stack = 1; //Needs 1 Iron Bar
            Recipe.newRecipe.requiredItem.Add(new Item().SetDefaults(320, false)); //Needs Feathers
            Recipe.newRecipe.requiredItem[1].stack = 1; //Needs 1 Feather
            Recipe.newRecipe.requiredTile.Add(18); //At a work bench
        }

    }
}

I have that in my "PerilsMod>Items" Folder right now and I don't know why I can't get items loaded in my game?
Can someone help me please?
 
Ok I give up if you could see what is wrong and what i should do I would be thankfull i cant send an error message because i have it in polish language but it translates to something like: wanted method of acces get or set
Here is the file https://www.mediafire.com/?e0l9gupyd5uoff5
NewProjectile is a function for the Projectile class, not a method. You need to put it into the method that fits your need (like PostAI), then add Projectile.NewProjectile(everythinthatfollows) in, possibly on a timer otherwise it's gonna create a projectile every frame.
 
NewProjectile is a function for the Projectile class, not a method. You need to put it into the method that fits your need (like PostAI), then add Projectile.NewProjectile(everythinthatfollows) in, possibly on a timer otherwise it's gonna create a projectile every frame.
Thanks, but I will probably give up because I dont know how to do anything you said xd
 
I've got a problem with CS files at the moment since none of them seem to co-operate with my JSONs, and therefore I can't get any bonuses on them.
It works perfectly without them, but I want the bonuses to work... damn it's not urgent but I still need help on this.
 
I've got a problem with CS files at the moment since none of them seem to co-operate with my JSONs, and therefore I can't get any bonuses on them.
It works perfectly without them, but I want the bonuses to work... damn it's not urgent but I still need help on this.
Paste the cs file over plz?
 
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace ToolsWeapons.Items
{
public class AwokenHelmet : ModItem
{

public override void Effects(Player player)
{
player.meleeDamage += 0.4f;
player.meleeCrit += 70;
}
}
}

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace ToolsWeapons.Items
{
public class AwokenGreaves : ModItem
{

public override void Effects(Player player)
{
player.meleeSpeed += 0.2f;
player.moveSpeed += 1.10f;
}
}
}

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 ToolsWeapons.Items
{
public class AwokenBreastplate : ModItem
{


public override void Effects(Player player)
{
player.meleeDamage += 0.55f;
player.meleeSpeed += 0.30f;

}

public override void ArmorSetBonus(Player p)
{
p.setBonus = "80% increased melee damage and insane life regen!";
p.meleeDamage += 0.8f;
p.lifeRegen = 50;
int dust = Dust.NewDust(new Vector2((float) p.position.X, (float) p.position.Y), p.width, p.height, 25, (p.velocity.X) + (p.direction * 1), p.velocity.Y, 245, Color.Blue, 0.6f);
Main.dust[dust].noGravity = true;
}

}
}
 
Nothing seems out of place. Is ToolsWeapons your mod's internal name? Also does every class share its name with the interested json file (case sensitive n all)?
 
Nothing seems out of place. Is ToolsWeapons your mod's internal name? Also does every class share its name with the interested json file (case sensitive n all)?
No. damnit
(I took this layout file from sources of MoreTools Weapons mod, and I forgot that even existed)
 
I have a question. Can you make a boss have your own music?
yes! you just need to change the "music" value in your NPC's JSON to the name of your song. however, actually inserting the song is ULTRA HARD.
you need to create a wavebank file with XACT. <==== that's already hard enough to say " 'nuff said.".
if you really wanna do that tho, there are tutorials around youtube
 
yes! you just need to change the "music" value in your NPC's JSON to the name of your song. however, actually inserting the song is ULTRA HARD.
you need to create a wavebank file with XACT. <==== that's already hard enough to say " 'nuff said.".
if you really wanna do that tho, there are tutorials around youtube
Tutorials to set up custom music? Or tutorials for XACT only. I know how to use XACT but custom music doesn't seem to work for me regardless.
 
I was wondering if anyone knew how to make a worm or segmented enemy, as I wish to implement some of terraria's fan ideas, such as 'The Beast' by Endling.
 
Status
Not open for further replies.
Back
Top Bottom