engima 324 Posted November 20, 2019 Engima's Parked Vehicles v1.0 Overview Engima's Parked Vehicles is a script that adds empty vehicles in garages and next to buildings across the map in an Arma 3 mission. Description To "complete" my Engima's Traffic script I have also created a general script to place empty vehicles near or in Buildings across a map. Vehicles are created when a player gets within spawn distance, and they are removed again (and remembered), when all players get beyond spawn radius. You can customize types of buildings and types of vehicles, spawn radius, and use callbacks for when vehicles spawn and despawn. For a vehicle to spawn in or outside a building there has to be a garage definition entry for that building in the file Engima\ParkedVehicles\GarageDefinitions.sqf. Garages and other buildings for islands Stratis, Altis, Malden and Tanoa are supported out of the box. Anyone can add more garage definitions when needed. Download Using the TypeSqf Editor (recommended for Windows users) From Github Installation TypeSqf: Open the CPack Console and type "install Engima.ParkedVehicles". Manual: Copy the folder Engima and the file initserver.sqf to the root of your mission. (If you already have the initserver.sqf file in your mission, copy the content from my file into yours). Usage Configure/Customize the script by altering the parameter list for the main function call. File "Engima\ParkedVehicles\ConfigAndStart": // Set custom parameters here private _parameters = [ ["BUILDING_TYPES", ["Land_FuelStation_02_workshop_F","Land_GarageShelter_01_F", "Land_FuelStation_01_shop_F", ...]], ["VEHICLE_CLASSES", ["C_Offroad_01_F", "C_Offroad_01_repair_F", "C_Quadbike_01_F]], ["SPAWN_RADIUS", 750], ["PROBABILITY_OF_PRESENCE", 1], ["ON_VEHICLE_CREATED", {}], ["ON_VEHICLE_REMOVING", {}], ["DEBUG", false] ]; // Run script _parameters call PARKEDVEHICLES_PlaceVehiclesOnMap; Script can also be extended to contain support for more garages/buildings. This may be important if you want to use the script on maps for which the default package was not intended. In that case you want to add building definitions to the file "Engima\ParkedVehicles\GarageDefinitions". Vehicles for building classes that do not exist as a building definition will not be spawned. Licence MIT. Version History Version 1.0 -First version. Other releases Engima's Traffic (script) Engima's Civilians (script) Escape Tanoa (mission) 6 3 Share this post Link to post Share on other sites
fawlty 25 Posted November 20, 2019 Engima, is there a guide for installing this mod to use in missions? I had a quick look but couldnt find it and it didnt work by adding the Engima folder and initserver.sqf file. I got a lot of use out of the traffic mod use it all the time.👍 1 Share this post Link to post Share on other sites
engima 324 Posted November 21, 2019 10 hours ago, fawlty said: Engima, is there a guide for installing this mod to use in missions? I had a quick look but couldnt find it and it didnt work by adding the Engima folder and initserver.sqf file. I got a lot of use out of the traffic mod use it all the time.👍 Forgot it. Now added under Installation. Thanks! 1 1 Share this post Link to post Share on other sites
LSValmont 766 Posted November 21, 2019 Masterfully scripted as always dear @Enigma. I would add to the description that the script is smart enough to delete parked vehicles when players are no longer near. Can't wait for the updated patrol script now that the new trigger params are in place since version 1.97. 1 Share this post Link to post Share on other sites
anfo 117 Posted November 23, 2019 Hi, was just wondering would this include car parks? Share this post Link to post Share on other sites
engima 324 Posted November 23, 2019 1 hour ago, anfo said: Hi, was just wondering would this include car parks? No. The idea behind this script is to define a parking spot in relation to a building. But if anyone can tell me how to recognize car parks and their bays then I might support them in a new version. Share this post Link to post Share on other sites
accuracythruvolume 539 Posted November 28, 2019 As soon as I add any other building classnames I get: 21:28:32 File C:\Users\*****\Engima\ParkedVehicles\Code\Functions.sqf..., line 137 21:28:32 Error in expression <_buildingPosIndex = _buildingDefinition select 1; private _offsetPosition = _bui> 21:28:32 Error position: <select 1; private _offsetPosition = _bui> 21:28:32 Error Zero divisor I tried adding some CUP middle eastern buildings: "Land_i_Stone_HouseSmall_V2_F", "Land_House_C_10_EP1", "Land_House_C_10_dam_EP1", "Land_House_C_4_dam_EP1", "Land_House_C_4_EP1", "Land_House_C_9_EP1", "Land_House_C_9_dam_EP1", "Land_House_C_3_EP1", "Land_House_C_3_dam_EP1", "Land_House_C_2_EP1", "Land_House_C_2_DAM_EP1", "Land_House_C_1_EP1", "Land_House_C_1_dam_EP1", "Land_House_C_1_v2_EP1", "Land_House_C_1_v2_dam_EP1" Share this post Link to post Share on other sites
engima 324 Posted November 28, 2019 Is it a building that has building positions? Otherwise the building pos attribute must be sent in as -1. Or there is something wrong with your definition item in GarageDefinitions.sqf. Check the file and make sure you follow the pattern. Post the line here if you still do not find the problem. A garage definition defines how the vehicle will be placed in relation to a building. It is an array with building type, building pos reference and position and direction of vehicle in relation to the building. (Only the building type will not be enough, you must investigate each one.) Share this post Link to post Share on other sites
accuracythruvolume 539 Posted November 29, 2019 Ahhh that was 100% it. I was just adding building classnames to configandstart and didn't add anything to garagedefinitions. Operator error Is finding the optimal position a trial and error thing or could something like attachto finder help? Might only work with vehicles... not buildings.... http://www.armaholic.com/page.php?id=32675 Share this post Link to post Share on other sites
engima 324 Posted November 29, 2019 14 hours ago, accuracythruvolume said: Ahhh that was 100% it. I was just adding building classnames to configandstart and didn't add anything to garagedefinitions. Operator error Is finding the optimal position a trial and error thing or could something like attachto finder help? Might only work with vehicles... not buildings.... http://www.armaholic.com/page.php?id=32675 Thanks for notifying me about the script error! Here, use the script below - (I'll also include it in future versions of the package). Example of usage: Put in a vehicle near a building and name it myVehicle. Create a radio trigger and put the following line in it: [nearestBuilding myVehivle, myVehicle] spawn PARKEDVEHICLES_MonitorGarageDefinition; Script will output the garage definition (as a hint and in RTF), and you can drive around with the vehicle until your satisfied with the positioning. The last parked vehicle entry in the RTF will be the garage definition you need. Script: Spoiler // Monitors the garage definition for a building and writes the values on screen and in the Arma RTF. // _building (Object): The building for which to find the garage definition. // _vehicle (Object): The vehicle used when finding the garage definition. PARKEDVEHICLES_MonitorGarageDefinition = { params ["_building", "_vehicle"]; private ["_definition", "_fullDefinition", "_strOldDefinition", "_buildingType", "_buildingPos", "_buildingOffsetPos", "_vehicleDir", "_buildingDir"]; _buildingType = typeOf _building; _buildingPos = -1; _strOldDefinition = ""; _buildingDir = getDir _building; while { true } do { _buildingOffsetPos = [0, 0, 0] getPos [(getPos _building) distance2D (getPos _vehicle), (getPos _building) getDir (getPos _vehicle)]; for "_i" from 0 to 1 do { private _x = _buildingOffsetPos select _i; if (abs _x < 0.1) then { _x = 0; }; _buildingOffsetPos set [_i, round (_x * 100) / 100]; }; _buildingOffsetPos set [2, 0.01]; _vehicleDir = round ((getDir _vehicle) - _buildingDir); if (_vehicleDir >= 360) then { _vehicleDir = _vehicleDir - 360; }; if (_vehicleDir < 0) then { _vehicleDir = _vehicleDir + 360; }; _definition = [_buildingOffsetPos, _vehicleDir]; _fullDefinition = [_buildingType, _buildingPos, _buildingOffsetPos, _vehicleDir]; if (str _definition != _strOldDefinition) then { hint str _definition; diag_log ("PARKEDVEHICLES: Definition: " + str _fullDefinition); _strOldDefinition = str _definition; }; sleep 0.1; }; }; Share this post Link to post Share on other sites
accuracythruvolume 539 Posted December 12, 2019 I tried adding your function to GarageDefinitions.sqf and get this: 21:36:31 Error Invalid number in expression 21:36:31 File C:\Users\AccuracyThruVolume\Documents\Arma 3\missions\16th_Kujari_PMC_Ops.tem_kujari\Engima\ParkedVehicles\GarageDefinitions.sqf..., line 73 21:36:31 Error in expression <Pos set [_i, round (_x * 100) / 100]; }; _buildingOffsetPos set [2, 0.01]; > 21:36:31 Error position: < _buildingOffsetPos set [2, 0.01]; Share this post Link to post Share on other sites
engima 324 Posted December 12, 2019 The GarageDefinitions.sqf file contains a list of garage definition items (arrays with values). You should not add the function, you should use the function to create new garage definitions, and then add them to the list. 1. Create a temp mission. Decide a building that you want to use and put a vehicle near it. 2. Start the script in init (or in a trigger), send in the building and the vehicle as parameters, and park the vehicle as you want it. 3. Quit temp mission and open the RTF log file. Last garage definition entry is the last position of your vehicle. Add that definition to GarageDefinitions.sqf. Share this post Link to post Share on other sites
accuracythruvolume 539 Posted December 13, 2019 Ahh I see. I was thinking it could just be a defined function to call remotely, not code to place into the init. Makes sense Share this post Link to post Share on other sites