Everything posted by SeventhRat
Here's how I give starting items to new players: local function playerSpawner(PlayerSpawner, inst) inst:ListenForEvent("ms_newplayercharacterspawned", function(a, b) b.player.components.inventory:GiveItem(GLOBAL.SpawnPrefab("name_of_your_item")) end) end AddComponentPostInit("playerspawner", playerSpawner) If you only want a certain character to get the item, I think you can get the player character's name with b.player.prefab.
When I set up a test server on my own computer using the Steam client and type c_give() to give a prefab that can't be stored in the inventory, the game starts to lag. The first few times the server eventually crashed and the save files were corrupted. I tried it again now. It lagged again, but server didn't crash. I reconnected and it still lagged. I shut it down with c_shutdown() and restarted. This was in the log: [00:00:06]: [string "scripts/saveindex.lua"]:264: Corrupt Save file [session/73B631138D620AE0/0000000006] Sounds similar to this issue. It's not that big of a deal because c_give() isn't supposed to be used with placeable prefabs, but I've been able to spawn pig houses and rabbit houses that way when hosting a game. Specs: i5 4670K @4,1GHz 8GB RAM GTX 960 Windows 8.1