1337gamer15 Posted December 20, 2014 Share Posted December 20, 2014 Yet another bug.... Anyways, all of my mod characters start with items, but it seems only the first play to join the server will actually get them, any other player who joins will not have the items. For the most part these items are custom, with the exception of my Tiny Tina mod, who starts with 6 gunpowder. What would I need to add to ensure the players get their starting inventory? Will the code also ensure the player does not get the items upon resurrection? Or is this just a bug on Klei's end that could affect characters like Willow and Wickerbottom? Link to comment https://forums.kleientertainment.com/forums/topic/47154-additional-players-are-missing-their-starting-inventory/ Share on other sites More sharing options...
Developer PeterA Posted January 5, 2015 Developer Share Posted January 5, 2015 How are you giving your players items when they spawn for the first time?I did something similar in The Hunt game mode mod local OnPlayerSpawn = function(src, player) print( "OnPlayerSpawn event heard" ) player.prev_OnNewSpawn = player.OnNewSpawn player.OnNewSpawn = function() local start_items = { "torch", "bandage", "bandage", "meatballs" } for _,v in pairs(start_items) do local item = SpawnPrefab(v) player.components.inventory:GiveItem(item) end local start_equipped_items = { "spear", "armorwood" } for _,v in pairs(start_equipped_items) do local item = SpawnPrefab(v) player.components.inventory:GiveItem(item) player.components.inventory:Equip(item) end if player.prev_OnNewSpawn ~= nil then player:prev_OnNewSpawn() player.prev_OnNewSpawn = nil end endend or nil--put this code somewhere you can listen to events like in AddPrefabPostInit("world_network", your_setup_code )if TheWorld.ismastersim then self.inst:ListenForEvent("ms_playerspawn", OnPlayerSpawn, TheWorld)end Link to comment https://forums.kleientertainment.com/forums/topic/47154-additional-players-are-missing-their-starting-inventory/#findComment-597401 Share on other sites More sharing options...
rezecib Posted January 6, 2015 Share Posted January 6, 2015 I'd assume he's using the start_inv argument to MakePlayerCharacter. Something else in the mod must be messing with it, I think... Link to comment https://forums.kleientertainment.com/forums/topic/47154-additional-players-are-missing-their-starting-inventory/#findComment-597530 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