exevankeko 10 Posted October 29, 2013 Anyone know of any script that generates different weapons, when spawning. ? is for a TDM, i was looking everywhere and found nothing, only one and it does not work. or it can also be some script that you can choose the weapon you want to use every time you spawn. Share this post Link to post Share on other sites
exevankeko 10 Posted October 30, 2013 I found this script, but it does not work what's wrong? Original script arma 2: private ["_muzzles","_weapon","_pw","_item","_unit","_weaponChance","_itemChance","_clearAll","_weaponRoll","_itemRoll","_weaponList","_itemList","_defaultItems"]; // Called via: nul = [this] execVM "randomWeapons.sqf"; // Default 60% chance for weapons and items and clears previous items replacing them with Map, Watch, Compass and Radio. Adjust _defaultItems to change that. // Optional fields: nul = [this, 100, 30, false] execVM "randomWeapons.sqf" would always give a weapon, 30% give items and let you keep items you had before. // // Code based on ideas from SuMatra and Xeno. // Declare unit and options from input arguments. _unit = _this select 0; _weaponChance = if (count _this > 1) then {_this select 1} else {60}; _itemChance = if (count _this > 2) then {_this select 2} else {60}; _clearAll = if (count _this > 3) then {_this select 3} else {true}; // Make the rolls to see if an item is given. _weaponRoll = ceil (random 100); _itemRoll = ceil (random 100); //player sideChat format["Weapon: %1/%3 Item: %2/%4", _weaponRoll, _itemRoll, _weaponChance, _itemChance]; // List of weapons matched up with their ammo. _weaponList = [ ["UZI_EP1", "ACE_30Rnd_9x19_S_UZI"], ["ACE_USP", "ACE_12Rnd_45ACP_USP"], ["ACE_AK103", "ACE_30Rnd_762x39_AP_AK47"], ["ACE_G36K_iron", "30Rnd_556x45_G36"], ["ACE_G3A3", "ACE_20Rnd_762x51_B_G3"], ["ACE_gr1", "30Rnd_762x39_AK47"] ]; // List of possible reward items. _itemList = ["ACE_Earplugs","Binocular_Vector","ACE_GlassesTactical"]; // List of default items to always have. _defaultItems = ["ItemMap", "ItemWatch", "ItemCompass", "ItemRadio"]; // Clear weapons from the unit. removeAllWeapons _unit; // By default we'll remove all items as well to clear previous reward items and give back _defaultItems. if (_clearAll) then { removeAllItems _unit; {_unit addWeapon _x} forEach _defaultItems; }; // If we're less than or equal to the weapon chance if (_weaponRoll <= _weaponChance) then { // Pick a random weapon/mag pair from _weaponList. _weapon = _weaponList select floor(random(count _weaponList)); //player groupChat format["Adding %1 and 2x %2", (_weapon select 0), (_weapon select 1)]; // Add two of the selected mags for "_i" from 0 to 1 do { _unit addMagazine (_weapon select 1); }; // Add the selected weapon _unit addWeapon (_weapon select 0); // Ready weapon if it's got a GL muzzle. _pw = primaryWeapon _unit; if (_pw != "") then { _unit selectWeapon _pw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _pw >> "muzzles"); _unit selectWeapon (_muzzles select 0); } else { // If all they have is a pistol ready that. _unit selectWeapon (_weapon select 0); }; }; // If we're less than or equal to the item chance if (_itemRoll <= _itemChance) then { // Pick a random item from the _itemList. _item = _itemList select floor(random(count _itemList)); // player groupChat format["Adding %1", _item]; // Give the item _unit addWeapon _item; }; I edit to work on ARMA 3, changing weapons but I can not work what is wrong? private ["_muzzles","_weapon","_pw","_item","_unit","_weaponChance","_itemChance","_clearAll","_weaponRoll","_itemRoll","_weaponList","_itemList","_defaultItems"]; // Called via: nul = [this] execVM "randomWeapons.sqf"; // Default 60% chance for weapons and items and clears previous items replacing them with Map, Watch, Compass and Radio. Adjust _defaultItems to change that. // Optional fields: nul = [this, 100, 30, false] execVM "randomWeapons.sqf" would always give a weapon, 30% give items and let you keep items you had before. // // Code based on ideas from SuMatra and Xeno. // Declare unit and options from input arguments. _unit = _this select 0; _weaponChance = if (count _this > 1) then {_this select 1} else {60}; _itemChance = if (count _this > 2) then {_this select 2} else {60}; _clearAll = if (count _this > 3) then {_this select 3} else {true}; // Make the rolls to see if an item is given. _weaponRoll = ceil (random 100); _itemRoll = ceil (random 100); //player sideChat format["Weapon: %1/%3 Item: %2/%4", _weaponRoll, _itemRoll, _weaponChance, _itemChance]; // List of weapons matched up with their ammo. _weaponList = [ ["arifle_MX_SW_F", "100Rnd_65x39_caseless_mag"], ["arifle_Khaybar_C_ACO_point_F", "30Rnd_65x39_caseless_green"], ["arifle_TRG21_ARCO_point_F", "30Rnd_65x39_case_mag"], ["LMG_Mk200_F", "200Rnd_65x39_cased_Box"], ["arifle_MXC_ACOg_point_grip_F", "100Rnd_65x39_caseless_mag"], ["arifle_TRG20_F", "30Rnd_65x39_case_mag"] ]; // List of possible reward items. _itemList = ["ACE_Earplugs","Binocular","ACE_GlassesTactical"]; // List of default items to always have. _defaultItems = ["ItemMap", "ItemWatch", "ItemCompass", "ItemRadio"]; // Clear weapons from the unit. removeAllWeapons _unit; // By default we'll remove all items as well to clear previous reward items and give back _defaultItems. if (_clearAll) then { removeAllItems _unit; {_unit addWeapon _x} forEach _defaultItems; }; // If we're less than or equal to the weapon chance if (_weaponRoll <= _weaponChance) then { // Pick a random weapon/mag pair from _weaponList. _weapon = _weaponList select floor(random(count _weaponList)); //player groupChat format["Adding %1 and 2x %2", (_weapon select 0), (_weapon select 1)]; // Add two of the selected mags for "_i" from 0 to 1 do { _unit addMagazine (_weapon select 1); }; // Add the selected weapon _unit addWeapon (_weapon select 0); // Ready weapon if it's got a GL muzzle. _pw = primaryWeapon _unit; if (_pw != "") then { _unit selectWeapon _pw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _pw >> "muzzles"); _unit selectWeapon (_muzzles select 0); } else { // If all they have is a pistol ready that. _unit selectWeapon (_weapon select 0); }; }; // If we're less than or equal to the item chance if (_itemRoll <= _itemChance) then { // Pick a random item from the _itemList. _item = _itemList select floor(random(count _itemList)); // player groupChat format["Adding %1", _item]; // Give the item _unit addWeapon _item; }; This page takes the names of weapons: http://forums.bistudio.com/showthread.php?147502-SIX-Config-Browser-Editing-resource-ARMA-3-Alpha-available I can not get it to work you have to change something else in the code? or if they know of any "script" better will thank Share this post Link to post Share on other sites