oneisdown 16 Posted July 11, 2017 I am working on a cool older script using the "alive" mod combat support and the "unsung" mod radio back pack. I found the code in these forums from 2015. So here is how it works: The item I have set up to call support is the standard arma 3 radio. The script will spawn a radio into the players inventory if he or she is within 2 feet of the the soldier with the unsung radio backpack, and the curser is on the unsung back pack. If the player moves more than 2 feet away away from the radio mans pack or the curser is removed from the radio mans pack the arma 3 radio is removed from the players inventory. This simulates the cord length of radio. It works great, but i need to fill the back pack capacity so a player cant just stuff it full of 30 round mags. I decided to use 45 laser designator batteries, which fills the pack up nicely and seems like a realistic choice to simulate the power storage for the radio. I have been trying to use the "and" statement to make sure the battery count is at 45 in order to meet the conditions to proceed with the script, but no luck. I am sure this is a simple fix but its way over my head. Here is the code player addaction ["Use Radio",{player addItem "ItemRadio"; player assignItem "ItemRadio"},0,0,true,true,"","backpack CursorTarget == 'UNS_ARMY_RTO' and (_this distance Cursortarget)<2"]; waitUntil {(isNull CursorTarget) OR (player Distance CursorTarget > 2)}; player unassignItem "ItemRadio"; player removeitem "ItemRadio"; Hint "Radio Removed"; somewhere in there I have to include something like "and Laserbatteries=45" any help is appreciated!! Share this post Link to post Share on other sites
oneisdown 16 Posted July 12, 2017 also how would i loop this i cant seem to get the loop to work? Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted July 12, 2017 Your example won't work since all the action does is add the radio. You want a loop checking the distance inside the action, so it will be executed when the action is used. player addaction ["Use Radio",{ _addRadio = [_this,cursorTarget] spawn { params ["_actionParams","_target"]; _actionParams params ["_player","_caller","_ID"]; _player linkItem "ItemRadio"; hint "You picked up the units radio!"; waitUntil {!alive _player OR _player distance _target > 2}; _player unlinkItem "ItemRadio"; hint "You dropped the units radio!\nThe cord is too short!"; }; },0,0,true,true,"","!('ItemRadio' in assignedItems _target) AND {backpack CursorTarget == 'UNS_ARMY_RTO'} AND {(_target distance Cursortarget)<2} AND {{_x isEqualTo 'Laserbatteries'} count backpackitems cursortarget >= 45}"]; Nothing too complicated, the condition for the battery check is also included. Feel free to ask if you have any questions. Cheers Share this post Link to post Share on other sites
oneisdown 16 Posted July 12, 2017 IT WORKS PERFECT!!!! Thanks Grumpy!!! 1 Share this post Link to post Share on other sites