dkkkop Posted August 26, 2014 Share Posted August 26, 2014 I made a simple mod, that adds a backpack to starting inventoryBut it seems, that this mod works only with default characters, and don't work with custom charactersHow can i fix thatThis is "modmain.lua" local default_inv = {"backpack"} local function setStarterInventory(inst, custom_inv)local st_inv = inst.components.inventory.starting_inventoryif (st_inv) then for k,v in pairs(default_inv) dotable.insert(st_inv, v)endelse inst.components.inventory.starting_inventory = default_invendif (custom_inv) then for k,v in pairs(custom_inv) dotable.insert(inst.components.inventory.starting_inventory, v)endendend local function makePostInit(custom_inv)return function (inst)setStarterInventory(inst, custom_inv)endend Link to comment https://forums.kleientertainment.com/forums/topic/39915-need-some-help-with-custom-characters/ Share on other sites More sharing options...
Mobbstar Posted August 26, 2014 Share Posted August 26, 2014 If you can't just add it to the starter inventory, try using "AddSimPostInit". It's explained it a mod called "APIexamples" and runs when the player spawns in a newly created world. Then calculate random offset (as in other game files, "waxwelljournal" for example) and spawn a backpack.You may need to add a "InCave" check. I could write it should you still struggle when I'm back in... ten hours... Link to comment https://forums.kleientertainment.com/forums/topic/39915-need-some-help-with-custom-characters/#findComment-527382 Share on other sites More sharing options...
dkkkop Posted August 26, 2014 Author Share Posted August 26, 2014 thx for your advise, will try to fix myself, if i'm not able to do that- will wait 10 hours though thx for your advise, will try to fix myself, if i'm not able to do that- will wait 10 hours though Link to comment https://forums.kleientertainment.com/forums/topic/39915-need-some-help-with-custom-characters/#findComment-527385 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