hkzorman / advanced_npc

Advanced NPC for Minetest, using mobs_redo API
Other
17 stars 5 forks source link

NPC not initialized when created from inventory, leads to crash #4

Closed ghost closed 7 years ago

ghost commented 7 years ago

To reproduce:

It immediately crashes, complaining about a nil relationships field.

Apparently, that's because the spawn_npc function isn't executed in that code path. It would be nice if it was, allowing creators to place NPCs where desired.

hkzorman commented 7 years ago

You are correct on your conclusion, it is because the spawn_npc function isn't called in this fashion.

I'm even having trouble with this right now while attempting to implement automatic spawners.

It's my intention to provide a mechanism to allow creators to spawn NPCs wherever they want and to actually even be able to configure the NPC from this. As you may or may not know, default is for the NPC's behavior to be random (random dialogues, random trade offers, random liked items, etc.). However, my goal is to make this fully configurable, so you can script NPCs and configure what they like, what they talk about, etc.

This should be part of the manual spawning tool, which I intend to implement after automatic spawners. I will try, however, to come up with a temporary solution so people can place NPCs wherever they want.

hkzorman commented 7 years ago

Fixed. NPCs now should be initialized when using spawn egg. Please do notice this is temporary solution, until better implementation is done. b5ef1f8ed82ac369f87b111de4f7b03d6962088b