You may program extra effects in this hook (for example, how Golem's head lifts up for the second phase of its fight). Whether or not this NPC should be killed when it reaches 0 health. For example, Truffle requires the house to be in an aboveground mushroom biome. More.ĬheckConditions (int left, int right, int top, int bottom)Īllows you to define special conditions required for this town NPC's house. Return false to stop this NPC from being despawned and to stop this NPC from counting towards the limit for how many NPCs can exist near a player.
Play terraria 1.1 code#
Whether or not to run the code for checking whether this NPC will remain active. For example, the Demolitionist requires that any player has an explosive. Whether or not the conditions have been met for this town NPC to be able to move into town. More.ĬanTownNPCSpawn (int numTownNPCs, int money) CooldownSlot determines which of the player's cooldown counters to use (-1, 0, or 1), and defaults to -1. Return false to block this NPC from hitting the target. More.ĬanHitPlayer (Player target, ref int cooldownSlot)Īllows you to determine whether this NPC can hit the given player. Return true to allow hitting the target, return false to block this NPC from hitting the target, and return null to use the vanilla code for whether the target can be hit. More.Īllows you to determine whether this NPC can hit the given friendly NPC. Whether this NPC can be telported to a King or Queen statue. By default, returns if the NPC is a town NPC. More.Īllows you to determine whether this NPC can talk with the player. Return true to allow hitting the NPC, return false to block hitting the NPC, and return null to use the vanilla code for whether the NPC can be hit. More.ĬanBeHitByProjectile (Projectile projectile)Īllows you to determine whether this NPC can be hit by the given projectile. More.ĬanBeHitByItem (Player player, Item item)Īllows you to determine whether this NPC can be hit by the given melee weapon when swung. More.īossLoot (ref string name, ref int potionType)Īllows you to customize what happens when this boss dies, such as which name is displayed in the defeat message and what type of potion it drops. More.īossHeadSpriteEffects (ref SpriteEffects spriteEffects)Īllows you to flip this NPC's boss head icon on the map. Set index to -1 to stop the texture from being displayed. More.Īllows you to customize the boss head texture used by this NPC based on its state. More.Īllows you to customize the rotation of this NPC's boss head icon on the map. Override this if you do not want the properties to be set for you. More.Īutomatically sets certain static defaults. Use this method to either force or stop an autoload, or to change the default display name. Name is initialized to the overriding class name, texture is initialized to the namespace and overriding class name with periods replaced with slashes, and altTextures is initialized to null. Return true to allow autoloading by default returns the mod's autoload property. More.Īllows you to automatically load an NPC instead of using Mod.AddNPC. This will only be called if PreAI returns true. Allows you to determine how this NPC behaves.