I'm trying to add more slots on my basic cheat npc mod. but when i click next page. there are only 2 other items there. and this shows up
even though i have more items in the shop added in the script.
here's the script btw
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.Utilities;
namespace TheCheatNpc.NPCs
{
[AutoloadHead]
public class Kimi : ModNPC
{
public override string Texture
{
get
{
return "TheCheatNpc/NPCs/Kimi";
}
}
public override bool Autoload(ref string name)
{
name = "Kimi";
return mod.Properties.Autoload;
}
public override void SetStaticDefaults()
{
// DisplayName automatically assigned from .lang files, but the commented line below is the normal approach.
// DisplayName.SetDefault("Example Person");
Main.npcFrameCount[npc.type] = 25;
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
NPCID.Sets.AttackFrameCount[npc.type] = 4;
NPCID.Sets.DangerDetectRange[npc.type] = 700;
NPCID.Sets.AttackType[npc.type] = 0;
NPCID.Sets.AttackTime[npc.type] = 90;
NPCID.Sets.AttackAverageChance[npc.type] = 30;
NPCID.Sets.HatOffsetY[npc.type] = 4;
}
public override void SetDefaults()
{
npc.townNPC = true;
npc.friendly = true;
npc.width = 18;
npc.height = 40;
npc.aiStyle = 7;
npc.damage = 10;
npc.defense = 15;
npc.lifeMax = 250;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.knockBackResist = 0.5f;
animationType = NPCID.DyeTrader;
}
public override void HitEffect(int hitDirection, double damage)
{
int num = npc.life > 0 ? 1 : 5;
for (int k = 0; k < num; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("Sparkle"));
}
}
public override bool CanTownNPCSpawn(int numTownNPCs, int money)
{
for (int k = 0; k < 255; k++)
{
Player player = Main.player[k];
if (player.active)
{
for (int j = 0; j < player.inventory.Length; j++)
{
if (player.inventory[j].type == mod.ItemType("EssenceOfMadness"))
{
return true;
}
}
}
}
return false;
}
public override string TownNPCName()
{
switch (WorldGen.genRand.Next(4))
{
case 0:
return "Kimi";
case 1:
return "Kimi";
case 2:
return "Kimi";
default:
return "Kimi";
}
}
public override void FindFrame(int frameHeight)
{
/*npc.frame.Width = 40;
if (((int)Main.time / 10) % 2 == 0)
{
npc.frame.X = 40;
}
else
{
npc.frame.X = 0;
}*/
}
public override string GetChat()
{
int dryad = NPC.FindFirstNPC(NPCID.Dryad);
if (dryad >= 0 && Main.rand.Next(4) == 0)
{
return "Can you please tell " + Main.npc[dryad].GivenName + " that i want some plants for my shelves that i totally have?";
}
switch (Main.rand.Next(3))
{
case 0:
return "Sometimes I feel like I'm different from everyone else here.";
case 1:
return "I'll have Two Number Nines, A number 9 large, A number 6 with extra dip. two number 45s. one with cheese. and a large soda.";
default:
return "Well heres some items i guess.";
}
}
/*
// Consider using this alternate approach to choosing a random thing. Very useful for a variety of use cases.
// The WeightedRandom class needs "using Terraria.Utilities;" to use
public override string GetChat()
{
WeightedRandom<string> chat = new WeightedRandom<string>();
int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl);
if (partyGirl >= 0 && Main.rand.Next(4) == 0)
{
chat.Add("Can you please tell " + Main.npc[partyGirl].GivenName + " to stop decorating my house with colors?");
}
chat.Add("Sometimes I feel like I'm different from everyone else here.");
chat.Add("What's your favorite color? My favorite colors are white and black.");
chat.Add("What? I don't have any arms or legs? Oh, don't be ridiculous!");
chat.Add("This message has a weight of 5, meaning it appears 5 times more often.", 5.0);
chat.Add("This message has a weight of 0.1, meaning it appears 10 times as rare.", 0.1);
return chat; // chat is implicitly cast to a string. You can also do "return chat.Get();" if that makes you feel better
}
*/
public override void SetChatButtons(ref string button, ref string button2)
{
button = Language.GetTextValue("LegacyInterface.28");
}
public override void OnChatButtonClicked(bool firstButton, ref bool shop)
{
if (firstButton)
{
shop = true;
}
}
public override void SetupShop(Chest shop, ref int nextSlot)
{
shop.item[nextSlot].SetDefaults(ItemID.JungleYoyo);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.DirtBlock);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MudBlock);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.TerraBlade);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MedusaHead);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.HermesBoots);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ArmorBracing);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Bezoar);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.CountercurseMantra);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MedicatedBandage);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Megaphone);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MoonStone);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ObsidianRose);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.PocketMirror);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.RifleScope);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.SharkToothNecklace);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ThePlan);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Vitamins);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.NecromanticScroll);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.HerculesBeetle);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.LuckyCoin);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.GoldRing);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.DiscountCard);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.NaturesGift);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.BandofStarpower);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.BandofRegeneration);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Blindfold);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Muramasa);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Starfury);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Arkhalis);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.IceBlade);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.BladedGlove);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Katana);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.FalconBlade);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.TaxCollectorsStickOfDoom);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.PsychoKnife);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Keybrand);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Spear);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Trident);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.DarkLance);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.IceBoomerang);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Flamarang);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.BloodyMachete);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ChainGuillotines);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ChainKnife);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Anchor);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Marrow);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.IceBow);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Boomstick);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Handgun);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Revolver);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.GrenadeLauncher);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ElectrosphereLauncher);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Sandgun);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Harpoon);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Toxikarp);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MagicMissile);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Flamelash);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Vilethorn);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.CrimsonRod);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.BatScepter);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ClingerStaff);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.FlowerofFrost);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.LaserRifle);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.GoldenShower);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.CrystalStorm);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MagnetSphere);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.WaterBolt);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.DemonScythe);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ToxicFlask);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ShadowFlameHexDoll);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MagicDagger);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.UnholyTrident);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.SlimeStaff);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.HornetStaff);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.PirateStaff);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.RavenStaff);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Beenade);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.SpikyBall);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Shuriken);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Snowball);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.MolotovCocktail);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Javelin);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.Wood);
nextSlot++;
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 20;
knockback = 4f;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
{
cooldown = 30;
randExtraCooldown = 30;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = mod.ProjectileType("SparklingBall");
attackDelay = 1;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
{
multiplier = 12f;
randomOffset = 2f;
}
}
}