Jump to content

Recommended Posts

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

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

 

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