Fireandthethud Posted April 17, 2015 Share Posted April 17, 2015 My previous question that's related to this: http://forums.kleientertainment.com/topic/52436-spawning-a-specific-prefab-on-player-death/ I wanted to spawn a specific prefab, but all the methods that were suggest in the thread, I tried, and all failed. I think the issue lies within me trying to spawn it from math based on the location of a player who's no longer there, so now I'm thinking it might be easier to just have it drop like mobs drop loot using "SetSharedLootTable" but that isn't working too well, as it crashes on start up.SetSharedLootTable( 'stuff',{ {'rocks', 1.00}})would be at the top and this was at the bottomAddPlayerPostInit(function(inst) inst:AddComponent("lootdropper") inst.components.lootdropper:SetChanceLootTable('stuff')end)but nonetheless it crashed on start up calling the SetSharedLootTable a nil value.Can anyone offer another solution? Perhaps something similar to how the skeleton is spawned on death? (I couldn't figure that out myself.) Link to comment Share on other sites More sharing options...
Maris Posted April 17, 2015 Share Posted April 17, 2015 why you need it? Link to comment Share on other sites More sharing options...
DarkXero Posted April 18, 2015 Share Posted April 18, 2015 It's because the death event is handled differently in the Wilson stategraph.Monsters have a common death, which uses the drop loot functionality. What you are looking for is:GLOBAL.SetSharedLootTable("stuff", { {"meat", 1.00}, {"meat", 1.00}, {"meat", 0.33}})AddPlayerPostInit(function(inst) inst:AddComponent("lootdropper") inst.components.lootdropper:SetChanceLootTable("stuff") inst:ListenForEvent("death", function() inst.components.lootdropper:DropLoot(inst:GetPosition()) end)end) Link to comment Share on other sites More sharing options...
Fireandthethud Posted April 18, 2015 Author Share Posted April 18, 2015 Worked perfectly, Thank you! 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