Texeiro 15 Posted March 18, 2020 want to make a script in which if certain conditions are met, a specific result is produced. Specifically what I am trying to do is an IED factory. There are two requirements inicially: The presence of a "technician" ( will do with a trigger) and the other the raw material. The raw material must be placed in" box a "and "box B" will show the finished product. this is what i tried so far and i can't get it to work: Spoiler _items = magazinesAmmo box1; if ( "DemoCharge_F" in _items) then { box2 addMagazineCargoGlobal ["SatchelCharge_F", 10] } Can someone say me what I m doing wrong? Thanks i advance Share this post Link to post Share on other sites
POLPOX 766 Posted March 18, 2020 You can't detect magazine name by magazinesAmmo in that usage, since it returns an array so in doesn't work well. magazinesAmmo YourBoxNameHere findif {_x#0 == "YourMagazineNameHere"} != -1 Try this method instead to detect. 1 Share this post Link to post Share on other sites
Texeiro 15 Posted March 18, 2020 Thanks Polpox for your help.!!!! tried: magazinesAmmo box1 findif {_x #0 == "DemoCharge_F"} != -1; then { box2 addMagazineCargoGlobal ["SatchelCharge_F", 10] }; It didn t work, show some error. Is that #0 ok? Share this post Link to post Share on other sites
POLPOX 766 Posted March 18, 2020 That's not even correct syntax for if, nor sqf. Do just like before. if (magazinesAmmo box1 findif {_x#0 == "DemoCharge_F"} != -1) then { box2 addMagazineCargoGlobal ["SatchelCharge_F", 10] }; DemoCharge_F and SatchelCharge_F aren't correct ammo name BTW (at least in vanilla Arma 3), so this won't work also. You probably looking for those classes: DemoCharge_Remote_Mag and SatchelCharge_Remote_Mag. 1 Share this post Link to post Share on other sites
Texeiro 15 Posted March 18, 2020 48 minutes ago, POLPOX said: That's not even correct syntax for if, nor sqf. Do just like before. if (magazinesAmmo box1 findif {_x#0 == "DemoCharge_F"} != -1) then { box2 addMagazineCargoGlobal ["SatchelCharge_F", 10] }; DemoCharge_F and SatchelCharge_F aren't correct ammo name BTW (at least in vanilla Arma 3), so this won't work also. You probably looking for those classes: DemoCharge_Remote_Mag and SatchelCharge_Remote_Mag. yes Polpox, thanks a lot, you re rigth with the classnames. I changedit. Now script show no error but still nothing hapens. Share this post Link to post Share on other sites
POLPOX 766 Posted March 19, 2020 How do you execute it? And what exactly do you wanted to do to the code? Share this post Link to post Share on other sites
Tankbuster 1733 Posted March 19, 2020 Magazinesammo returns nested arrays . Any tests on the result will have to iterate through the returned arrays. Share this post Link to post Share on other sites
Texeiro 15 Posted March 20, 2020 @polpox ; I execute it from the init. I want to use the box A content as raw material for the product in box B . If I got some kind of explosive in box A I could manufacture IEDs in Box B. @tankbuster: sorry I don´t get it, I ´m just a noob with scripts. Share this post Link to post Share on other sites
POLPOX 766 Posted March 20, 2020 2 hours ago, Texeiro said: I execute it from the init. I want to use the box A content as raw material for the product in box B . If I got some kind of explosive in box A I could manufacture IEDs in Box B. So in a nutshell if you put DemoCharge_Remote_Mag into the box, will generate 10 SatchelCharge_Remote_Mags is the thing you wanted to do? And maybe you wanted to remove DemoCharge if is in box? Okay, so, init only executes once, when the mission starts. Of course in the beginning there was nothing so nothing happens. You might need a repeatable Trigger to do this. Condition: magazinesAmmo box1 findif {_x#0 == "DemoCharge_Remote_Mag"} != -1 On Activation: box2 addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", 10]; clearMagazineCargo box1; Of course not perfect but still works like a charm. 1 Share this post Link to post Share on other sites
Texeiro 15 Posted March 20, 2020 ohhh you read my mind Polpox!! Thank you so much!!!!! Share this post Link to post Share on other sites