Welcome Forums Get help Can an NPC spawn in enemies? Reply To: Can an NPC spawn in enemies?

#73060
Macmor
Moderator

Sure they can! Technically, anything can! Depending on the situation, it can be really easy, or take a little more work.

Say you have an area with one entrance to it (bedroom) all you need to do is place an invisible tile on the spot the hero teleports to (usually the door). This way the tile gets activated immediately. Put your enemy(ies) on the map and adjust their settings to what you like, now go to that invisible tile and use the code to make each enemy inactive.

Now they won’t be there when you enter the room. Now all you have to do is use your NPC to make them active again by putting this wherever you want in the NPC code.

And that’s it for the easy way. Keep in mind, you need to duplicate the invisible tile for every entrance/teleport location the hero can use.

The next part is for respawning enemies:

Keep in mind, i forgot to mention that when you make an enemy active again after they’ve been killed, they only have 1hp. You need to add code to give them their health back.