Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Vehicle Service script v0.00000001 by nibbles.
- Shamelessly adapted from Jacmac GVS (http://www.armaholic.com/page.php?id=19735)
- and whatever Ahoyworld.co.uk does in their vehicle service triggers
- Features:
- -Generates triggers for LandVehicles, AirVehicles, Ships based on name of markers
- -Generates Event handlers for display of the trigger locations when a player is within a vehicle
- Notes:
- Trigger location display is:
- Null on foot
- 500 meters in LandVehicles and Ships
- 1K in AirVehicles
- Usage:
- Create markers and name them according to service_land_0 .._1, service_air_0 .._1, service_ship_0 .._1 etc.
- Make the markers as ELLIPSE or RECTANGLE. Icon will not work and is stupid. Size them appropriately.
- Run from init.sqf with "execVM vehicleservice.sqf"
- Issues:
- Icon for Ships will be in weird locations in certain cases.
- Probably much more.
- */
- // Only do this locally in Dedicated scenarios.
- if (isDedicated) exitWith {};
- VehicleService =
- {
- private ["_veh","_type"];
- _veh = param[0];
- _type = param[1];
- if (_veh isKindOf "ParachuteBase" || !alive _veh) exitWith {};
- if (!(_veh isKindOf _type)) exitWith { _veh vehicleChat "We dont serve your type here!"};
- _veh vehicleChat format["Servicing %1, please wait ...", _veh];
- _veh setFuel 0;
- //---------- RE-ARMING
- sleep 5;
- _veh vehicleChat "Re-arming ...";
- //---------- REPAIRING
- sleep 5;
- _veh vehicleChat "Repairing ...";
- //---------- REFUELING
- sleep 5;
- _veh vehicleChat "Refueling ...";
- //---------- FINISHED
- sleep 5;
- _veh setDamage 0;
- _veh vehicleChat "Repaired (100%).";
- _veh setVehicleAmmo 1;
- _veh vehicleChat "Re-armed (100%).";
- _veh setFuel 1;
- _veh vehicleChat "Refuelled (100%).";
- sleep 2;
- _veh vehicleChat "Service complete.";
- };
- _landprefix = "service_land_";
- _airprefix = "service_air_";
- _shipprefix = "service_ship_";
- _veh = 0;
- _air = 0;
- _ship = 0;
- {
- _marker = _x;
- _marPos = getMarkerPos _marker;
- _marDir = markerDir _marker;
- _marShape = markerShape _marker;
- _marSize = [0,0];
- _marIsRect = false;
- if (_marShape == "RECTANGLE" or _marShape == "ELLIPSE") then { _marSize = markerSize _marker };
- if (_marShape == "RECTANGLE") then { _marIsRect = true };
- // LandVehicle trigger setup
- if ( _x == format["%1%2", _landprefix, _veh]) then
- {
- // Creates the nice icon in 3D space
- call compile format ["addMissionEventHandler [""Draw3D"",
- {
- _pos = getMarkerPos ""%1"";
- _distp = player distance _pos;
- if (_distp < 500 and (vehicle player isKindOf ""LandVehicle"")) then
- {
- _scale = 0.0251 - (_distp / 20000);
- _pos set [2, 2 + (_distp * 0.05)];
- _alpha = _distp / 500;
- _texture = format [""#(rgb,1,1,1)color(0.5,0.5,0.5,%2)"", _alpha];
- _texture = ""\A3\ui_f\data\map\markers\nato\c_car.paa"";
- if (_distp < 250) then {
- _alpha = 1.001 - (_distp / 500);
- };
- _color = [0.85,0.65,0.13,_alpha];
- drawIcon3D [_texture, _color, _pos, 0.5, 0.5, 0, ""Ground Vehicle Service"", 1, _scale, ""TahomaB""];
- };
- }];", _marker, "%1"];
- _con = format ["({player == driver _x and _x isKindOf ""LandVehicle"" and (getposATL _x param[2]) < 1 and speed _x == 0} count thislist == 1)"];
- _act = format ["[(thisList param[0]),'LandVehicle'] spawn VehicleService"];
- _trg = createTrigger["EmptyDetector", _marPos,false];
- _trg setTriggerArea [_marSize param[0],_marSize param[1],_marDir,_marIsRect];
- _trg setTriggerActivation["ANY", "PRESENT", true];
- _trg setTriggerStatements[_con, _act, "player vehicleChat 'Trigger deactivated'"];
- _veh = _veh + 1;
- };
- // AirVehicle trigger setup
- if ( _x == format["%1%2", _airprefix, _air]) then
- {
- // Creates the nice icon in 3D space
- call compile format ["addMissionEventHandler [""Draw3D"", {
- _pos = getMarkerPos ""%1"";
- _distp = player distance _pos;
- if (_distp < 1000 and (vehicle player isKindOf ""Air"")) then {
- _scale = 0.0201 - (_distp / 50000);
- _pos set [2, 2 + (_distp * 0.05)];
- _alpha = _distp / 500;
- _texture = format [""#(rgb,1,1,1)color(0.5,0.5,0.5,%2)"", _alpha];
- _texture = ""\A3\ui_f\data\map\markers\nato\c_air.paa"";
- if (_distp < 500) then {
- _alpha = 1.001 - (_distp / 1000);
- };
- _color = [0.25,0.50,0.10,_alpha];
- drawIcon3D [_texture, _color, _pos, 0.5, 0.5, 0, ""Air Vehicle Service"", 1, _scale, ""TahomaB""];
- };
- }];", _marker, "%1"];
- _con = format ["({player == driver _x and _x isKindOf ""Air"" and (getposATL _x param[2]) < 1 and speed _x == 0} count thislist == 1)"];
- _act = format ["[(thisList param[0]),'Air'] spawn VehicleService"];
- _trg = createTrigger["EmptyDetector", _marPos,false];
- _trg setTriggerArea [_marSize param[0],_marSize param[1],_marDir,_marIsRect];
- _trg setTriggerActivation["ANY", "PRESENT", true];
- _trg setTriggerStatements[_con, _act, "player vehicleChat 'Trigger deactivated'"];
- _air = _air + 1;
- };
- // ShipVehicle trigger setup
- if ( _x == format["%1%2", _shipprefix, _ship]) then
- {
- // Creates the nice icon in 3D space
- call compile format ["addMissionEventHandler [""Draw3D"",
- {
- _pos = getMarkerPos ""%1"";
- _distp = player distance _pos;
- if (_distp < 500 and (vehicle player isKindOf ""Ship"")) then
- {
- _scale = 0.0251 - (_distp / 20000);
- _pos set [2, (getposASL player param[2]) + (_distp * 0.05)];
- _alpha = _distp / 500;
- _texture = format [""#(rgb,1,1,1)color(0.5,0.5,0.5,%2)"", _alpha];
- _texture = ""\A3\ui_f\data\map\markers\nato\c_ship.paa"";
- if (_distp < 250) then {
- _alpha = 1.001 - (_distp / 500);
- };
- _color = [0.85,0.65,0.13,_alpha];
- drawIcon3D [_texture, _color, _pos, 0.5, 0.5, 0, ""Sea Vehicle Service"", 1, _scale, ""TahomaB""];
- };
- }];", _marker, "%1"];
- _con = format ["({player == driver _x and _x isKindOf ""Ship"" and (getposASL _x param[2]) < 2 and (getposASL _x param[2]) > -2 and speed _x < 2 and speed _x > -2} count thislist == 1)"];
- _act = format ["[(thisList param[0]),'Ship'] spawn VehicleService"];
- _trg = createTrigger["EmptyDetector", _marPos,false];
- _trg setTriggerArea [_marSize param[0],_marSize param[1],_marDir,_marIsRect];
- _trg setTriggerActivation["ANY", "PRESENT", true];
- _trg setTriggerStatements[_con, _act, "player vehicleChat 'Trigger deactivated'"];
- _ship = _ship + 1;
- };
- } forEach allMapMarkers;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement