Hello,
I'm trying to spawn different items into an airdrop. I've been able to clear the inventory of the airdrop but I cannot get it to spawn my new items in there! This is what I've got so far:
Now I'm likely to be wrong, but from what I've seen so far this should be able to work. Anyone out here who can help me out?Code:LootContainer container = entity.GetComponent<LootContainer>(); if (container == null) { return; } else if (container is SupplyDrop) { container.inventory.itemList.Clear(); container.minSecondsBetweenRefresh = -1; container.maxSecondsBetweenRefresh = 0; container.CancelInvoke("SpawnLoot"); int slot = 0; foreach (Item item in createItemList()) { ConsoleSystem.Broadcast("chat.add", 0, item.info); item.MoveToContainer(container.inventory, slot, false); slot++; //container.lootDefinition.SpawnIntoContainer() } container.inventory.MarkDirty(); } } private List<Item> createItemList() { List<Item> itemList = new List<Item>(); Item i1 = ItemManager.CreateByName("explosive.timed"); Item i2 = ItemManager.CreateByName("rifle_ak"); itemList.Add(i1); itemList.Add(i2); return itemList; }
Unable to spawn new items in Airdrop
Discussion in 'Rust Development' started by R0flpant0ff3l, Jun 2, 2015.
