RinGodOfAnger
Official Terrarian
Hey I'm trying to make the code for a Terraria Eevee NPC, but it keeps saying ''A namespace cannot directly contain members such as fields or methods'', can someone help me? this is the code so far:
public static bool TownSpawn() {
if(Main.hardMode)
return true;
else
return false;
}
public static string SetName () {
int result = Main.rand.Next(4);
string name = "";
if (result == 0)
{
name = "Loneliness";
}
else if (result == 1)
{
name = "Lonliness";
}
return name;
}
public static string Chat() {
int result = Main.rand.Next(3);
string text = "";
if (result == 0)
{
text = "Go away...";
}
else if (result == 1)
{
text = "Hello...";
}
else if (result == 2)
{
text = "Why have I got red eyes? BECAUSE I'M DEAD YOU IDIOT";
}
else if (result == 3)
{
text = "What do you mean my unholy arrows are expencive... ):";
}
return text;
}
public static void SetupShop(Chest chest) {
int index=0;
chest.item[index].SetDefaults("CorruptionKey");
chest.item[index].value = 55000;
index++;
chest.item[index].SetDefaults("CrimsonKey");
chest.item[index].value = 55000;
index++;
chest.item[index].SetDefaults("ShadowScale");
chest.item[index].value = 5000;
index++;
chest.item[index].SetDefaults("UnholyArrow");
chest.item[index].value = 1040;
index++;
chest.item[index].SetDefaults("UnholyWater");
chest.item[index].value = 40;
index++;
chest.item[index].SetDefaults("UnholyTrident");
chest.item[index].value = 700000;
index++;
}
public static bool TownSpawn() {
if(Main.hardMode)
return true;
else
return false;
}
public static string SetName () {
int result = Main.rand.Next(4);
string name = "";
if (result == 0)
{
name = "Loneliness";
}
else if (result == 1)
{
name = "Lonliness";
}
return name;
}
public static string Chat() {
int result = Main.rand.Next(3);
string text = "";
if (result == 0)
{
text = "Go away...";
}
else if (result == 1)
{
text = "Hello...";
}
else if (result == 2)
{
text = "Why have I got red eyes? BECAUSE I'M DEAD YOU IDIOT";
}
else if (result == 3)
{
text = "What do you mean my unholy arrows are expencive... ):";
}
return text;
}
public static void SetupShop(Chest chest) {
int index=0;
chest.item[index].SetDefaults("CorruptionKey");
chest.item[index].value = 55000;
index++;
chest.item[index].SetDefaults("CrimsonKey");
chest.item[index].value = 55000;
index++;
chest.item[index].SetDefaults("ShadowScale");
chest.item[index].value = 5000;
index++;
chest.item[index].SetDefaults("UnholyArrow");
chest.item[index].value = 1040;
index++;
chest.item[index].SetDefaults("UnholyWater");
chest.item[index].value = 40;
index++;
chest.item[index].SetDefaults("UnholyTrident");
chest.item[index].value = 700000;
index++;
}