Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_item(npc, item)
- -- THIS IS WHERE YOU PUT YOUR CALLBACK
- some_script.npc_get_all_from_corpse(npc,item,lootable_table[item:section()])
- if lootable_table[item:section()] == true then
- npc:transfer_item(item, transfer_to_npc)
- end
- end
- function get_all_from_corpse(npc)
- printf("GET ALL FROM CORPSE")
- local corpse_npc_id = db.storage[npc:id()].corpse_detection.selected_corpse_id
- local corpse_npc = db.storage[corpse_npc_id] and db.storage[corpse_npc_id].object
- if corpse_npc == nil then
- return
- end
- transfer_to_npc = npc
- corpse_npc:iterate_inventory(get_item, corpse_npc)
- if math.random(100) > 20 then
- xr_sound.set_sound_play(npc:id(), "corpse_loot_begin")
- else
- xr_sound.set_sound_play(npc:id(), "corpse_loot_bad")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement