There is a VERY simple way to create NPCs (Non Playable Characters, in case you didn't know), that doesn't even involve programming AI.Help please (bad english is coming!)
someone knows a easy way to make enemys ?like use AI vanilla,because a made a mod with 5 set armors,12 swords,8 guns and 7 accessories, but not enemysI want to put my mod to download but I want make enemys frist.If any one knows a easy way to make mobs and bosses,please tell me(if possible make a "exemple code" to me,I like made sprites not codes)
anyway thanks to read!
Do note, however, that using this method, you only have access to pre-programmed AI (since you're basically using vanilla AI), which means you can't (for example) make the NPC shoot your own modded projectiles.
Now with that out of the way, let me explain a bit. We can make use of two different variables in a ModNPC class: npc.aiStyle and aiType.
A fast breakdown of the two.
npc.aiStyle: determines what kind of 'style' is used. A good overview can be found here on the wiki. If you follow that link, you can see there are aiStyles called things like 'Slime AI' or 'Fighter AI'. So these are very generic AIs you can assign to your NPC. We can use this to make a slime for example, just by setting npc.aiStyle to 1 in the SetDefaults function of the NPC. That's all there is to it!
aiType: Now this goes a little bit further, so let me get two NPCs out: your average Zombie and an Angry Bones. Now as you might know, there's a difference between these two, but they also have a lot in common. That's because their aiStyle is the same, but their type is different. So the aiStyle takes care of them walking on the ground and jumping, while in this case the type takes care of things like speed and the Angry Bones' little hopping attacks.
So lets say you want your NPC to follow the same pattern as an Angry Bones, you'll have to set npc.aiStyle to 3 (fighter AI) and the aiType to the type of the NPC in question, which is 31 for Angry Bones.
I hope you get the base of it.