How to Receive an Item From an NPC

Started by lefthandedhero, December 15, 2023, 03:13:11 AM

Previous topic - Next topic
I watched the tutorial videos on equipment items and I understand how to have an item be found in a chest or dropped when enemy is defeated. However, I was wondering how to have an item be obtained by interacting with NPC.

You have to do that with the map lua script.

npc:on_interaction() then do the dialog and finally give the item to the hero with hero:start_treasure(treasure_name, [treasure_variant, [treasure_savegame_variable, [callback]]])

You can have a look in the Manual for further help on these :)

Quote from: PeterB on December 18, 2023, 07:51:48 AM
You have to do that with the map lua script.

npc:on_interaction() then do the dialog and finally give the item to the hero with hero:start_treasure(treasure_name, [treasure_variant, [treasure_savegame_variable, [callback]]])

You can have a look in the Manual for further help on these :)

Thank you; that helps a lot.

What are you referring to by the manual? Are you referring to the Lua API reference? If so, I have been reading through it.