Bernds 1 Posted February 27, 2013 I would like to select the contents (objects) of a WeaponHolder by script. I filled a weaponHolder by: _holder addWeaponCargoGlobal [_name,1]; I can find that magazine(s) by: _mags = getMagazineCargo (_holder select 0); and I can i.e. do this now: player addMagazine ((_mags select 0) select 0); But I can't select that object itself, I get a message that (inside this example): ((_mags select 0) select 0) is a string and not an object. That's true, player addMagazine needs the string to work, but I need the object itself. So my question is: Is there a way to 'grab' the objects 'inside' a weaponHolder? And if, howto? Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted February 27, 2013 (edited) Does getWeaponCargo not work? http://community.bistudio.com/wiki/getWeaponCargo _whldr = "WeaponHolder" createVehicle (getMarkerPos "wpHldr"); _whldr addWeaponCargoGlobal ["M16A4",1]; _cnts = getWeaponCargo whldr; hint format ["%1",_cnts]; _weapM16A4 = (cnts select 0) select 0; Edited February 27, 2013 by Mattar_Tharkari Share this post Link to post Share on other sites
Bernds 1 Posted February 27, 2013 if I'll add something behind _weapM16A4 = (cnts select 0) select 0; like f.e. this: detach _weapM16A4; it will tell me (free translated) the same as in my code then: _weapM16A4 is a String and not an object. original: _weapM16A> Error detach: Typ Zeichenfolge, erwartet Objekt Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted February 27, 2013 (edited) I understand now. But why do you need the exact object? Once you have the class "M16A4" you can add it anywhere, then use: clearMagazineCargo clearMagazineCargoGlobal clearWeaponCargo clearWeaponCargoGlobal to remove it from the weapon holder. I don't know of a method to select an object in cargo and I'm not sure it's possible. What is it you are trying to do? There might be another way of doing it? Edited February 27, 2013 by Mattar_Tharkari Share this post Link to post Share on other sites
Bernds 1 Posted February 28, 2013 My goal was changing the look of the (ammo) clip dropped to the ground. That dropped clips are inside a bag and I would like to change that to the corresponding (ammo) clip ones. I don't know if that is possible, was just a thought, and I stucked for now by grabing the object inside the weaponholder. To go ahead I would need how to get the object or, if possible, how to convert that returned string to the object. Share this post Link to post Share on other sites
nimrod_z 8 Posted March 1, 2013 (edited) My goal was changing the look of the (ammo) clip dropped to the ground.That dropped clips are inside a bag and I would like to change that to the corresponding (ammo) clip ones. I don't know if that is possible, was just a thought, and I stucked for now by grabing the object inside the weaponholder. To go ahead I would need how to get the object or, if possible, how to convert that returned string to the object. thats a config thing.. you would have to make a custom one for that effect. just like the a2ccp project is also doing.. (in the config section of the forums) Edited March 1, 2013 by Nimrod_Z Share this post Link to post Share on other sites
Bernds 1 Posted March 1, 2013 Thx for info! But this means that even setting objects in same weaponholder to different heights are impossible? Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted March 1, 2013 Thx for info!But this means that even setting objects in same weaponholder to different heights are impossible? Change the height of the weapon holder. You can setPosATL it: whName setPosATL [ getPosATL whName select 0, getPosATL whName select 1, (getPosATL whName select 2) +2]; Share this post Link to post Share on other sites