![]() I'm sure this simple code could be modified, however, for more aesthetically pleasing results. The game appears to insert some randomness for us, as the gibs don't all follow the same trajectory. This basic code will spawn gore at the Evil Guide's location with a velocity based on his (Including the knockbock from the killing blow). The ' NPCLoot()' method will be called when the NPC is killed (Though we already specified actual item drops in the. Gore.NewGore(npc.position,npc.velocity,"Guide Leg",1f,-1) Gore.NewGore(npc.position,npc.velocity,"Guide Arm",1f,-1) Gore.NewGore(npc.position,npc.velocity,"Guide Head",1f,-1) We could make a particle effect appear on being hit or dying, but since the game includes gibs for the Guide, let's spawn some gore: If you were to try out this NPC in-game, you might notice that they simply vanish upon death. Create a text file named " NPCName.cs" in ' NPC' with everything else. Now, to tackle some more complex characteristics, we need to create some C# code. Of course, creating your own custom sprites is great as well. These can be obtained through the use of the XNB Exporter which is easy to use and well documented. Though we intend to use the Guide's graphics. You need to have a sprite for the NPC (Called " Evil Guide.png"). This is CASE SENSITIVE: Capitalization matters. When changing names, remember all files need the same name. Trying to spawn an "Evil Guide" would result in a normal Guide. ![]() In some contexts (such as spawning in Tconfig), NPC's are differentiated by type, and so multiple NPC's of the same type ("Angry Bones" and others, for instance) cannot be distinguished. WARNING: It is currently (0.21.3) not advisable to set your NPC's type to a pre-existing type (anything not -1). The number after the equals sign is the percentage chance to drop. Under '' is a list of items to drop on death.The units are copper coins, so 1000 is 10 silver. ' Value' is how much money the NPC is likely to drop (T he game appears to randomize based on this value).This file should be called " NPCName.png" ( Files MUST be PNG), and placed next to the. Setting type to -1 will force the NPC to use custom graphics which you will provide. This can help you locate a particular NPC's graphics in the game files, if you're looking for it (the Guide is 22). ' type' determines, primarily, what graphics will represent the NPC." Friendly", to clarify, does not affect AI behavior, only whether the player will take damage from touching the NPC and whether they can be damaged by the player. ' townNPC' and ' friendly' are obviously unwanted in an enemy.Surprisingly, the Guide would be damaging us if he weren't friendly, so let's go with those values for now. ' Damage', ' defense' and ' lifeMax' are self-explanatory, but important for an enemy.Very often you'll want to make a sprite that is based off of an existing one, and use the same animation code that is already built into the game, instead of going through the process of making new animation code. ' animationType' determines the internal code used to handle animations.3 is the standard "Fighter" AI, used by Zombies, Mummies, Skeletons, etc. ' aiStyle' affects how the NPC will behave.' frameCount' is the number of frames that are in your.I then tweak the stats a bit to make him a little more unfriendly: It is generally a good idea to start by copying the stats of a default NPC and then customizing them. ini file will contain your NPC's basic stats. You must use this same name for all the files related to this NPC, and it will be the default name displayed in game, so give this some thought. Create a folder called "NPC" within your mod folder.Ĭreate a text file in your NPC folder called "NPCName.ini", substituting the desired name for your NPC for 'NPCName'. The examples mob and defaults package also serve as good references. ![]() As always, start by creating a mod folder or picking a pre-existing folder to use - see here for more details. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |