Qzim45
Terrarian
I don't know what i'm doing wrong but my code don't work:It's very similar to the previous code, call NPC.NewNPC() rather than NPC.SpawnOnPlayer(), and use MessageID.SyncNPC for the netcode part
public override void OnConsumeItem(Player player)
{
int NPCType = rnd.Next(-65, 578);
int npcid = NPC.NewNPC(new EntitySource_ItemUse(player, Item.ModItem.Item), (int)player.Center.X, (int)player.Center.Y, NPCType);
NetMessage.SendData(MessageID.SyncNPC, number: npcid);
}
And why at description of NewNPC() method says "This method should't be called on multiplayer clients"?