twisted 127 Posted September 22, 2013 it should be sort of simple. i am trying to ensure that untis get armed with enough ammo despite how mags are sometime dropped as they do not fit into inventory. so i though the simplest thing to do would be check if every unit has a backpack, and if not add a backpack. but this code doesnt do that even though i get no errors. { _bagx = unitBackpack _x; if ( (isNil("_bagx"))) then { _x addbackpack "B_Kitbag_cbr"; }; } foreach units _group1 anyone can shed some light on why I'd appreciate it. thanks Share this post Link to post Share on other sites
kylania 567 Posted September 22, 2013 unitBackpack returns an object or null object if there isn't one, so isNull instead of isNil. { if (isNull (unitBackpack _x)) then {_x addBackpack "B_Kitbag_cbr"}; } foreach units _group1; Share this post Link to post Share on other sites
twisted 127 Posted September 22, 2013 awesome, thanks Kylania! Share this post Link to post Share on other sites