Yumesuki Posted April 24, 2015 Share Posted April 24, 2015 I've been trying to figure out how to do this, but the best i've been able to do is make them drop certain equiped items. I would really like to stop them from pciking up the items all together, however, wether that be by insta-dropping or restricting them from actually picking them up. Link to comment Share on other sites More sharing options...
DarkXero Posted April 24, 2015 Share Posted April 24, 2015 (edited) local forbidden = { "meat", "axe", "deerclops_eyeball", "boomerang" } for k, v in pairs(forbidden) do AddPrefabPostInit(v, function(inst) inst.components.inventoryitem.onputininventoryfn = function(inst, owner) if owner.prefab == "mycharacter" then owner:DoTaskInTime(0, function() owner.components.inventory:DropItem(inst, nil, true) end) end end end) end Edited April 24, 2015 by DarkXero Link to comment Share on other sites More sharing options...
Yumesuki Posted April 24, 2015 Author Share Posted April 24, 2015 Er, unless I'm missing something, wouldn't that cause someone who's not my character to drop a certain item if I added that in as a PrefabPostInit for the item? What I want to do is put something in my character's prefab that makes them drop stuff that's already in the game on pick up, like meat and monstermeat, but not other things like rocks and twigs. Link to comment Share on other sites More sharing options...
DarkXero Posted April 24, 2015 Share Posted April 24, 2015 You are correct. Items dropping from a character was usually asked to make a special character specific weapon that nobody else aside from the mod character could grab. So I read your post with that mindset, and ended up coughing something unrelated. I adjusted my post. Link to comment Share on other sites More sharing options...
Yumesuki Posted April 24, 2015 Author Share Posted April 24, 2015 Thanks much for the help. I believe this will probably work a lot cleaner than what I was trying to do in the character prefab when they picked the items up. Link to comment Share on other sites More sharing options...
DarkXero Posted April 25, 2015 Share Posted April 25, 2015 There are many ways to do it.Another way to avoid these items ending up in your character's inventory:local forbidden = { axe = true, twigs = true, armorwood = true}local old1 = GLOBAL.ACTIONS.PICKUP.fnGLOBAL.ACTIONS.PICKUP.fn = function(act) if act.doer.prefab == "wilson" and forbidden[act.target.prefab] then return end return old1(act)endlocal old2 = GLOBAL.ACTIONS.GIVETOPLAYER.fnGLOBAL.ACTIONS.GIVETOPLAYER.fn = function(act) if act.target.prefab == "wilson" and forbidden[act.invobject.prefab] then return end return old2(act)endlocal old3 = GLOBAL.ACTIONS.GIVEALLTOPLAYER.fnGLOBAL.ACTIONS.GIVEALLTOPLAYER.fn = function(act) if act.target.prefab == "wilson" and forbidden[act.invobject.prefab] then return end return old3(act)endYou can't pick them up, they can't be given to you. Link to comment 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