Johp Posted July 9, 2019 Share Posted July 9, 2019 (edited) I need help. It not drop gem from the boss. ================================================================ local function AddBossLootShadow(prefab) if prefab.components.lootdropper then prefab.components.lootdropper:AddChanceLoot('elucidatorgem',1) end end AddPrefabPostInit("shadow_chesspiece", AddBossLootShadow) ======================================== *I'm sorry. My English isn’t that good. Edited July 9, 2019 by Johp Link to comment Share on other sites More sharing options...
Ultroman Posted July 9, 2019 Share Posted July 9, 2019 Your code is correct, except for the name of the monster. There's is no monster called "shadow_chesspiece". The shadow chesspieces, however, share a loottable called "shadow_chesspiece", but that's no what you're changing. From you code, it looks like you're trying to do one of two things: Make all shadow chesspieces ALWAYS drop your (I'm assuming custom) gem item Make a particular boss always drop your item If you want all shadow chesspieces to have a chance of (or always) dropping the gem, you can do this: local shadow_chesspieces = { "shadow_rook", "shadow_knight", "shadow_bishop" } for _, v in ipairs(shadow_chesspieces) do AddPrefabPostInit(v, function(inst) if prefab.components.lootdropper then -- Note that 1.0 means there's a 100% chance to drop the gem. prefab.components.lootdropper:AddChanceLoot("elucidatorgem", 1.0) end end) end 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