mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-11-24 07:57:59 +01:00
save the inventory of the NPC after npc_gives/npc_wants
This commit is contained in:
parent
fd177472c5
commit
a7288bb2b9
@ -397,6 +397,8 @@ yl_speak_up.action_quest_item_take_back = function(player)
|
|||||||
-- where to put it or even giving it back and letting the quest fail.
|
-- where to put it or even giving it back and letting the quest fail.
|
||||||
if(npc_inv:room_for_item("npc_main", stack)) then
|
if(npc_inv:room_for_item("npc_main", stack)) then
|
||||||
npc_inv:add_item("npc_main", stack)
|
npc_inv:add_item("npc_main", stack)
|
||||||
|
-- save the inventory of the NPC
|
||||||
|
yl_speak_up.save_npc_inventory(n_id)
|
||||||
end
|
end
|
||||||
-- the NPC has accepted the item
|
-- the NPC has accepted the item
|
||||||
trade_inv:set_stack("npc_wants", 1, ItemStack())
|
trade_inv:set_stack("npc_wants", 1, ItemStack())
|
||||||
@ -425,6 +427,9 @@ yl_speak_up.input_fs_action_npc_gives = function(player, formname, fields)
|
|||||||
-- is the npc_gives inv empty? then all went as expected.
|
-- is the npc_gives inv empty? then all went as expected.
|
||||||
-- (it does not really matter which button the player pressed in this case)
|
-- (it does not really matter which button the player pressed in this case)
|
||||||
if(trade_inv:is_empty("npc_gives")) then
|
if(trade_inv:is_empty("npc_gives")) then
|
||||||
|
-- the NPC has given the item to the player; save the NPCs inventory
|
||||||
|
local n_id = yl_speak_up.speak_to[pname].n_id
|
||||||
|
yl_speak_up.save_npc_inventory(n_id)
|
||||||
-- the action was a success; the NPC managed to give the item to the player
|
-- the action was a success; the NPC managed to give the item to the player
|
||||||
yl_speak_up.execute_next_action(player, a_id, true)
|
yl_speak_up.execute_next_action(player, a_id, true)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user