Jump to content

Recommended Posts

Hey guys, I'm having a problem with a custom item for my character, I want it to keep the item when he dies, I figured out that I can do this with this line:

Quote

inst.components.inventoryitem.keepondeath = true

okay, but the problem is, it only works if the character is holding the item in the equip slot, if the item is sitting on his inventory or in his bag, the item drops if he dies

this is how I put the line inside the item.lua, under the local function fn()

Quote

inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.keepondeath = true
    inst.components.inventoryitem.atlasname = "images/inventoryimages/itemmeteor.xml"
    
    
    inst:AddComponent("equippable")
    inst.components.inventoryitem.keepondeath = true
    inst.components.equippable:SetOnEquip( onequip )

also, can you help me to make the item specific to my character? like only my character is able to used it, and if the item is stored in a chest or is on the ground, another character won't be able to pick it up and it say something about it. I tried to follow instructions from another post with a subject similar to this, but it just didn't work.

Quote

inst.components.characterspecific:SetOwner("raymond")

can you guys help me out? I'm almost done with my mod. Thanks ~

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...