A_judgementalLizard
Terrarian
If you are reading this thread, you likely know how to create at least a basic item/weapon, if that's the case: Good! you can move right on to the next section.
However you may be completely new to modding in general in which case I wouldn't recommend starting with this.
Instead read this Tutorial first,
http://forums.terraria.org/index.php?threads/getting-started-with-modding.7832/
it covers a lot of basics in modding and will help you get started.
Now onto the real tutorial.
I hope this was helpful to you, and, if not please tell me why!
(for more projectile special effects and code visit this tutorial by Sin Costan
http://forums.terraria.org/index.php?threads/tutorial-projectile-guide-and-implementation.13048/ )
Currently there is a small bug with this code that changes the blue moon's chain texture into your modded one, I am trying to work this out, however if I remove the line of code that causes the problem, it will change your modded flail into the blue moon's chain texture
Great thanks to Everybody for helping me figure out how to do this
However you may be completely new to modding in general in which case I wouldn't recommend starting with this.
Instead read this Tutorial first,
http://forums.terraria.org/index.php?threads/getting-started-with-modding.7832/
it covers a lot of basics in modding and will help you get started.
Now onto the real tutorial.
In this tutorial you will learn how to make a basic flail type weapon edit its stats.
It will be divided into three parts telling you how to make the chain of the flail, the actual flail, and the item
It will be divided into three parts telling you how to make the chain of the flail, the actual flail, and the item
Creating the chain
In your mod folder, create another folder called Gores
inside this folder create a .png called ExampleChain
For now you can just use this one
(provided by Zoomo)
Great! you're done with step one.
In your mod folder, create another folder called Gores
inside this folder create a .png called ExampleChain
For now you can just use this one
Great! you're done with step one.
Creating the item
Step 1:
In your mod folder create another folder called Items
in that folder make a new Item json called ExampleFlail
inside that file use this code
After you've done that you will need an image for you flail item
for now just use this
(Provided by Zoomo).
Finally you need your item CS file which will look something like this
And that's it for your item.
Step 1:
In your mod folder create another folder called Items
in that folder make a new Item json called ExampleFlail
inside that file use this code
Code:
{
"code": "ExampleFlail",
"displayName": "Example Flail",
"size": [30,36],
"maxStack": 1,
"value": [0,0,0,0],
"rare": 0,
"pretendType": 163,
"useStyle": 5,
"useAnimation": 45,
"useTime": 30,
"damage": 30,
"knockback": 8,
"useSound": 1,
"noMelee": true,
"melee": true,
"shoot": "YourModNameHere:ExampleBall",
"shootSpeed": 18,
"noUseGraphic": true,
"channel": true,
"recipes":
[{
"items": { "Dirt Block": 1 },
"tiles": [ "Work Bench" ],
"creates": 1
}]
}
for now just use this
Finally you need your item CS file which will look something like this
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 YourModNameHere
{
public class ExampleFlail : ModItem
{
public override void HoldStyle(Player P)
{
Main.chain3Texture = Main.goreTexture[GoreDef.gores["YourModNameHere:ExampleChain"]];
}
}
}
The Flail Projectile
Yet again in your mod folder create a new folder called Projectiles
inside that folder you will make three files.
Number one will be the .png file, which will be you flail head(the actual mace part)
just use this sprite for now
(also provided by Zoomo)
then lets move onto your projectiles json code
And now your .json is finished
moving on to the .cs of your projectile
you can put extra code in here for your projectile to have extra special effects(more on that later)
And now you should have a working flail!, which you can edit and use to your hearts content.
Yet again in your mod folder create a new folder called Projectiles
inside that folder you will make three files.
Number one will be the .png file, which will be you flail head(the actual mace part)
just use this sprite for now
then lets move onto your projectiles json code
Code:
{
"displayName": "Example Ball",
"size": [30, 30], //size in this projectile means the hitbox, so it can be as big or small as you want.
"aiStyle": 15,
"friendly": true,
"hostile": false,
"tileCollide": true,
"damage": 30,
"melee": true,
"penetrate": 40
}
moving on to the .cs of your projectile
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace YourModNameHere.Projectiles
{
public class ExampleBall : ModProjectile
{
}
}
First download this image and put it in your gore folder with the other chain texture
Then in your mod folder create a file to modify your player class, it should look something like this
and now whenever you switch to the bluemoon it will change its texture.
Then in your mod folder create a file to modify your player class, it should look something like this
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"]]; //don't change any of this code
}
}
}
}
(for more projectile special effects and code visit this tutorial by Sin Costan
http://forums.terraria.org/index.php?threads/tutorial-projectile-guide-and-implementation.13048/ )
Currently there is a small bug with this code that changes the blue moon's chain texture into your modded one, I am trying to work this out, however if I remove the line of code that causes the problem, it will change your modded flail into the blue moon's chain texture
Great thanks to Everybody for helping me figure out how to do this
Last edited: