c:\Users\Convidado\Documents\My Games\Terraria\ModLoader\Mod Sources\TerraZ\TerraZ.cs(31,2) : error CS1513: } esperada
[doublepost=1509912380,1509912152][/doublepost]c:\Users\Convidado\Documents\My Games\Terraria\ModLoader\Mod Sources\TerraZ\MWorld.cs(26,25) : error CS0246: O nome de namespace ou o tipo 'TagCompound' não pôde ser encontrado. Precisa de uma diretiva using ou de uma referência de assembly?using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace TerraZ
{
public class MMod : Mod
{
public MMod()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
}
//Setting music to 1 which is “Night”
public override void UpdateMusic(ref int music)
{
//Checks if the invasion is in the correct spot, if it is, then change the music
(Main.invasionX == Main.spawnTileX)
{
music = 1;
}
}
}
c:\Users\Convidado\Documents\My Games\Terraria\ModLoader\Mod Sources\TerraZ\MWorld.cs(37,35) : error CS0246: O nome de namespace ou o tipo 'TagCompound' não pôde ser encontrado. Precisa de uma diretiva using ou de uma referência de assembly?
c:\Users\Convidado\Documents\My Games\Terraria\ModLoader\Mod Sources\TerraZ\MWorld.cs(44,38) : error CS0246: O nome de namespace ou o tipo 'BinaryWriter' não pôde ser encontrado. Precisa de uma diretiva using ou de uma referência de assembly?
c:\Users\Convidado\Documents\My Games\Terraria\ModLoader\Mod Sources\TerraZ\MWorld.cs(52,41) : error CS0246: O nome de namespace ou o tipo 'BinaryReader' não pôde ser encontrado. Precisa de uma diretiva using ou de uma referência de assembly?
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace TerraZ
{
public class MWorld : ModWorld
{
//Setting up variables for invasion
public static bool customInvasionUp = false;
public static bool downedCustomInvasion = false;
//Initialize all variables to their default values
public override void Initialize()
{
Main.invasionSize = 0;
customInvasionUp = false;
downedCustomInvasion = false;
}
//Save downed data
public override TagCompound Save()
{
var downed = new List<string>();
if (downedCustomInvasion) downed.Add("ZombieInvasion");
return new TagCompound {
{"downed", downed}
};
}
//Load downed data
public override void Load(TagCompound tag)
{
var downed = tag.GetList<string>("downed");
downedCustomInvasion = downed.Contains("ZombieInvasion");
}
//Sync downed data
public override void NetSend(BinaryWriter writer)
{
BitsByte flags = new BitsByte();
flags[0] = downedCustomInvasion;
writer.Write(flags);
}
//Sync downed data
public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
downedCustomInvasion = flags[0];
}
//Allow to update invasion while game is running
public override void PostUpdate()
{
if(customInvasionUp)
{
if(Main.invasionX == (double)Main.spawnTileX)
{
//Checks progress and reports progress only if invasion at spawn
CustomInvasion.CheckCustomInvasionProgress();
}
//Updates the custom invasion while it heads to spawn point and ends it
CustomInvasion.UpdateCustomInvasion();
}
}
}
}
I realised how stupid my question is, let me repeat.Is there a code that would show a progres bar ?
Rather where.
NetMessage.SendData(78, p.whoAmI, -1, null, Main.invasionSizeStart - Main.invasionSize, (float)Main.invasionSizeStart, (float)(Main.invasionType + 3), 0f, 0, 0, 0);
NetMessage.SendData(78, p.whoAmI, -1, null, Main.invasionSizeStart - Main.invasionSize, (float)Main.invasionSizeStart, (float)(Main.invasionType), 0f, 0, 0, 0);
hey sin costan, the skeleton banner is an item and it says "The dungeon beckons you..." but nothing happens. I've tried to cause an error log, but there aren't even warnings. the code is a bit advanced for me so I have no idea how to fix. can you help plz?
easy just make the M's capital or you need to put: Using [name of mod].[name of npcs folder].[anymore folders your enemys are in]I need help with my invasion which involves modded NPCs.
Here's the code:
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;
namespace TurquoiseStuff
{
public class PumpkinLegion
{
public static int[] invaders = {
mod.NPCType("PumpFloater"),
mod.NPCType("PumpkinMagus"),
mod.NPCType("HeadlessWarrior"),
mod.NPCType("WalkingPumpkin")
};
public static void StartPumpkinLegion()
{
if (Main.invasionType != 0 && Main.invasionSize == 0)
{
Main.invasionType = 0;
}
if (Main.invasionType == 0)
{
int numPlayers = 0;
for (int i = 0; i < 255; i++)
{
if (Main.player.active && Main.player.statLifeMax >= 200)
{
numPlayers++;
}
}
if (numPlayers > 0)
{
Main.invasionType = -1;
TurquoiseWorld.pumpkinLegionUp = true;
Main.invasionSize = 100 * numPlayers;
Main.invasionSizeStart = Main.invasionSize;
Main.invasionProgress = 0;
Main.invasionProgressIcon = 0 + 3;
Main.invasionProgressWave = 0;
Main.invasionProgressMax = Main.invasionSizeStart;
Main.invasionWarn = 3600;
if (Main.rand.Next(2) == 0)
{
Main.invasionX = 0.0;
return;
}
Main.invasionX = (double)Main.maxTilesX;
}
}
}
public static void PumpkinLegionWarning()
{
String text = "";
if (Main.invasionX == (double)Main.spawnTileX)
{
text = "The Pumpkin Legion has arrived!";
}
if (Main.invasionSize <= 0)
{
text = "The Pumpkin Legion has retreated.";
}
if (Main.netMode == 0)
{
Main.NewText(text, 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, NetworkText.FromLiteral(text), 255, 175f, 75f, 255f, 0, 0, 0);
}
}
public static void UpdatePumpkinLegion()
{
if (TurquoiseWorld.pumpkinLegionUp)
{
if(Main.invasionSize <= 0)
{
TurquoiseWorld.pumpkinLegionUp = false;
PumpkinLegionWarning();
Main.invasionType = 0;
Main.invasionDelay = 0;
}
if (Main.invasionX == (double)Main.spawnTileX)
{
return;
}
float moveRate = (float)Main.dayRate;
if (Main.invasionX > (double)Main.spawnTileX)
{
Main.invasionX -= (double)moveRate;
if (Main.invasionX <= (double)Main.spawnTileX)
{
Main.invasionX = (double)Main.spawnTileX;
PumpkinLegionWarning();
}
else
{
Main.invasionWarn--;
}
}
else
{
if (Main.invasionX < (double)Main.spawnTileX)
{
Main.invasionX += (double)moveRate;
if (Main.invasionX >= (double)Main.spawnTileX)
{
Main.invasionX = (double)Main.spawnTileX;
PumpkinLegionWarning();
}
else
{
Main.invasionWarn--;
}
}
}
}
}
public static void CheckPumpkinLegionProgress()
{
if (Main.invasionProgressMode != 2)
{
Main.invasionProgressNearInvasion = false;
return;
}
bool flag = false;
Player player = Main.player[Main.myPlayer];
Rectangle rectangle = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight);
int num = 5000;
int icon = 3;
for (int i = 0; i < 200; i++)
{
if (Main.npc.active)
{
icon = 3;
int type = Main.npc.type;
for(int n = 0; n < invaders.Length; n++)
{
if(type == invaders[n])
{
Rectangle value = new Rectangle((int)(Main.npc.position.X + (float)(Main.npc.width / 2)) - num, (int)(Main.npc.position.Y + (float)(Main.npc.height / 2)) - num, num * 2, num * 2);
if (rectangle.Intersects(value))
{
flag = true;
break;
}
}
}
}
}
Main.invasionProgressNearInvasion = flag;
int progressMax3 = 1;
if(TurquoiseWorld.pumpkinLegionUp)
{
progressMax3 = Main.invasionSizeStart;
}
if(TurquoiseWorld.pumpkinLegionUp && (Main.invasionX == (double)Main.spawnTileX))
{
Main.ReportInvasionProgress(Main.invasionSizeStart - Main.invasionSize, progressMax3, icon, 0);
}
foreach(Player p in Main.player)
{
NetMessage.SendData(78, p.whoAmI, -1, null, Main.invasionSizeStart - Main.invasionSize, (float)Main.invasionSizeStart, (float)(Main.invasionType + 3), 0f, 0, 0, 0);
}
}
}
}
And here's the error:
Mod Sources\TurquoiseStuff\PumpkinLegion.cs(17,4) : error CS0103: The name 'mod' does not exist in the current context
Try to delete MMod fileI am having problem with the invasion it says: "make sure you have exactly one class extending mod" what does that mean
easy just make the M's capital or you need to put: Using [name of mod].[name of npcs folder].[anymore folders your enemys are in]
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace NewJourney
{
public class NewJourneyNPC : GlobalNPC
{
//Change the spawn pool
public override void EditSpawnPool(IDictionary< int, float > pool, NPCSpawnInfo spawnInfo)
{
if(Modworld.jungleInvasionUp)
{
//Clear pool so that only the stuff you want spawns
pool.Clear();
if(NPC.downedQueenBee) {
//key = NPC ID | value = spawn weight
//pool.add(key, value)
foreach(int i in JungleInvasion.PreHardmodeInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
}
if(NPC.downedPlantBoss) {
foreach(int i in JungleInvasion.HardmodeInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
foreach(int i in JungleInvasion.PreHardmodeInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
}
if(NPC.downedMoonlord) {
foreach(int i in JungleInvasion.MoonlordInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
foreach(int i in JungleInvasion.HardmodeInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
foreach(int i in JungleInvasion.PreHardmodeInvaders)
{
pool.Add(i, 1f); //Add it to the pool with the same weight of 1
}
}
}
}
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
//Change spawn stuff if invasion up and invasion at spawn
if(Modworld.jungleInvasionUp)
{
spawnRate = 50; //Higher the number, the more spawns
maxSpawns = 100; //Max spawns of NPCs depending on NPC value
}
}
public override void PostAI(NPC npc)
{
//Changes NPCs so they do not despawn when invasion up and invasion at spawn
if(Modworld.jungleInvasionUp)
{
npc.timeLeft = 1000;
}
}
public override void NPCLoot(NPC npc)
{
if(Modworld.jungleInvasionUp && NPC.downedQueenBee)
{
foreach(int invader in JungleInvasion.PreHardmodeInvaders)
{
if(npc.type == invader)
{
Main.invasionSize -= 1;
}
}
}
if(Modworld.jungleInvasionUp && Main.hardMode && NPC.downedPlantBoss)
{
foreach(int invader in JungleInvasion.HardmodeInvaders)
{
//If npc type equal to invader's ID decrement size to progress invasion
if(npc.type == invader)
{
Main.invasionSize -= 1;
}
}
}
if(Modworld.jungleInvasionUp && Main.hardMode && NPC.downedMoonlord)
{
foreach(int invader in JungleInvasion.HardmodeInvaders)
{
//If npc type equal to invader's ID decrement size to progress invasion
if(npc.type == invader)
{
Main.invasionSize -= 1;
}
}
}
}
}
}