TAW_Yonose 11 Posted September 25, 2013 Hey, I'm making a Sniper mission where the sniper have to find a intel, but I want the intel to spawn into a random cargo. Like i have set out 5 cargos at different locations, but I just want the item to spawn randomly in one of those cargos. How should I do this? - Yonose Share this post Link to post Share on other sites
kylania 568 Posted September 25, 2013 Group the intel with markers. It'll spawn where placed or at one of the markers automatically. Share this post Link to post Share on other sites
TAW_Yonose 11 Posted September 25, 2013 Group the intel with markers. It'll spawn where placed or at one of the markers automatically. Will it spawn into a Supply Box then? Share this post Link to post Share on other sites
kylania 568 Posted September 25, 2013 Oh, sorry misread it. So you have 5 preplaced ammo boxes and you want ONE of them to have the item inside? Super easy. :) In your init.sqf: if (isServer) then { _crates = [ammo1, ammo2, ammo3, ammo4, ammo5]; _crate = _crates call BIS_fnc_selectRandom; _intel = _crate addWeaponCargoGlobal ["WhateverItem", 1]; }; Share this post Link to post Share on other sites
TAW_Yonose 11 Posted September 25, 2013 (edited) Thank you so much.. now i still got this problem since im new to scripting... Do i have to call the Supply boxes ammo1, ammo2, ammo3, ammo4, ammo5 ? or BIS_fnc_selectRandom? Do i need to change something else then "WhatEverItem" ? and shouldnt it be _intel = _crate addItemCargoGlobal ["optic_NVS", 1]; and not _intel = _crate addWeaponCargoGlobal ["WhateverItem", 1]; Edited September 25, 2013 by TAW_Yonose Share this post Link to post Share on other sites
kylania 568 Posted September 25, 2013 The ammo1 would go in the Name: field of the boxes themselves. Share this post Link to post Share on other sites
TAW_Yonose 11 Posted September 25, 2013 Well, i cant get it working..:confused: Share this post Link to post Share on other sites
kylania 568 Posted September 25, 2013 Yeah, exactly, the intel line would be: _intel = _crate addItemCargoGlobal ["optic_NVS", 1]; I didn't know what item you were using, so: if (isServer) then { _crates = [ammo1, ammo2, ammo3, ammo4, ammo5]; _crate = _crates call BIS_fnc_selectRandom; _intel = _crate addItemCargoGlobal ["optic_NVS", 1]; }; Share this post Link to post Share on other sites
Valixx 11 Posted September 25, 2013 You can find some of the classnames here: http://www.assaultmissionstudio.de/index.php?topic=934.0 "optic_NVS" is a classname. Share this post Link to post Share on other sites
TAW_Yonose 11 Posted September 25, 2013 well.. this is weird, this isent working with me, i cant see the item spawning inside the supply box..:( Share this post Link to post Share on other sites
kylania 568 Posted September 25, 2013 Make sure you're naming the ammo boxes correctly: Also is your init.sqf listed as an SQF file or a Text Document in your mission folder? If it says it's a Text then it's actually named init.sqf.txt and isn't running. Remove the .txt extension. Share this post Link to post Share on other sites
TAW_Yonose 11 Posted September 25, 2013 (edited) ahhh... hehe okey i'll try that, good i learned on the school today how i did it :P Edited September 25, 2013 by TAW_Yonose Share this post Link to post Share on other sites