nebulazerz 18 Posted July 22, 2016 I am trying to get the names for all the parent classes for the magazine that is in the handgun of the player so that i can drop the correct amount of ammo on the ground when removing their items the problem is that this structure does not allow arrays, so i need some way to convert my array to just the single classname of the item. handgunMagazine player; gives back a format of [""] but the fnc returnParents cannot have the array brackets. _myMag = handgunMagazine player; _allMags = [(configfile >> "CfgMagazines" >> _myMag),true ] call BIS_fnc_returnParents; Share this post Link to post Share on other sites
nebulazerz 18 Posted July 22, 2016 Thank you, that did the trick :) Edit: im still kinda stuck though maybe you can help me with the next part. I am trying to drop the correct amount of magazines no matter if the magazines are 30rnd or 15rnd or tracer or whatever. it doesnt have to give back all the right type of ammo(it can all be just the kind that was in the gun and thats ok with me) but it needs to be the right type of ammo. also for some reason its not removing all of the old ammo from the inventory like it should either. Right now this puts just the kind that was in the gun still, but i need the amount of the parent type that was in the inventory. Edit2: if do this instead it gives me blank items in the weaponholder instead of ammo {_old addmagazineCargo [_x, (_magCount+1)];} forEach _allMags; //if handgun if ( getNumber( configFile >> "CfgWeapons" >> _className >> "type" ) isEqualTo 2 ) then{ _myHandgun = handgunWeapon player; _myMag = handgunMagazine player; _theMag = _myMag select 0; _allMags = [(configfile >> "CfgMagazines" >> _theMag),true ] call BIS_fnc_returnParents; _magCount = {_x in _allMags} count magazines player; _old = createVehicle [ "weaponHolderSimulated", player getPos [ 1, getDir player ], [], 0, "CAN_COLLIDE" ]; _old addWeaponCargo [_myHandgun, 1]; {_old addmagazineCargo [_x, (_magCount+1)];} forEach _myMag; _old setPos [getPos player select 0, getPos player select 1, (getPos player select 2) +1]; { if ( _x in handgunMagazine player ) then { player removeMagazine _x } } forEach magazines player; }; Edit3: It seems to work fine for primary weapons and ammo. why would it be any different for handguns? //if primary if ( getNumber( configFile >> "CfgWeapons" >> _className >> "type" ) isEqualTo 1 ) then{ _myRifle = primaryWeapon player; _myAtt = primaryWeaponItems player; _myMag = primaryWeaponMagazine player; _theMag = _myMag select 0; _allMags = [(configfile >> "CfgMagazines" >> _theMag),true ] call BIS_fnc_returnParents; _magCount = {_x in _allMags} count magazines player; _old = createVehicle [ "weaponHolderSimulated", player getPos [ 1, getDir player ], [], 0, "CAN_COLLIDE" ]; _old addWeaponCargo [_myRifle, 1]; {_old additemCargo [_x, 1];} forEach _myAtt; {_old addmagazineCargo [_x, (_magCount+1)];} forEach _myMag; _old setPos [getPos player select 0, getPos player select 1, (getPos player select 2) +1]; { if ( _x in primaryWeaponMagazine player ) then { player removeMagazine _x } } forEach magazines player; }; Share this post Link to post Share on other sites
Larrow 2823 Posted July 22, 2016 Hmm after helping you with your ui, What i meant by heres some clues lets see how far you can get on your own with sorting compatible magazines, I didnt mean go ask the rest of the forums lol and its not even been half a day. 3 Share this post Link to post Share on other sites
HallyG 239 Posted July 22, 2016 Hmm after helping you with your ui, What i meant by heres some clues lets see how far you can get on your own with sorting compatible magazines, I didnt mean go ask the rest of the forums lol and its not even been half a day. I'll further this idea with a quote from Aristotle: “For the things we have to learn before we can do them, we learn by doing them.†3 Share this post Link to post Share on other sites
nebulazerz 18 Posted July 23, 2016 Hmm after helping you with your ui, What i meant by heres some clues lets see how far you can get on your own with sorting compatible magazines, I didnt mean go ask the rest of the forums lol and its not even been half a day. haha I got stuck going in circles, you showed me I was going in the wrong circle anyway. :rolleyes: Share this post Link to post Share on other sites