mathem99 Posted July 17, 2016 Share Posted July 17, 2016 Hello, I'm making a personal mod that tweaks a bunch of stuff that I want to change. I am in need of help from someone to tell me how I can change lets say... Warg's loot drop, how do I make that? I also need help tweaking Wickerbottom's book durability so all her books have 10 uses. Thank you. Link to comment https://forums.kleientertainment.com/forums/topic/68907-need-help-with-code/ Share on other sites More sharing options...
DarkXero Posted July 18, 2016 Share Posted July 18, 2016 14 hours ago, mathem99 said: Warg's loot drop, how do I make that? AddSimPostInit(function() -- Access to the old loot table local old_warg_loot = GLOBAL.LootTables["warg"] -- Adding new loot table.insert(old_warg_loot, {"goldnugget", 1.00}) -- Removing loot (the first table value) table.remove(old_warg_loot, 1) -- OR -- Replacing the table entirely local new_warg_loot = { {"monstermeat", 1.00}, {"goldnugget", 1.00}, {"houndstooth", 0.66}, } GLOBAL.SetSharedLootTable("warg", new_warg_loot) end) 14 hours ago, mathem99 said: Wickerbottom's book durability so all her books have 10 uses local function MakeTenUses(inst) if inst.components.finiteuses then inst.components.finiteuses:SetMaxUses(10) inst.components.finiteuses:SetUses(10) end end AddPrefabPostInit("book_tentacles", MakeTenUses) AddPrefabPostInit("book_birds", MakeTenUses) AddPrefabPostInit("book_brimstone", MakeTenUses) AddPrefabPostInit("book_sleep", MakeTenUses) AddPrefabPostInit("book_gardening", MakeTenUses) Link to comment https://forums.kleientertainment.com/forums/topic/68907-need-help-with-code/#findComment-794126 Share on other sites More sharing options...
mathem99 Posted July 18, 2016 Author Share Posted July 18, 2016 6 hours ago, DarkXero said: AddSimPostInit(function() -- Access to the old loot table local old_warg_loot = GLOBAL.LootTables["warg"] -- Adding new loot table.insert(old_warg_loot, {"goldnugget", 1.00}) -- Removing loot (the first table value) table.remove(old_warg_loot, 1) -- OR -- Replacing the table entirely local new_warg_loot = { {"monstermeat", 1.00}, {"goldnugget", 1.00}, {"houndstooth", 0.66}, } GLOBAL.SetSharedLootTable("warg", new_warg_loot) end) local function MakeTenUses(inst) if inst.components.finiteuses then inst.components.finiteuses:SetMaxUses(10) inst.components.finiteuses:SetUses(10) end end AddPrefabPostInit("book_tentacles", MakeTenUses) AddPrefabPostInit("book_birds", MakeTenUses) AddPrefabPostInit("book_brimstone", MakeTenUses) AddPrefabPostInit("book_sleep", MakeTenUses) AddPrefabPostInit("book_gardening", MakeTenUses) Much obliged. Link to comment https://forums.kleientertainment.com/forums/topic/68907-need-help-with-code/#findComment-794247 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