Bricktop Posted April 21, 2017 Report Share Posted April 21, 2017 !! I claim no credit for this and have no idea who thought of it first !! It's just some code added to the server_monitor.sqf to create vehicles with custom weapons. =========================== To install: Open path: dayz_server.pbo\system\server_monitor.sqf Find this block of code: Spoiler //Dont add inventory for traps. if (!_isDZ_Buildable && !_isTrapItem) then { clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; clearBackpackCargoGlobal _object; Below it place this: Spoiler if (_object isKindOf "MH6J_EP1") then { _object addWeapon "yakb"; _object addMagazine "1470Rnd_127x108_YakB"; _object addMagazine "1470Rnd_127x108_YakB"; _object addWeapon "2a70"; _object addMagazine "22Rnd_100mm_HE_2A70"; _object addWeapon "flarelauncher"; _object addMagazine "flarelaunchermag"; _object addMagazine "flarelaunchermag"; }; if (_object isKindOf "An2_TK_EP1") then { _object addWeapon "m3p"; _object addMagazine "250Rnd_127x99_M3P"; _object addMagazine "250Rnd_127x99_M3P"; _object addMagazine "250Rnd_127x99_M3P"; _object addMagazine "250Rnd_127x99_M3P"; _object addWeapon "ffarlauncher"; _object addMagazine "38rnd_ffar"; _object addMagazine "38rnd_ffar"; _object addWeapon "flarelauncher"; _object addMagazine "flarelaunchermag"; _object addMagazine "flarelaunchermag"; }; if (_object isKindOf "tractor") then { _object addWeapon "twinm134"; _object addMagazine "4000rnd_762x51_m134"; _object addMagazine "4000rnd_762x51_m134"; _object addWeapon "d30"; _object addMagazine "ARTY_30Rnd_122mmHE_D30"; }; if (_object isKindOf "mv22") then { _object addWeapon "M197"; _object addMagazine "750Rnd_M197_AH1"; _object addMagazine "750Rnd_M197_AH1"; _object addWeapon "80mmLauncher"; _object addMagazine "40Rnd_80mm"; _object addMagazine "40Rnd_80mm"; }; if (_object isKindOf "Ikarus_TK_CIV_EP1") then { _object addWeapon "GSh301"; _object addMagazine "180Rnd_30mm_GSh301"; _object addMagazine "180Rnd_30mm_GSh301"; _object addMagazine "180Rnd_30mm_GSh301"; }; if (_object isKindOf "pook_H13_amphib_CDF") then { _object addWeapon "GSh302"; _object addMagazine "750Rnd_30mm_GSh301"; _object addMagazine "750Rnd_30mm_GSh301"; _object addWeapon "m119"; _object addMagazine "30Rnd_105mmHE_M119"; _object removeweapon "smokelauncher"; _object addWeapon "flarelauncher"; _object removemagazine "smokelaunchermag"; _object addMagazine "flarelaunchermag"; _object addMagazine "flarelaunchermag"; }; if (_object isKindOf "KORD") then { _object addWeapon "M168"; _object addMagazine "2100Rnd_20mm_M168"; _object addMagazine "2100Rnd_20mm_M168"; }; if (_object isKindOf "ATV_US_EP1") then { _object addWeapon "twinm134"; _object addMagazine "4000Rnd_762x51_M134"; _object addMagazine "4000Rnd_762x51_M134"; }; if (_object isKindOf "ArmoredSUV_PMC") then { _object addWeapon "m230"; _object addMagazine "1200Rnd_30x113mm_M789_HEDP"; _object addMagazine "1200Rnd_30x113mm_M789_HEDP"; }; if (_object isKindOf "C130J_US_EP1") then { _object addWeapon "mlrs"; _object addMagazine "12rnd_mlrs"; _object addMagazine "12rnd_mlrs"; _object addMagazine "12rnd_mlrs"; _object addWeapon "m168"; _object addMagazine "2100Rnd_20mm_M168"; _object addMagazine "2100Rnd_20mm_M168"; }; Done! =========================== Important: (This code should be customized to fit your server - I have a militarized server) 1) These vehicles do NOT spawn with custom weapons when you buy them. 2) You must wait for the server to restart before they become armed. 3) You wont see the weapons after restart - Just get in press F and shoot! =========================== Here's a small video preview: Here's the list of vehicles included in the code: =====Armed Little Bird with - yakb + 2a70 + flarelauncher---Armed An2 with - m3p + ffarlauncher + flarelauncher---Armed tractor with - twinm134 + d30---Armed mv22 with - M197 + 80mmLauncher---Armed Bus with - GSh301---Armed pook amphib with - GSh302 + m119 + flarelauncher---Armed KORD with - M168---Armed ATV with - twinm134---Armed SUV with - m230---Armed C130J with - mlrs + m168 =========================== Happy Hunting :) gernika, juandayz, Zoranth and 3 others 6 Link to comment Share on other sites More sharing options...
Hooty Posted April 21, 2017 Report Share Posted April 21, 2017 This is what i do for weapons on vehicles make a file called VehicleAmmo.sqf in your system, compile, and "garage folder if you have one" all server side. What this does is make vehicles spawn with the weapons soon as you buy and withdraw from garage. Does not work with admin spawn in vehicles. VehicleAmmo.sqf example: Spoiler if (_object isKindOf "AN2_DZ") then { _object addWeapon "YakB"; _object addMagazine "1470Rnd_127x108_YakB"; }; add more vehicles and weapons as you like. Next place #include "VehicleAmmo.sqf"; in dayz_server\system\sever_monitor.sqf under Spoiler if (_object isKindOf "AllVehicles") then { _object setVariable ["CharacterID", _ownerID, true]; _isAir = _object isKindOf "Air"; { _selection = _x select 0; _dam = if (!_isAir && {_selection in dayZ_explosiveParts}) then {(_x select 1) min 0.8;} else {_x select 1;}; _strH = "hit_" + (_selection); _object setHit[_selection,_dam]; _object setVariable [_strH,_dam,true]; } foreach _hitpoints; [_object,"damage"] call server_updateObject; _object setFuel _fuel; Then paste #include "VehicleAmmo.sqf"; in dayz_server\compile\server_publishVehicle2.sqf under Spoiler clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; Next place #include "VehicleAmmo.sqf"; in dayz_server\compile\spawn_vehicles.sqf under Spoiler clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; Thanks to @BigEgg. If you have Virtual Garage add #include "VehicleAmmo.sqf"; to dayz_server\compile\garage\server_spawnVehicles.sqf under Spoiler clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; I use https://community.bistudio.com/wiki/ArmA_2:_Weapons to get weapon id. juandayz, nova and Bricktop 1 2 Link to comment Share on other sites More sharing options...
JasonTM Posted April 21, 2017 Report Share Posted April 21, 2017 The tractor had me rolling. juandayz, nova and Bricktop 2 1 Link to comment Share on other sites More sharing options...
kingpapawawa Posted April 21, 2017 Report Share Posted April 21, 2017 12 hours ago, Hooty said: This is what i do for weapons on vehicles make a file called VehicleAmmo.sqf in your system, compile, and "garage folder if you have one" all server side. Does not work with admin spawn in vehicles. Is there any reason you cant make 1 copy and include it with the full path? So admin spawn a vehicle and in and out of the garage will add weapons? looking forward to trying this Link to comment Share on other sites More sharing options...
Relentless Posted April 21, 2017 Report Share Posted April 21, 2017 The tractor made my day and reminded my of pirates of the carribean where the little guy shot with a rocket launcher. Bricktop 1 Link to comment Share on other sites More sharing options...
axelrocket Posted April 21, 2017 Report Share Posted April 21, 2017 nice script dude Hooty 1 Link to comment Share on other sites More sharing options...
Hooty Posted April 21, 2017 Report Share Posted April 21, 2017 8 hours ago, kingpapawawa said: Is there any reason you cant make 1 copy and include it with the full path? So admin spawn a vehicle and in and out of the garage will add weapons? looking forward to trying this I never tried with 1 copy so really dont know and yes admin spawns put in garage remove from garage it will have weapons. Link to comment Share on other sites More sharing options...
harcosgoogle Posted April 22, 2017 Report Share Posted April 22, 2017 Where add included code? Link to comment Share on other sites More sharing options...
juandayz Posted April 22, 2017 Report Share Posted April 22, 2017 3 hours ago, harcosgoogle said: Where add included code? Quote Open path: dayz_server.pbo\system\server_monitor.sqf harcosgoogle and gernika 2 Link to comment Share on other sites More sharing options...
harcosgoogle Posted April 23, 2017 Report Share Posted April 23, 2017 Why is it sometimes that it works sometimes? After restarting worked juandayz 1 Link to comment Share on other sites More sharing options...
salival Posted April 23, 2017 Report Share Posted April 23, 2017 I always found that you had to run this script/variants of this script twice to make the weapons properly remove. Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 17, 2017 Report Share Posted August 17, 2017 Is there a way to change which seat uses the weapon? for example: an armored suv with hydras useable in the drivers seat, and for the gunner the minigun and a yakB? Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 17, 2017 Report Share Posted August 17, 2017 I'm also having an issue with this script, when I get in some of my vehicles my game crashes. In my client rpt it says things like 'duplicate weapon found c130j' and same thing for a couple other jets/mv22. And when I got in the gunner of my armored suv it kicked me from the game and here is the client side rpt- Error in expression <,true]; }; } else { player removeAction s_garage_dialog; s_garage_dialog = -1; }> Error position: <s_garage_dialog; s_garage_dialog = -1; }> Error Undefined variable in expression: s_garage_dialog File mpmissions\__CUR_MP.Chernarus\dayz_code\compile\fn_selfActions.sqf, line 936 String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found "Trader Menu: Purchased 1x ArmoredSUV_PMC into gear at Unknown Trader for 60,000 Coins" No owner No owner String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found String STR_FAL_Street_Sign not found Cannot create non-ai vehicle c_grasstall, Can anyone tell me if this is set up wrong? I'm using Hooty's post. // Planes if (_object isKindOf "C130J") then { _object addWeapon "1350Rnd_30mmAP_A10"; _object addWeapon "2Rnd_GBU12"; _object addMagazine "B_30mmA10_AP"; _object addMagazine "Bo_GBU12_LGB"; }; if (_object isKindOf "A10") then { _object addWeapon "8Rnd_Hellfire"; _object addMagazine "M_Hellfire_AT"; _object addMagazine "M_Hellfire_AT"; _object addMagazine "B_30mmA10_AP"; _object addMagazine "M_Maverick_AT"; }; if (_object isKindOf "A10_US_EP1") then { _object addMagazine "B_30mmA10_AP"; _object addMagazine "M_Maverick_AT"; }; if (_object isKindOf "AV8B") then { _object addMagazine "6Rnd_GBU12_AV8B"; }; if (_object isKindOf "Su25_TK_EP1") then { _object removeweapon "4Rnd_FAB_250"; }; if (_object isKindOf "Su25_CDF") then { _object addMagazine "Bo_FAB_250"; _object addMagazine "B_30mm_HE"; _object addMagazine "R_80mm_HE"; }; if (_object isKindOf "MV22") then { _object addWeapon "750Rnd_30mm_GSh301"; _object addWeapon "4Rnd_Sidewinder_AV8B"; _object addWeapon "38Rnd_FFAR"; _object addMagazine "R_Hydra_HE"; _object addMagazine "B_30mm_HE"; _object addMagazine "M_Sidewinder_AA"; }; if (_object isKindOf "GNT_C185U") then { _object addWeapon "750Rnd_30mm_GSh301"; _object addWeapon "38Rnd_FFAR"; _object addMagazine "R_Hydra_HE"; _object addMagazine "B_30mm_HE"; }; if (_object isKindOf "An2_2_TK_CIV_EP1") then { _object addWeapon "PG9_AT"; _object addWeapon "4000Rnd_762x51_M134"; _object addMagazine "B_762x51_3RndBurst"; _object addMagazine "R_PG9_AT"; }; // Ground Trucks if (_object isKindOf "ArmoredSUV_PMC") then { _object addWeapon "1470Rnd_127x108_YakB"; _object addMagazine "B_127x108_APHE"; }; if (_object isKindOf "HMMWV_M1151_M2_DES_EP1") then { _object addWeapon "PG9_AT"; _object addMagazine "R_PG9_AT"; }; // Helicopters if (_object isKindOf "CH_47F_BAF") then { _object addWeapon "2Rnd_GBU12"; _object addWeapon "250Rnd_127x99_M3P"; _object addWeapon "48Rnd_40mm_MK19"; _object addMagazine "Bo_GBU12_LGB"; _object addMagazine "G_40mm_HE"; _object addMagazine "B_127x99_Ball"; }; if (_object isKindOf "Ka52Black") then { _object addWeapon "128Rnd_57mm"; _object addMagazine "R_57mm_HE"; }; if (_object isKindOf "Ka60_GL_PMC") then { _object addWeapon "48Rnd_40mm_MK19"; _object addMagazine "G_40mm_HE"; }; if (_object isKindOf "UH60M_EP1") then { _object addWeapon "PG9_AT"; _object addWeapon "2Rnd_Sidewinder_AH1Z"; _object addWeapon "250Rnd_127x99_M3P"; _object addMagazine "R_PG9_AT"; _object addMagazine "G_40mm_HE"; _object addMagazine "B_127x99_Ball"; }; if (_object isKindOf "UH1H_TK_EP1") then { _object addWeapon "180Rnd_30mm_GSh301"; _object addMagazine "B_30mm_HE"; }; if (_object isKindOf "pook_H13_gunship") then { _object addWeapon "2000Rnd_762x51_M134"; _object addMagazine "B_762x51_3RndBurst"; }; if (_object isKindOf "BAF_Merlin_HC3_D") then { _object addWeapon "750Rnd_30mm_GSh301"; _object addWeapon "4Rnd_Sidewinder_AV8B"; _object addWeapon "38Rnd_FFAR"; _object addMagazine "B_30mm_HE"; _object addMagazine "M_Sidewinder_AA"; _object addMagazine "R_Hydra_HE"; }; //Tanks if (_object isKindOf "BAF_FV510_W") then { _object addWeapon "750Rnd_30mm_GSh301"; _object addMagazine "B_30mm_HE"; }; if (_object isKindOf "M1A2_TUSK_MG") then { _object addWeapon "2000Rnd_762x51_M134"; _object addWeapon "1470Rnd_127x108_YakB"; _object addWeapon "48Rnd_40mm_MK19"; _object addWeapon "250Rnd_127x99_M3P"; _object addWeapon "2Rnd_Sidewinder_AH1Z"; _object addMagazine "B_762x51_3RndBurst"; _object addMagazine "B_127x99_Ball"; _object addMagazine "M_Sidewinder_AA"; _object addMagazine "B_127x108_APHE"; _object addMagazine "G_40mm_HE"; }; if (_object isKindOf "M2A3_EP1") then { _object addWeapon "2Rnd_Sidewinder_AH1Z"; _object addMagazine "M_Sidewinder_AA"; }; if (_object isKindOf "T90") then { _object addWeapon "4000Rnd_762x51_M134"; _object addMagazine "B_762x51_3RndBurst"; }; if (_object isKindOf "ZSU_CDF") then { _object addWeapon "1904Rnd_30mmAA_2A38M"; _object addWeapon "8Rnd_9M311"; _object addMagazine "B_30mm_HE"; _object addMagazine "M_9M311_AA"; }; Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 17, 2017 Report Share Posted August 17, 2017 Nevermind stupid mistake by me, I mixed up the classnames and magazine names when i was looking at the A2 weapons link. Link to comment Share on other sites More sharing options...
nova Posted August 18, 2017 Report Share Posted August 18, 2017 On 20/04/2017 at 10:05 PM, Hooty said: This is what i do for weapons on vehicles make a file called VehicleAmmo.sqf in your system, compile, and "garage folder if you have one" all server side. What this does is make vehicles spawn with the weapons soon as you buy and withdraw from garage. Does not work with admin spawn in vehicles. VehicleAmmo.sqf example: Reveal hidden contents if (_object isKindOf "AN2_DZ") then { _object addWeapon "YakB"; _object addMagazine "1470Rnd_127x108_YakB"; }; add more vehicles and weapons as you like. Next place #include "VehicleAmmo.sqf"; in dayz_server\system\sever_monitor.sqf under Reveal hidden contents if (_object isKindOf "AllVehicles") then { _object setVariable ["CharacterID", _ownerID, true]; _isAir = _object isKindOf "Air"; { _selection = _x select 0; _dam = if (!_isAir && {_selection in dayZ_explosiveParts}) then {(_x select 1) min 0.8;} else {_x select 1;}; _strH = "hit_" + (_selection); _object setHit[_selection,_dam]; _object setVariable [_strH,_dam,true]; } foreach _hitpoints; [_object,"damage"] call server_updateObject; _object setFuel _fuel; Then paste #include "VehicleAmmo.sqf"; in dayz_server\compile\server_publishVehicle2.sqf under Reveal hidden contents clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; Next place #include "VehicleAmmo.sqf"; in dayz_server\compile\spawn_vehicles.sqf under Reveal hidden contents clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; Thanks to @BigEgg. If you have Virtual Garage add #include "VehicleAmmo.sqf"; to dayz_server\compile\garage\server_spawnVehicles.sqf under Reveal hidden contents clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; I use https://community.bistudio.com/wiki/ArmA_2:_Weapons to get weapon id. @Hooty How do you add the customized vehicles into a trader? And also have the regular vehicles in the trader aswell? Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 18, 2017 Report Share Posted August 18, 2017 29 minutes ago, nova said: @Hooty How do you add the customized vehicles into a trader? And also have the regular vehicles in the trader aswell? Its done by class name. So for example lets say you follow the script and make the MV22_DZ have hydras, When you go to a trader and purchase that vehicle it will come with whatever you armed it with. nova 1 Link to comment Share on other sites More sharing options...
nova Posted August 19, 2017 Report Share Posted August 19, 2017 @Blestda86ta thank you! Link to comment Share on other sites More sharing options...
nova Posted August 19, 2017 Report Share Posted August 19, 2017 @Blestda86ta do you happen to know a way to add radar to vehicles that dont have radar using this script? or any other means? Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 19, 2017 Report Share Posted August 19, 2017 5 minutes ago, nova said: @Blestda86ta do you happen to know a way to add radar to vehicles that dont have radar using this script? or any other means? I'm not sure of a script for it, but an easy way I know > The _DZ versions of vehicles don't have radar by default. Example: MV22_DZ doesn't have radar, but the non _DZ vehicles DO have radar. Example: classname: MV22 WILL have radar. Another example: 'C130J_DZ' will NOT have radar, but 'C130J' Will have radar. Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 25, 2017 Report Share Posted August 25, 2017 Some of the vehicles that I buy come with the weapon/ammo but it wont reload for some time- EX: shilka with tuguska rockets. It just has red text (meaning out of ammo/reloading) and the 8 rockets. Is there a way to make it come loaded right away? Link to comment Share on other sites More sharing options...
Hooty Posted August 26, 2017 Report Share Posted August 26, 2017 9 hours ago, Blestda86ta said: Some of the vehicles that I buy come with the weapon/ammo but it wont reload for some time- EX: shilka with tuguska rockets. It just has red text (meaning out of ammo/reloading) and the 8 rockets. Is there a way to make it come loaded right away? Yes there is Link to comment Share on other sites More sharing options...
Blestda86ta Posted August 26, 2017 Report Share Posted August 26, 2017 1 minute ago, Hooty said: Yes there is I'm willing to guess the vehicleammo.sqf needs to be added in somewhere in the dayz_server pbo? Link to comment Share on other sites More sharing options...
Hooty Posted August 26, 2017 Report Share Posted August 26, 2017 My guide tells you where to place the files. come to my ts ill tell you what you need to do. Link to comment Share on other sites More sharing options...
Zoranth Posted August 26, 2017 Report Share Posted August 26, 2017 Nevermind Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now