. . . Posted June 13, 2022 Share Posted June 13, 2022 Basically, I want to make any mob killed by my character always drops all of it has a chance to drop like if i killed krampus he would always drop a krampus sack or if I killed a bunnyman it would drop 1 meat, carrot, and bunny tuft. Is there a way to mess with a mob's lootdropper when you kill it to make it always drop every item it has the potential to drop? Or there's no simple way to do this Link to comment https://forums.kleientertainment.com/forums/topic/140850-need-help-for-a-lucky-lootdropper-perk/ Share on other sites More sharing options...
IronHunter Posted June 13, 2022 Share Posted June 13, 2022 Hmm, if you want to specifically make it so its killing blow or damaged by recently? In either case a simple way would be to update some variable on the dying prefab and modify the lootdropper component for when it checks chance and/or random loot if that variable is true we use your new functions to guarantee create all the prefabs. As you want this to apply to all mobs a componentpostinit on the lootdropper component is definitely required. You can then create a new variable in said lootdropper that defaults to false/nil and is updated when struck by your character to true. Some sort of dotaskintime to reset it if the mob gets away for too long or you die and somebody else kills it. No simple way you'll have to extend the functions that calculate loot drops. 1 Link to comment https://forums.kleientertainment.com/forums/topic/140850-need-help-for-a-lucky-lootdropper-perk/#findComment-1576789 Share on other sites More sharing options...
Bumber64 Posted June 14, 2022 Share Posted June 14, 2022 (edited) One issue is that some loot is mutually exclusive. In particular with your bunnyman example, they always drop 1 meat, 1 carrot, or 1 bunny puff. I created a custom function for one of my mods that converts this type of loot into the kind that is decided independently: local function convert_rand_loot(ld) --convert lootdropper's randomloot into chanceloot if not ld or not ld.randomloot then return end local n, w = ld.numrandomloot, ld.totalrandomweight if not (n and w and n > 0 and w > 0) then return end for _, t in pairs(ld.randomloot) do for i=1, n do --add extra drops for numrandomloot > 1 ld:AddChanceLoot(t.prefab, t.weight / w) end end ld.randomloot = nil --this also clears ld.totalrandomweight when necessary --keep ld.numrandomloot for haunted loot end Then I can tweak the drop chances of each item. Another complication is that beardlords and bunnymen are the same mob that drops different loot depending on the sanity of the one who killed them, using the lootdropper's "lootsetupfn". Edited June 14, 2022 by Bumber64 1 1 Link to comment https://forums.kleientertainment.com/forums/topic/140850-need-help-for-a-lucky-lootdropper-perk/#findComment-1576860 Share on other sites More sharing options...
PowerX_X Posted September 19, 2022 Share Posted September 19, 2022 Hello, if you found a way to implement this feature, would you mind sharing the code utilized? Thanks in advance. Link to comment https://forums.kleientertainment.com/forums/topic/140850-need-help-for-a-lucky-lootdropper-perk/#findComment-1598832 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