Mr Underhill
Skeletron Prime
Sure, here you go:Hm, can I see all the relevant files?
Sure, here you go:Hm, can I see all the relevant files?
Try adding this line to your .json fileSure, here you go:
Hm, first of all, for your item's .json, you'll want the useStyle to be 5, noUseGraphic to be true, and noMelee to be true. You'll also want to use the shoot and shootSpeed properties to for your spear's projectile (since spears are actually projectiles).Sure, here you go:
{
"displayName": "Weapon Name",
"width": 18,
"height": 18,
"melee": true,
"friendly": true,
"tileCollide": false,
"ignoreWater": true,
"penetrate": -1,
"hide": true,
"ownerHitCheck": true,
"melee": true
}
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using TAPI;
namespace ModName.Projectiles {
public class WeaponName : ModProjectile
{
public override void AI()
{
Player player = Main.player[projectile.owner];
projectile.direction = player.direction;
player.heldProj = projectile.whoAmI;
player.itemTime = player.itemAnimation;
projectile.position = player.Center - projectile.Size / 2f;
if(!player.frozen)
{
if(projectile.ai[0] == 0f)
{
projectile.ai[0] = 3f;//spear's starting distance
projectile.netUpdate = true;
}
if(player.itemAnimation < player.itemAnimationMax / 3)
{
projectile.ai[0] -= 2.4f;//spear's retreating speed
}
else
{
projectile.ai[0] += 2.1f;//spear's forward speed
}
}
projectile.position += projectile.velocity * projectile.ai[0];
if(player.itemAnimation == 0)
{
projectile.Kill();
}
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
if(projectile.spriteDirection == -1)
{
projectile.rotation -= 1.57f;
}
}
public override bool PreDraw(SpriteBatch sb)
{
projectile.aiStyle = 19;
return true;
}
public override void PostDraw(SpriteBatch sb)
{
projectile.aiStyle = 0;
}
}}
This is what I ended up with and my mod's .jsons won't load in tAPI.Hm, first of all, for your item's .json, you'll want the useStyle to be 5, noUseGraphic to be true, and noMelee to be true. You'll also want to use the shoot and shootSpeed properties to for your spear's projectile (since spears are actually projectiles).
For the projectile (not the item), you want the spear's tip to be pointing to the top left. Then you'll want the following properties:
Finally, you'll need a .cs file for your projectile:Code:{ "displayName": "Weapon Name", "width": 18, "height": 18, "melee": true, "friendly": true, "tileCollide": false, "ignoreWater": true, "penetrate": -1, "hide": true, "ownerHitCheck": true, "melee": true }
Code:using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using TAPI; namespace ModName.Projectiles { public class WeaponName : ModProjectile { public override void AI() { Player player = Main.player[projectile.owner]; projectile.direction = player.direction; player.heldProj = projectile.whoAmI; player.itemTime = player.itemAnimation; projectile.position = player.Center - projectile.Size / 2f; if(!player.frozen) { if(projectile.ai[0] == 0f) { projectile.ai[0] = 3f;//spear's starting distance projectile.netUpdate = true; } if(player.itemAnimation < player.itemAnimationMax / 3) { projectile.ai[0] -= 2.4f;//spear's retreating speed } else { projectile.ai[0] += 2.1f;//spear's forward speed } } projectile.position += projectile.velocity * projectile.ai[0]; if(player.itemAnimation == 0) { projectile.Kill(); } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f; if(projectile.spriteDirection == -1) { projectile.rotation -= 1.57f; } } public override bool PreDraw(SpriteBatch sb) { projectile.aiStyle = 19; return true; } public override void PostDraw(SpriteBatch sb) { projectile.aiStyle = 0; } }}
Try moving the shootSpeed property from the projectile to the item (and also making it lower). Also don't forget the .cs file.This is what I ended up with and my mod's .jsons won't load in tAPI.
What .cs file?Try moving the shootSpeed property from the projectile to the item (and also making it lower). Also don't forget the .cs file.
This one:What .cs file?
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using TAPI;
namespace ModName.Projectiles {
public class WeaponName : ModProjectile
{
public override void AI()
{
Player player = Main.player[projectile.owner];
projectile.direction = player.direction;
player.heldProj = projectile.whoAmI;
player.itemTime = player.itemAnimation;
projectile.position = player.Center - projectile.Size / 2f;
if(!player.frozen)
{
if(projectile.ai[0] == 0f)
{
projectile.ai[0] = 3f;//spear's starting distance
projectile.netUpdate = true;
}
if(player.itemAnimation < player.itemAnimationMax / 3)
{
projectile.ai[0] -= 2.4f;//spear's retreating speed
}
else
{
projectile.ai[0] += 2.1f;//spear's forward speed
}
}
projectile.position += projectile.velocity * projectile.ai[0];
if(player.itemAnimation == 0)
{
projectile.Kill();
}
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
if(projectile.spriteDirection == -1)
{
projectile.rotation -= 1.57f;
}
}
public override bool PreDraw(SpriteBatch sb)
{
projectile.aiStyle = 19;
return true;
}
public override void PostDraw(SpriteBatch sb)
{
projectile.aiStyle = 0;
}
}}
Here is what I have now, the game loads but no projectile is being produced when I activate the spear.This one:
Also posted it earlier, that version has indentations. Guess for some reason copying it over to here removed the indentations.Code:using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using TAPI; namespace ModName.Projectiles { public class WeaponName : ModProjectile { public override void AI() { Player player = Main.player[projectile.owner]; projectile.direction = player.direction; player.heldProj = projectile.whoAmI; player.itemTime = player.itemAnimation; projectile.position = player.Center - projectile.Size / 2f; if(!player.frozen) { if(projectile.ai[0] == 0f) { projectile.ai[0] = 3f;//spear's starting distance projectile.netUpdate = true; } if(player.itemAnimation < player.itemAnimationMax / 3) { projectile.ai[0] -= 2.4f;//spear's retreating speed } else { projectile.ai[0] += 2.1f;//spear's forward speed } } projectile.position += projectile.velocity * projectile.ai[0]; if(player.itemAnimation == 0) { projectile.Kill(); } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f; if(projectile.spriteDirection == -1) { projectile.rotation -= 1.57f; } } public override bool PreDraw(SpriteBatch sb) { projectile.aiStyle = 19; return true; } public override void PostDraw(SpriteBatch sb) { projectile.aiStyle = 0; } }}
Try renaming Aegos.cs to AegosProj.cs (and the same name change for the class name), then moving that file to the Projectiles folder.Here is what I have now, the game loads but no projectile is being produced when I activate the spear.
[DOUBLEPOST=1432171051,1432170994][/DOUBLEPOST]Sorry, the .zip files are both the same. It doubled my post for some reason..
Okay, it is producing a projectile now, but it is going super far like an anti-gravity arrow.Try renaming Aegos.cs to AegosProj.cs (and the same name change for the class name), then moving that file to the Projectiles folder.
Try lowering your item's shootSpeed by, like, a lot. Also feel free to adjust the commented parts in the .cs file.Okay, it is producing a projectile now, but it is going super far like an anti-gravity arrow.
View attachment 53009
Thank you!Try lowering your item's shootSpeed by, like, a lot. Also feel free to adjust the commented parts in the .cs file.
One more thing, do you know of a place where I can get a list of all the .cs effect lines? Examples would be p.maxMinions += 1; or p.thorns = 1.5f;.
It depends what you want your icon to look like, I can probably do it sometime tomorrow, Can anyone help me with making an addition to the player interface?Can someone help me draw an icon?
It depends what you want your icon to look like, I can probably do it sometime tomorrow, Can anyone help me with making an addition to the player interface?
Could someone please help me with this?How would I make an item that opens locked gold chests, and never gets consumed?