WaldoDude Posted January 12, 2015 Share Posted January 12, 2015 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 etcThis is my first custom character so I'm new to moddingThanks! Link to comment https://forums.kleientertainment.com/forums/topic/48997-how-to-increase-the-amount-of-morselsmeat-dropped-when-killed-by-my-custom-character/ Share on other sites More sharing options...
rezecib Posted January 12, 2015 Share Posted January 12, 2015 @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 https://forums.kleientertainment.com/forums/topic/48997-how-to-increase-the-amount-of-morselsmeat-dropped-when-killed-by-my-custom-character/#findComment-600794 Share on other sites More sharing options...
WaldoDude Posted January 12, 2015 Author Share Posted January 12, 2015 Ok I tried it however when I load into game after picking my char I'm getting the AddPrefabPostInit not declared error... Am i missing something or do i need to change something? Link to comment https://forums.kleientertainment.com/forums/topic/48997-how-to-increase-the-amount-of-morselsmeat-dropped-when-killed-by-my-custom-character/#findComment-600797 Share on other sites More sharing options...
rezecib Posted January 12, 2015 Share Posted January 12, 2015 @WaldoDude, You should be putting this in your modmain, not your character's file. Link to comment https://forums.kleientertainment.com/forums/topic/48997-how-to-increase-the-amount-of-morselsmeat-dropped-when-killed-by-my-custom-character/#findComment-600806 Share on other sites More sharing options...
WaldoDude Posted January 12, 2015 Author Share Posted January 12, 2015 Woops yep now its working thanks alot! Link to comment https://forums.kleientertainment.com/forums/topic/48997-how-to-increase-the-amount-of-morselsmeat-dropped-when-killed-by-my-custom-character/#findComment-600821 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