Open denanden opened 9 years ago
callback.on_item_take
callback.on_item_drop
callback.take_item_from_box
Already work for stalker NPCs. Since corpse looting is a lua scripted action scheme it would be more appropriate to implement npc_take_item_from_corpse inside xr_corpse_detection.script; specifically inside the get_all_from_corpse function.
Cool, I didn't know that. I added the callback functions in xr_motivator.script and it works fine. Is there a way to determine if the dropped item is physically being dropped (on the ground)? Seems that on_item_drop is called as soon as an object disappears from an NPC's inventory.
Hi, I'm a little confused as I need the same function (npc_take_item_from_corpse). Are you saying to implement a new function that does that, or create lua code based on those other functions in order to call that scheme? My scripter really needs such a function so if you wouldn't mind sharing I'd appreciate it.
@denanden: Well, you can differentiate whether it is being traded to another npc or if it is being dropped to the ground. The parent_id will be 65535 if the object is being dropped on the ground.
@Swartz27: Corpse looting is a lua scripted action scheme. All you need to do is something like this in xr_corpse_detection.script: http://pastebin.com/yPw1hdHQ
Then your script function should look something like
function npc_get_all_from_corpse(npc,item,lootable)
end
It will be called for each and every item the npc takes from the corpse and you can manually check if it is actually lootable or not. You can probably enhance it to also pass the corpse object.
@revolucas: My experiments have shown that all dropped weapons have parent() = the NPC that drops them.
My solution/workaround is to check if the dropped weapon is the same as parent NPC's active item. So far it has worked for me in every single case.
It would be totally awesome if the following callbacks were implemented: