Verior Posted December 24, 2014 Share Posted December 24, 2014 I have an item added in as a mod, but I'd like to make the item completely vanish if it is dropped. I have figured out how to make the model disappear, but if I hold the spacebar my character will still pick the item up. Is there any way to make the item just disappear completely? Thanks in advance. Link to comment https://forums.kleientertainment.com/forums/topic/47463-help-causing-an-item-to-vanish-on-drop/ Share on other sites More sharing options...
rezecib Posted December 24, 2014 Share Posted December 24, 2014 @Verior, inst:Remove() Link to comment https://forums.kleientertainment.com/forums/topic/47463-help-causing-an-item-to-vanish-on-drop/#findComment-592136 Share on other sites More sharing options...
Verior Posted December 24, 2014 Author Share Posted December 24, 2014 @Verior, inst:Remove() I hate to be such a pest, but I don't understand.I have this right now:local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() inst.entity:AddSoundEmitter() MakeInventoryPhysics(inst) inst:AddComponent("inventoryitem") inst.components.inventoryitem:ChangeImageName("goldenaxe") inst:AddComponent("weapon") inst.components.weapon:SetDamage(40) inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.CHOP, 10) if drop then inst:Remove() endBut I'm not sure what to put where I wrote "drop" in larger letters. PeterA Edit: fixed formatting issue Link to comment https://forums.kleientertainment.com/forums/topic/47463-help-causing-an-item-to-vanish-on-drop/#findComment-592151 Share on other sites More sharing options...
Verior Posted December 24, 2014 Author Share Posted December 24, 2014 @rezecib I don't know why it wrote everything twice and I can't figure out how to edit the post. Sorry about that. Link to comment https://forums.kleientertainment.com/forums/topic/47463-help-causing-an-item-to-vanish-on-drop/#findComment-592152 Share on other sites More sharing options...
Sarcen Posted December 24, 2014 Share Posted December 24, 2014 remove if drop then inst:Remove() endtry inst.components.inventoryitem:SetOnDroppedFn(inst.Remove) Link to comment https://forums.kleientertainment.com/forums/topic/47463-help-causing-an-item-to-vanish-on-drop/#findComment-592185 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now