PC Error CS0115

RexTerm

Terrarian
So I recently started Terraria modding and came across this problem:
c:\Users\ron\Documents\My Games\Terraria\ModLoader\Mod Sources\ModOne\NPCs\FlyingS.cs(30,31) : error CS0115: 'ModOne.NPCs.FlyingS.CanSpawn(Terraria.ModLoader.NPCSpawnInfo)': no suitable method found to override

I copied the line from an old modding tutorial so i'm not surprised there were gonna be errors.:red2:
Not sure if this is where i should put this thread tho.
Here's my code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

//By Al0n37
namespace ModOne.NPCs
{
public class FlyingS : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Flying Skull"); //the name displayed when hovering over the item ingame.
}
public override void SetDefaults()
{
npc.width = 50;
npc.height = 40;
npc.damage = 10;
npc.defense = 10;
npc.lifeMax = 200;
npc.soundHit = 1;
npc.soundKilled = 13;
npc.value = 60f;
npc.knockBackResist = 0.5f;
npc.aiStyle = 2;
npc.aiType = 2; //npc behavior
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0.5f : 0.5f; //spown at day
}

public override void NPCLoot() //Npc drop
{
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FrozenHood"), 1); //Item spawn
}

}
}
}
Help and explanation would be much appreciated. :eek::islime:
 
It might be
public override float SpawnChance(NPCSpawnInfo spawnInfo)

instead of
public override float CanSpawn(NPCSpawningo spawnInfo)

I dunno though, i litearlly started coding today and im having the same problem. It seemed to fix this one error but now i am on the next.
 
Back
Top Bottom