Jump to content

Recommended Posts

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.

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 by DarkXero

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.

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.

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)end

You can't pick them up, they can't be given to you.

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