Jump to content

Is it possible to make a custom character drop special items on death.


Recommended Posts

I'm trying to make it so that my custom character on death will drop a special item. I know they already drop items in their inventory on death, but I'm trying to make it spawn an item and drop it when they die as well.

 

I tried just taking the loot things from spiders and trying to just insert that in, and change around the items that'd drop. But that didn't really seem to work all too well and my character never dropped anything(aside from their inventory) on death. Fiddling with it didn't get many results either.

 

So I'm wondering if this is actually possible, I imagine probably, but I'd like any sort of pointers on how to try and rig it up, since just trying to rip it out of enemies didn't work so well, and I'm still new to all of this stuff so I have no idea how to do it from scratch on my own.

Link to comment
Share on other sites

add this inside YOURCHAR.lua in the master_postinit

inst:AddComponent("lootdropper")
inst:ListenForEvent("death", Death_Drop_Item)

put this above the master_postinit

local function Death_Drop_Item(inst)
	inst.components.lootdropper:SpawnLootPrefab("humanmeat")
end

 

it should work

Edited by SuperDavid
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...