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 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 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.