BeaniePope. 1 Posted October 30, 2024 So, I have a mission file where I want players to open containers with the variable names "container1" to "containerX", and they will contain randomized loot items. My attempt at the script is below, and it doesn't throw any errors, but it also doesn't do anything. If anyone knows why my script doesn't work, please let me know! Would be a great help! (The reason it iterates through a containers array is for future usage of the array) private _loot = ["Item_AM_scrapelectronics", "Item_AM_mataljunk", "Item_AM_ductape"]; private _containerCount = 4; // ------------------------------------------------ private _containers = [""]; _containers resize _containerCount; { private _lootIndex = 0; private _lootAmount = 0; _lootSize = count _loot; _lootIndex random _lootSize; _lootAmount random 10; _lootItem = _loot select _lootIndex; private _index = _forEachIndex; _x = "container" + str _index; private _variable = _x; private _container = missionNamespace getVariable _variable; _container addItemCargoGlobal [_lootItem, _lootAmount]; } forEach _containers; Share this post Link to post Share on other sites
Schatten 290 Posted October 30, 2024 I'm not sure that _loot var contains correct class names, so check them. There is also for loop that is more suitable for your case. Share this post Link to post Share on other sites
Joe98 92 Posted November 2, 2024 You could start with a simple version and build on it. Choose one item and place just one in the container via a script. When you get that to work, build on it. Share this post Link to post Share on other sites