Coder Social home page Coder Social logo

Comments (5)

revolucas avatar revolucas commented on August 19, 2024

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.

from xray-16.

denanden avatar denanden commented on August 19, 2024

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.

from xray-16.

 avatar commented on August 19, 2024

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.

from xray-16.

revolucas avatar revolucas commented on August 19, 2024

@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.

from xray-16.

denanden avatar denanden commented on August 19, 2024

@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.

from xray-16.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.