using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Tesseract.NPCs.Boss
{
public class Sporish : ModNPC
{
public override void SetDefaults()
{
npc.name = "Sporish";
npc.displayName = "Sporish";
npc.aiStyle = 1;
npc.lifeMax = 5000;
npc.damage = 40;
npc.defense = 18;
npc.knockBackResist = 0f;
npc.width = 110;
npc.height = 125;
animationType = Terraria.ID.NPCID.BlueSlime;
Main.npcFrameCount[npc.type] = 4;
npc.value = Item.buyPrice(0, 1, 20, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = false;
npc.noTileCollide = false;
npc.buffImmune[24] = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
music = Terraria.ID.MusicID.Boss3;
npc.netAlways = false;
}
public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "Tesseract/NPCs/Boss/Sporish_Head_Boss";
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = Terraria.ID.ItemID.LesserHealingPotion;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale);
npc.damage = (int)(npc.damage * 0.6f);
}
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] >= 140)
{
float Speed = 10f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 13;
int type = mod.ProjectileType("LaunchingMushroom");
Main.PlaySound(10, (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;
}
if (npc.ai[0] % 600 == 3)
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("SporeHouse"));
}
npc.ai[1] += 0;
}
}
}
How long do you wait because you atleast need to wait like 30 seconds to get all the mods loaded in the browserTheres a problem with my tmodloader.
When i open the mod browser no mods show up
I need help with this ;-;
If you can help me with this ... thanks.
![]()
How long do you wait because you atleast need to wait like 30 seconds to get all the mods loaded in the browser
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Tesseract.Items.Weapons
{
public class DoomShroom : ModItem
{
public override void SetDefaults()
{
item.name = "Doom Shroom";
item.damage = 23;
item.ranged = true;
item.width = 50;
item.height = 25;
item.toolTip = "Neighbour! These Shrooms are protecting me from the zombie";
item.useTime = 38;
item.useAnimation = 38;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 7;
item.value = 10000;
item.rare = 2;
item.autoReuse = false;
item.shoot = 10;
item.shootSpeed = 10f;
item.useAmmo = ProjectileID.Bullet;
}
public static Vector2[] randomSpread(float speedX, float speedY, int angle, int num)
{
var posArray = new Vector2[num];
float spread = (float)(angle * 0.0174532925);
float baseSpeed = (float)System.Math.Sqrt(speedX * speedX + speedY * speedY);
double baseAngle = System.Math.Atan2(speedX, speedY);
double randomAngle;
for (int i = 0; i < num; ++i)
{
randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;
posArray[i] = new Vector2(baseSpeed * (float)System.Math.Sin(randomAngle), baseSpeed * (float)System.Math.Cos(randomAngle));
}
return (Vector2[])posArray;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2[] speeds = randomSpread(speedX, speedY, 8, 6);
for (int i = 0; i < 5; ++i)
{
Projectile.NewProjectile(position.X, position.Y, speeds[i].X, speeds[i].Y, type, damage, knockBack, player.whoAmI);
}
return false;
}
}
}
Take a look at ExampleGun in ExampleMod. Your item.useAmmo is wrong.I have another problem my gun isnt showing any ammo/is not shooting any bullets. Please Help!
Code:using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Tesseract.Items.Weapons { public class DoomShroom : ModItem { public override void SetDefaults() { item.name = "Doom Shroom"; item.damage = 23; item.ranged = true; item.width = 50; item.height = 25; item.toolTip = "Neighbour! These Shrooms are protecting me from the zombie"; item.useTime = 38; item.useAnimation = 38; item.useStyle = 5; item.noMelee = true; item.knockBack = 7; item.value = 10000; item.rare = 2; item.autoReuse = false; item.shoot = 10; item.shootSpeed = 10f; item.useAmmo = ProjectileID.Bullet; } public static Vector2[] randomSpread(float speedX, float speedY, int angle, int num) { var posArray = new Vector2[num]; float spread = (float)(angle * 0.0174532925); float baseSpeed = (float)System.Math.Sqrt(speedX * speedX + speedY * speedY); double baseAngle = System.Math.Atan2(speedX, speedY); double randomAngle; for (int i = 0; i < num; ++i) { randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread; posArray[i] = new Vector2(baseSpeed * (float)System.Math.Sin(randomAngle), baseSpeed * (float)System.Math.Cos(randomAngle)); } return (Vector2[])posArray; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2[] speeds = randomSpread(speedX, speedY, 8, 6); for (int i = 0; i < 5; ++i) { Projectile.NewProjectile(position.X, position.Y, speeds[i].X, speeds[i].Y, type, damage, knockBack, player.whoAmI); } return false; } } }
Haha I am so not good at coding Ty!Take a look at ExampleGun in ExampleMod. Your item.useAmmo is wrong.
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Tesseract.NPCs.Boss
{
public class Sporish : ModNPC
{
public override void SetDefaults()
{
npc.name = "Sporish";
npc.displayName = "Sporish";
npc.aiStyle = 1;
npc.lifeMax = 5000;
npc.damage = 40;
npc.defense = 18;
npc.knockBackResist = 0f;
npc.width = 110;
npc.height = 125;
animationType = Terraria.ID.NPCID.BlueSlime;
Main.npcFrameCount[npc.type] = 4;
npc.value = Item.buyPrice(0, 1, 20, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = false;
npc.noTileCollide = false;
npc.buffImmune[24] = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
music = Terraria.ID.MusicID.Boss3;
npc.netAlways = false;
}
public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "Tesseract/NPCs/Boss/Sporish_Head_Boss";
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = Terraria.ID.ItemID.LesserHealingPotion;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale);
npc.damage = (int)(npc.damage * 0.6f);
}
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] >= 140)
{
float Speed = 10f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 13;
int type = mod.ProjectileType("LaunchingMushroom");
Main.PlaySound(10, (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;
}
if (npc.ai[0] % 600 == 3)
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("SporeHouse"));
}
npc.ai[1] += 0;
}
}
}
To debug things like this, so something likeHaha I am so not good at coding Ty!
But can you help me with my other problem
I made a Boss that is supposed to Spawn NPCs but it won't.
Code:using System; using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Tesseract.NPCs.Boss { public class Sporish : ModNPC { public override void SetDefaults() { npc.name = "Sporish"; npc.displayName = "Sporish"; npc.aiStyle = 1; npc.lifeMax = 5000; npc.damage = 40; npc.defense = 18; npc.knockBackResist = 0f; npc.width = 110; npc.height = 125; animationType = Terraria.ID.NPCID.BlueSlime; Main.npcFrameCount[npc.type] = 4; npc.value = Item.buyPrice(0, 1, 20, 45); npc.npcSlots = 1f; npc.boss = true; npc.lavaImmune = true; npc.noGravity = false; npc.noTileCollide = false; npc.buffImmune[24] = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; music = Terraria.ID.MusicID.Boss3; npc.netAlways = false; } public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture) { bossHeadTexture = "Tesseract/NPCs/Boss/Sporish_Head_Boss"; } public override void BossLoot(ref string name, ref int potionType) { potionType = Terraria.ID.ItemID.LesserHealingPotion; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale); npc.damage = (int)(npc.damage * 0.6f); } 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] >= 140) { float Speed = 10f; Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); int damage = 13; int type = mod.ProjectileType("LaunchingMushroom"); Main.PlaySound(10, (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; } if (npc.ai[0] % 600 == 3) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("SporeHouse")); } npc.ai[1] += 0; } } }
Sorry but I don't know what you mean by that (my main language is not English) I will send the code of SporeHouse maybe that helps?To debug things like this, so something like
Main.NewText("SporeHouse id is " + mod.NPCType("SporeHouse"));
in that if statement before NPC.NewNPC and watch the chat, make sure it says the id is >0. If that's working, then you know the problem is the SporeHouse npc.
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Tesseract.NPCs
{
public class SporeHouse : ModNPC
{
public override void SetDefaults()
{
npc.name = "SporeHouse";
npc.displayName = "Spore House";
npc.width = 50;
npc.height = 42;
npc.damage = 10;
npc.defense = 15;
npc.lifeMax = 90;
npc.HitSound = SoundID.NPCHit16;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = 60f;
npc.knockBackResist = 0f;
npc.aiStyle = 0;
Main.npcFrameCount[npc.type] = 4;
aiType = NPCID.BlueSlime;
animationType = NPCID.BlueSlime;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter -= 0.5F;
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
npc.spriteDirection = npc.direction;
}
public override void NPCLoot()
{
}
}
}
I got it kinda? It says ID 581 i thought i wasnt spawning but it takes really long for her to spawn the Sporehouses how do i change it zo it spawn more often?Sorry but I don't know what you mean by that (my main language is not English) I will send the code of SporeHouse maybe that helps?
Code:using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Tesseract.NPCs { public class SporeHouse : ModNPC { public override void SetDefaults() { npc.name = "SporeHouse"; npc.displayName = "Spore House"; npc.width = 50; npc.height = 42; npc.damage = 10; npc.defense = 15; npc.lifeMax = 90; npc.HitSound = SoundID.NPCHit16; npc.DeathSound = SoundID.NPCDeath1; npc.value = 60f; npc.knockBackResist = 0f; npc.aiStyle = 0; Main.npcFrameCount[npc.type] = 4; aiType = NPCID.BlueSlime; animationType = NPCID.BlueSlime; } public override void FindFrame(int frameHeight) { npc.frameCounter -= 0.5F; npc.frameCounter %= Main.npcFrameCount[npc.type]; int frame = (int)npc.frameCounter; npc.frame.Y = frame * frameHeight; npc.spriteDirection = npc.direction; } public override void NPCLoot() { } } }
That's because the Mod Browser is offline.I don't understand. When I open the game and open Mod Browser, the mods don't show up and if they show up, they suddenly start to copy and then Mod Browser becomes Offline for an unknown reason. I don't know why???!!!
I don't understand. When I open the game and open Mod Browser, the mods don't show up and if they show up, they suddenly start to copy and then Mod Browser becomes Offline for an unknown reason. I don't know why???!!!
I think this is due to the fact that the game is not licensed.