Jump to content

Recommended Posts

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?

  • Developer

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

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...