R3vo 2654 Posted June 28, 2015 Hey folks, I'm currently adding new functions to bakerman's AIS script. Tanks now use their smoke launcher after beeing hit by a rocket, but I also want them to fire their 120/125mm cannon at the attacker. The firing of the weapon works fine, but I'm unable to figure out how to change the magazine from APFSDS to HEAT shells. if (typeOf (_this select 0) == "B_MBT_01_cannon_F" || typeOf (_this select 0) == "O_MBT_02_cannon_F" || typeOf (_this select 0) == "I_MBT_03_cannon_F" || typeOf (_this select 0) == "B_MBT_01_TUSK_F") then { (_this select 0) selectWeapon (weapons (_this select 0) select 0); (_this select 0) fire (weapons (_this select 0) select 0); }; That's the part of the code where I need to add the magazine change. Since it should work with 4 different tanks I would need a general solution, which works for all for of them. Any ideas are apprechiated! R3vo Share this post Link to post Share on other sites
R3vo 2654 Posted June 28, 2015 (edited) Use loadMagazine Damn, that easy ? I wish the search function on the Wiki would return all commands with "magazines" in their name once you search for "magazines". Thanks Larrow. Edit: Works splendidly, tanks are not attacking enemy infantry with HE ammo and are more deadly than ever. Edited June 28, 2015 by R3vo Share this post Link to post Share on other sites
Greenfist 1863 Posted June 28, 2015 I wish the search function on the Wiki would return all commands with "magazines" in their name once you search for "magazines". The search is pretty terrible, in my opinion. Ctrl+F on this page instead: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 Or use this: http://commandsearch.craigvg.com/ :) Share this post Link to post Share on other sites
Larrow 2828 Posted June 28, 2015 (edited) Ctrl+F on this page instead: https://community.bistudio.com/wiki/...ommands_Arma_3 Yep this is what i do, although i have find as you type turned on for firefox so i just load that page type what i want to find and just press F3 to flick through all the options.Quick a dirty swap function for changing MBT cannon mag swapAmmo = { _vehicle = _this select 0; _wanted = "_" + ( _this select 1 ) ; //"HE" or "AP" _mainWeapon = ( _vehicle weaponsTurret [0] ) select 0; _vehicle selectWeaponTurret [ _mainWeapon, [0] ]; _currentMagazine = _vehicle currentMagazineTurret [0]; if !( [ _wanted, _currentMagazine ] call BIS_fnc_inString ) then { _availableMags = _vehicle magazinesTurret [0]; _swapTo = ""; { if ( [ _wanted, _x ] call BIS_fnc_inString ) exitWith { _swapTo = _x; }; }forEach _availableMags; if !( _swapTo isEqualTo "" ) then { _vehicle loadMagazine [ [0], _mainWeapon, _swapTo ]; true }else{ false }; }else{ true }; }; Edited June 28, 2015 by Larrow Share this post Link to post Share on other sites
R3vo 2654 Posted June 28, 2015 The search is pretty terrible, in my opinion.Or use this: http://commandsearch.craigvg.com/ :) That's fantastic, that's how it should be on the wiki page. @Larrow, thanks for that script, I'll take a look at it. Share this post Link to post Share on other sites
killzone_kid 1333 Posted June 28, 2015 Damn, that easy ? I wish the search function on the Wiki would return all commands with "magazines" in their name once you search for "magazines". http://killzonekid.com/arma-2-arma-3-scripting-commands-list/ Ctrl+F magazine Share this post Link to post Share on other sites