Jump to content

How to increase the amount of morsels/meat dropped when killed by my custom character?


Recommended Posts

As the titles states I'm creating a custom character and as part of one of its perks i would like to make it so that when he kills let say rabbits it will drop 2-3 morsels rather than 1 or perhaps a chance to drop more loot etc
This is my first custom character so I'm new to modding

Thanks!

Link to comment
Share on other sites

@WaldoDude, Maybe something like this:

AddPrefabPostInit("rabbit", function(inst)	local oldlootsetupfn = inst.components.lootdropper.lootsetupfn	inst.components.lootdropper.lootsetupfn = function(self)		oldlootsetupfn(self)		if self.inst.causeofdeath and self.inst.causeofdeath.prefab ~= "mymodchar" then return end		local sane = true		if self.inst.causeofdeath and self.inst.causeofdeath:HasTag("player") then			if self.inst.causeofdeath.components.sanity ~= nil and self.inst.causeofdeath.components.sanity:IsCrazy() then				sane = false			end		end		if sane then			self:SetLoot({"smallmeat", "smallmeat"})			self:AddChanceLoot("smallmeat", 0.5)		end	endend) 

That should make it drop 2-3 morsels with equal probability, and just for your character.

Link to comment
Share on other sites

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
 Share

×
  • Create New...