tAPI [TUTORIAL] How to make a basic flail type weapon.

I made you some images for the example flail parts. They are yours if you want to use them. :)
ExampleBall.png
ExampleChain.png
ExampleFlail.png
 
How would i make a spear? I used the example mod exactly, but no spear even shows up when i click.
The example mod has not been updated in awhile, thus some things inside are broken, I've never made a spear, but @Sin Costan has a tutorial for projectiles somewhere in his signature, in the bottom of that tutorial there is a spear tutorial
 
First, download the chain texture that is in the Op, then in your mod folder, create a new .cs file called MPlayer.cs, copy this code into that file
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 Mod
{
    public class MPlayer : TAPI.ModPlayer
    {
        public override void PreUpdate()
        {
            int held_item = player.inventory[player.selectedItem].type;
            if (held_item == 163)
            {
                Main.chain3Texture = Main.goreTexture[GoreDef.gores["Mod:Chain4"]]; 

            }

        }
    }
}
Save the file and it should be good!
 
First, download the chain texture that is in the Op, then in your mod folder, create a new .cs file called MPlayer.cs, copy this code into that file
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 Mod
{
    public class MPlayer : TAPI.ModPlayer
    {
        public override void PreUpdate()
        {
            int held_item = player.inventory[player.selectedItem].type;
            if (held_item == 163)
            {
                Main.chain3Texture = Main.goreTexture[GoreDef.gores["Mod:Chain4"]];

            }

        }
    }
}
Save the file and it should be good!
hmm.. it still seems to use the blue chain..
 
your flail uses the blue chain texture? then you have a different problem entirely, if blue moon uses the blue chain texture, then that is good, that's what the code is for.

EDIT: also which version of Tapi are you using? this hasn't been updated for r16
 
That's weird, that means something probably went wrong with the first part of the tutorial, would you mind posting the .cs .json for the flail?
sure.

cs

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 Mod
{
public class DarkFlail : ModItem
{
public override void HoldStyle(Player P)
{
Main.chain3Texture = Main.goreTexture[GoreDef.gores["Mod:ExampleChain"]];
}
}
}

json

{
"code": "DarkFlail",
"displayName": "The Mortician",
"size": [30,36],
"maxStack": 1,
"value": [0,0,0,0],
"rare": 5,
"pretendType": 163,
"useStyle": 5,
"useAnimation": 45,
"useTime": 30,
"damage": 200,
"knockback": 8,
"useSound": 1,
"noMelee": true,
"melee": true,
"shoot": "Mod:Darkball",
"shootSpeed": 18,
"noUseGraphic": true,
"channel": true,

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

cs

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 Mod
{
public class DarkFlail : ModItem
{
public override void HoldStyle(Player P)
{
Main.chain3Texture = Main.goreTexture[GoreDef.gores["Mod:ExampleChain"]];
}
}
}

json

{
"code": "DarkFlail",
"displayName": "The Mortician",
"size": [30,36],
"maxStack": 1,
"value": [0,0,0,0],
"rare": 5,
"pretendType": 163,
"useStyle": 5,
"useAnimation": 45,
"useTime": 30,
"damage": 200,
"knockback": 8,
"useSound": 1,
"noMelee": true,
"melee": true,
"shoot": "Mod:Darkball",
"shootSpeed": 18,
"noUseGraphic": true,
"channel": true,

"recipes":
[{
"items": { "Dirt Block": 1 },
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
The pretend type line may cause the problem, try removing it, and tell me if it doesn't work.
 
Back
Top Bottom