Eldrazi
Eater of Worlds
Allright, so you've set Main.npcFrameCount[npc.type] to 3, while you only have 2 frames of animation. So you need to change that.View attachment 156274 Here is my setdefaults code
Allright, so you've set Main.npcFrameCount[npc.type] to 3, while you only have 2 frames of animation. So you need to change that.View attachment 156274 Here is my setdefaults code
You might also want to use aiType, then. Try setting aiType = 6; in the SetDefaults too.It now shows up as a full sprite but 2nd frame is 2 lines for some reason and it still doesnt fly with AIStyle = 5
Maybe add this line:For the AI aiType = 6 or aiType = 5 didnt work. View attachment 156276
aiType = NPCID.EaterofSouls;
Allright, first of all lets go for some animation code I'm almost completely sure will work:For the AI aiType = 6 or aiType = 5 didnt work. View attachment 156276
public override void FindFrame(int frameHeight)
{
if (npc.frameCounter++ >= 10)
{
npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight);
npc.frameCounter = 0;
}
npc.spriteDirection = npc.direction;
}
Allright, the AI code you have might actually interfere with the vanilla AI you're calling.The Sprites work but the AI still doesnt :/ it still is standing in one place
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Threading.Tasks;
namespace MiscItems.NPCs
{
class PuritySpirit : ModNPC
{
public override void SetDefaults()
{
npc.name = "PuritySpirit";
npc.displayName = "Purity Spirit";
npc.width = 80;
npc.height = 320;
npc.damage = 50;
npc.defense = 5;
npc.lifeMax = 400;
npc.value = 60f;
npc.knockBackResist = 0.5f;
aiType = NPCID.EaterofSouls;
Main.npcFrameCount[npc.type] = 2;
}
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.player.ZoneHoly)
return 0.5F;
return 0;
}
public override void NPCLoot() //Npc drop
{
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulOfPurity"), 2); //Item spawn
}
}
public override void FindFrame(int frameHeight)
{
if (npc.frameCounter++ >= 10)
{
npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight);
npc.frameCounter = 0;
}
npc.spriteDirection = npc.direction;
}
public override void AI()
{
npc.ai[0]++;
Player P = Main.player[npc.target];
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
{
npc.TargetClosest(true);
}
npc.netUpdate = true;
npc.ai[1]++;
if (npc.ai[1] >= 150) // 230 is projectile fire rate
{
float Speed = 10f; //projectile speed
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 30; //projectile damage
int type = mod.ProjectileType("PuritySpiritProjectile"); //put your projectile
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
npc.ai[1] = 0;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Threading.Tasks;
namespace MiscItems.NPCs
{
class PuritySpirit : ModNPC
{
public override void SetDefaults()
{
npc.name = "PuritySpirit";
npc.displayName = "Purity Spirit";
npc.width = 80;
npc.height = 320;
npc.damage = 50;
npc.defense = 5;
npc.lifeMax = 400;
npc.value = 60f;
npc.knockBackResist = 0.5f;
aiType = NPCID.EaterofSouls;
Main.npcFrameCount[npc.type] = 2;
}
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.player.ZoneHoly)
return 0.5F;
return 0;
}
public override void NPCLoot() //Npc drop
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulOfPurity"), 2); //Item spawn
}
public override void FindFrame(int frameHeight)
{
if (npc.frameCounter++ >= 10)
{
npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight);
npc.frameCounter = 0;
}
npc.spriteDirection = npc.direction;
}
int timer;
public override void AI()
{
Player P = Main.player[npc.target];
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
{
npc.TargetClosest(true);
}
npc.netUpdate = true;
timer++;
if (timer >= 150) // 230 is projectile fire rate
{
float Speed = 10f; //projectile speed
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 30; //projectile damage
int type = mod.ProjectileType("PuritySpiritProjectile"); //put your projectile
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
timer = 0;
}
}
}
}
Lol, I just noticed... You replaced npc.aiStyle with aiType. You need both:I tried your code but it still is standing still :/
npc.aiStyle = 5;
aiType = NPCID.EaterofSouls;
That's actually fairly simple. If you know how to create a 'normal' item, all you want to add is:Do any of you know how to make a custom health potion i will like to know
public override void SetDefaults()
{
// Things like name, width, height, etc.
item.useStyle = 2;
item.useAnimation = 17;
item.useTime = 17;
item.useTurn = false;
// The amount of life that's healed when using the potion.
this.healLife = 15;
this.consumable = true;
this.potion = true;
}
So it's more like a fighter AI?Now that thing moves but... its going backwards and staying on the ground...
using Microsoft.Xna.Framework.Audio;
using Terraria;
using Terraria.ModLoader;
namespace ModOfRandomness.Sounds
{
public class TheViolinSound : ModSound
{
public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
{
soundInstance = sound.CreateInstance();
soundInstance.Volume = volume * .5f;
soundInstance.Pan = pan;
soundInstance.Pitch = -1.0f;
return soundInstance;
}
}
}
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ModOfRandomness.Items
{
public class TheViolin : ModItem
{
public override void SetDefaults()
{
item.name = "The Violin"; //the name displayed when hovering over the Weapon ingame.
item.damage = 24; //The damage stat for the Weapon.
item.melee = true; //This defines if it does Melee damage and if its effected by Melee increasing Armor/Accessories.
item.width = 58; //The size of the width of the hitbox in pixels.
item.height = 58; //The size of the height of the hitbox in pixels.
item.toolTip = "There is someone out there who uses a violin for smashing zombies faces in..."; //The description of the Weapon shown when hovering over the Weapon ingame.
item.useTime = 10; //How fast the Weapon is used.
item.useAnimation = 10; //How long the Weapon is used for.
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example
item.knockBack = 6; //The knockback stat of your Weapon.
item.value = Item.buyPrice(0, 1, 0, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold)
item.rare = 2; //The color the title of your Weapon when hovering over it ingame
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/TheViolinSound");
item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again.
}
}
}
Have you made sure to set npc.noGravity = true; in the SetDefaults of your NPC?Yes it looks like a fighter AI with shooting projectiles and head in the ground
I'm not really sure what you mean; could you elaborate?Also if any1 knows how pls tell me - how do i keep mana at 0 while keeping the mana stars with an accessory?
i mean so your out of mana all the time. i accidently drained my mana on 1 charecter to -30k+ with a wrong codeI'm not really sure what you mean; could you elaborate?
Can't you just set player.statMana = 0; ?i mean so your out of mana all the time. i accidently drained my mana on 1 charecter to -30k+ with a wrong code