I know there is a cleaner way of doing what i want but im having issues just figuring out how to make this work:
so i want to add items to a NPC's contents so when it dies death() will have it dump its contents as loot
was planning for boolean arguements to list loot for each mob, If someone knows a better way i would greatly appreciate a nudge towards a better design or help me with adding objects to a npc content
I would give NPCs a proc that returns a lazy-initialized list of item instances to drop. It's best to lazy-initialize it so it's not generated as soon as the NPC is created, which you don't want if a lot of NPCs are created simultaneously (e.g. at world startup, if there are lots of NPCs on the map).
mob/npc mob/npc |
Then just dump said items on the ground when the mob dies and be done with it. If you want to get into things like drop rates and the sort you'd obviously have to expand on things.