gardenapple
Steampunker
Anyway - it looks like Game Launcher isn't supported in 1.3.
Besides, I use it so I know it works.v3.2.1.7 for Terraria 1.3+
Anyway - it looks like Game Launcher isn't supported in 1.3.
Besides, I use it so I know it works.v3.2.1.7 for Terraria 1.3+
Besides, I use it so I know it works.
It seems like the path is hardcoded. I guess tModLoader changes the map format no matter what mods you have.lmao I just read the list of versions it allowed me to switch between - didn't see that at the top. Do you know if the save location issue is still a problem, or if I can change the save location? Surely I must be able to...
It seems like the path is hardcoded. I guess tModLoader changes the map format no matter what mods you have.
EDIT: wait! It seems like you could change the save path by changing the -savedirectory argument when you launch Terraria.exe. It's probably worth a try?
Every item from the mod becomes "unloaded".What exactly happens to your characters and worlds when you download this with other mods? What happens to your new characters when you uninstall? I just want to be safe here.
npc.ai[0]++;
if (npc.ai[0] > 80)
{
if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f)
{
Vector2 direction = Main.player[npc.target].Center - npc.Center;
direction.Normalize();
if (Main.rand.Next(2) == 0)
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
else
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicDagger"), 10, 1, Main.myPlayer, 0, 0);
}
npc.ai[0] = 0;
}
}
That's very simple, you'll just want to apply the same logic for four different projectiles:Every item from the mod becomes "unloaded".
I need help. How do I get it so my NPC, randomly shoots 4 different projectiles. I have the code for it to shoot 2, but I need more than that.
And second, how do you make the boss summon minions?Code:npc.ai[0]++; if (npc.ai[0] > 80) { if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); if (Main.rand.Next(2) == 0) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } else { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicDagger"), 10, 1, Main.myPlayer, 0, 0); } npc.ai[0] = 0; } }
int rand = Main.rand.Next(0, 4);
if(rand == 0)
{
// Projectile 1
}
else if(rand == 1)
{
// Projectile 2
}
else if(rand == 2)
{
// Projectile 3
}
else
{
// Projectile 4
}
What Method do I put that under, and how do I call the projectile again? The same way from my other boss code?That's very simple, you'll just want to apply the same logic for four different projectiles:
Code:int rand = Main.rand.Next(0, 4); if(rand == 0) { // Projectile 1 } else if(rand == 1) { // Projectile 2 } else if(rand == 2) { // Projectile 3 } else { // Projectile 4 }
Im assuming i put it under AI dont IWhat Method do I put that under, and how do I call the projectile again? The same way from my other boss code?
What Method do I put that under, and how do I call the projectile again? The same way from my other boss code?
[DOUBLEPOST=1453832143,1453832076][/DOUBLEPOST]
Im assuming i put it under AI dont I
if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f)
{
Vector2 direction = Main.player[npc.target].Center - npc.Center;
direction.Normalize();
// Right here
npc.ai[0] = 0;
}
Hang on, so you've got 4 monsters and you want only the last one to drop the loot? Just checking.Ok, and one last thing. Say I want it to act the twins, where loot only drops when they are both dead. How would I get that effect? My Monsters are gonna be call Codex1 Codex2 Codex3 and Codex4. sorry for all of these questions
yup. Also, Is there any way to slow down the spawning of projectiles? I just crashed from the immense amount of themHang on, so you've got 4 monsters and you want only the last one to drop the loot? Just checking.
yup. Also, Is there any way to slow down the spawning of projectiles? I just crashed from the immense amount of them
if (npc.ai[0] > 80)
public override void NPCLoot()
{
if(!NPC.AnyNPCs(mod.NPCType("Codex2")) && !NPC.AnyNPCs(mod.NPCType("Codex3")) && !NPC.AnyNPCs(mod.NPCType("Codex4"))
{
// Spawn your loot.
}
}
Ok, thanks. Your really helpful.See this check in your code? This basically checks if it's time to spawn another projectile. Increasing the '80' will result in a slower spawn rate of the projectiles.Code:if (npc.ai[0] > 80)
Then there's the spawning of loot. The twins just keep track of each others index in the Main.npc array and resolve that by checking if that NPC is still active. This is in your case, however, not possible (or at least not practical). I'd advice the following (while it's probably still not the best way to go about it, you can be sure that it works:
Now this code is only for the Codex1 NPC, since it checks if none of the other Codex's are active. You'll want to also place this code in the other NPCs, but of course change the types around.Code:public override void NPCLoot() { if(!NPC.AnyNPCs(mod.NPCType("Codex2")) && !NPC.AnyNPCs(mod.NPCType("Codex3")) && !NPC.AnyNPCs(mod.NPCType("Codex4")) { // Spawn your loot. } }
P.S.
Some little advice for the future: if someone gives you code, instead of straight away copy-pasting it, try 'copying' it by typing it out yourself. That way it might give you a little more insight in what's going on.
accully, I dont have that peice of codeOk, thanks. Your really helpful.
What piece of code are you referring to?Ok, thanks. Your really helpful.
[DOUBLEPOST=1453834511,1453834121][/DOUBLEPOST]
accully, I dont have that peice of code
the If (npc.ai[0] > 80)What piece of code are you referring to?
You did in the piece of code you showed me:the If (npc.ai[0] > 80)
if (npc.ai[0] > 80) // <----- HERE
{
if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f)
{
Vector2 direction = Main.player[npc.target].Center - npc.Center;
direction.Normalize();
if (Main.rand.Next(2) == 0)
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
else
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicDagger"), 10, 1, Main.myPlayer, 0, 0);
}
npc.ai[0] = 0;
}
}
Oh I mustve forgoten to copy thatYou did in the piece of code you showed me:
Code:if (npc.ai[0] > 80) // <----- HERE { if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); if (Main.rand.Next(2) == 0) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } else { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicDagger"), 10, 1, Main.myPlayer, 0, 0); } npc.ai[0] = 0; } }
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Enderuim.NPCs
{
//ported from my tAPI mod because I'm lazy
public class Codex2 : ModNPC
{
public override void SetDefaults()
{
npc.displayName = "Phantom Codex";
npc.aiStyle = -1;
npc.lifeMax = 50000;
npc.damage = 10;
npc.defense = 10;
npc.knockBackResist = 0f; //Immune to knockback
npc.width = 200;
npc.height = 200;
npc.value = Item.buyPrice(0, 2, 0, 0);
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.soundHit = 1;
npc.soundKilled = 1;
music = MusicID.Boss2;
}
public override void AI()
{
npc.TargetClosest(true);
if (npc.ai[0] > 80)
if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f)
{
Vector2 direction = Main.player[npc.target].Center - npc.Center;
direction.Normalize();
int rand = Main.rand.Next(0, 4);
if(rand == 0)
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
else if(rand == 1)
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
else if(rand == 2)
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
else
{
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0);
}
npc.ai[0] = 0;
}
Player player = Main.player[npc.target];
Vector2 moveTo = player.Center + new Vector2(0f, 200f);
float speed = 5f; //make this whatever you want
Vector2 move = moveTo - npc.Center; //this is how much your boss wants to move
float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y);
move *= speed / magnitude; //this adjusts your boss's speed so that its speed is always constant
npc.velocity = move;
}
}
That's because you're not even adding values to the npc.ai[0]...Oh I mustve forgoten to copy that
[DOUBLEPOST=1453835298,1453834937][/DOUBLEPOST]The Npc is no longer shooting the projectile at all.Code:using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Enderuim.NPCs { //ported from my tAPI mod because I'm lazy public class Codex2 : ModNPC { public override void SetDefaults() { npc.displayName = "Phantom Codex"; npc.aiStyle = -1; npc.lifeMax = 50000; npc.damage = 10; npc.defense = 10; npc.knockBackResist = 0f; //Immune to knockback npc.width = 200; npc.height = 200; npc.value = Item.buyPrice(0, 2, 0, 0); npc.boss = true; npc.lavaImmune = true; npc.noGravity = true; npc.noTileCollide = true; npc.soundHit = 1; npc.soundKilled = 1; music = MusicID.Boss2; } public override void AI() { npc.TargetClosest(true); if (npc.ai[0] > 80) if (npc.HasValidTarget && Main.player[npc.target].Distance(npc.Center) < 500f) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); int rand = Main.rand.Next(0, 4); if(rand == 0) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } else if(rand == 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } else if(rand == 2) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } else { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DemonicOrb"), 10, 1, Main.myPlayer, 0, 0); } npc.ai[0] = 0; } Player player = Main.player[npc.target]; Vector2 moveTo = player.Center + new Vector2(0f, 200f); float speed = 5f; //make this whatever you want Vector2 move = moveTo - npc.Center; //this is how much your boss wants to move float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y); move *= speed / magnitude; //this adjusts your boss's speed so that its speed is always constant npc.velocity = move; } }
npc.ai[0]++;
Sorry, I can be a noob very oftenThat's because you're not even adding values to the npc.ai[0]...
Above this line: 'if (npc.ai[0] > 80)' add:
Code:npc.ai[0]++;