Jump to content
Sign in to follow this  
somebloke

Lights/Sirens a puzzler

Recommended Posts

So, I'm trying to get a script and config working which will light up a police lightbar. But also gives me an option to turn a siren on.

Right now, the lightbar works fine, other than it is clientside not global, so other people cannot see it on a server. Although weirdly, the user-actions are global, as you can turn the lights on, get out, and someone else can get in and turn them off.

I know very little about scripting or configs, which is why I've come here to get help.

Config.cpp

#define private 0

#define protected 1

#define public 2

#define true 1

#define false 0

#define LockNo 0

#define LockCadet 1

#define LockYes 2

#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7

#define VSoft 0

#define VArmor 1

#define VAir 2

class CfgPatches {

class mad_veh {

units[] = {"mad_landroverpol"};

weapons[] = {};

requiredVersion = 1.0;

};

};

/*class CfgWeapons {

class Default; // External class reference

class CarHorn; // External class reference

class SportCarHorn; // External class reference

class mad_landroverpol_horn1 : SportCarHorn {

scope = public;

displayName = "Horn";

drySound[] = {"\mad_landroverpol\Sounds\mad_landroverpol_horn1.wav", 0.1, 1};

};

class mad_landroverpol_horn2 : SportCarHorn {

scope = public;

displayName = "Whelen Airhorn";

drySound[] = {"\mad_landroverpol\Sounds\mad_landroverpol_horn2.wav", 0.1, 1};

};

class mad_landroverpol_horn3 : SportCarHorn {

scope = public;

displayName = "Howler";

drySound[] = {"\mad_landroverpol\Sounds\Howler.wav", 0.1, 1};

};

};

*/

class CfgVehicleClasses {

class Mad_Vehicles {

displayName = "MadLife Vehicles";

};

};

class CfgVehicles {

class All {};

class AllVehicles : All {};

class Land : AllVehicles {};

class LandVehicle : Land {};

class Car : LandVehicle {

class Exhausts; // External class reference

class AnimationSources; // External class reference

};

class car_sedan : Car {};

class Mad_car : Car_sedan {

soundGear[] = {"", 5.6e-005, 1};

soundGetIn[] = {"ca\SOUNDS\Vehicles\Wheeled\HMMWV\ext\get_in2", db-5, 1};

soundGetOut[] = {"ca\SOUNDS\Vehicles\Wheeled\HMMWV\int\get_in2", db-5, 1, 20};

soundEngineOnInt[] = {"\mad_landroverpol\sound\Int_engine_startup", 0.398107, 1.0};

soundEngineOnExt[] = {"\mad_landroverpol\sound\V8_engine_startup", 0.398107, 1.0};

soundEngineOffInt[] = {"\mad_landroverpol\sound\V8_engine_stop", 0.398107, 1.0};

soundEngineOffExt[] = {"\mad_landroverpol\sound\v8_engine_stop", 0.398107, 1.0};

buildCrash0[] = {"Ca\sounds\Vehicles\Crash\crash_building_01", 0.707946, 1, 200};

buildCrash1[] = {"Ca\sounds\Vehicles\Crash\crash_building_02", 0.707946, 1, 200};

buildCrash2[] = {"Ca\sounds\Vehicles\Crash\crash_building_03", 0.707946, 1, 200};

buildCrash3[] = {"Ca\sounds\Vehicles\Crash\crash_building_04", 0.707946, 1, 200};

soundBuildingCrash[] = {"buildCrash0", 0.25, "buildCrash1", 0.25, "buildCrash2", 0.25, "buildCrash3", 0.25};

WoodCrash0[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_01", 0.707946, 1, 200};

WoodCrash1[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_02", 0.707946, 1, 200};

WoodCrash2[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_03", 0.707946, 1, 200};

WoodCrash3[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_04", 0.707946, 1, 200};

WoodCrash4[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_05", 0.707946, 1, 200};

WoodCrash5[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_06", 0.707946, 1, 200};

soundWoodCrash[] = {"woodCrash0", 0.166, "woodCrash1", 0.166, "woodCrash2", 0.166, "woodCrash3", 0.166, "woodCrash4", 0.166, "woodCrash5", 0.166};

ArmorCrash0[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_01", 0.707946, 1, 200};

ArmorCrash1[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_02", 0.707946, 1, 200};

ArmorCrash2[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_03", 0.707946, 1, 200};

ArmorCrash3[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_04", 0.707946, 1, 200};

soundArmorCrash[] = {"ArmorCrash0", 0.25, "ArmorCrash1", 0.25, "ArmorCrash2", 0.25, "ArmorCrash3", 0.25};

class SoundEvents {

class AccelerationIn {

sound[] = {"\mad_landroverpol\sound\Int_engine_engine", db-8, 1.0};

limit = 0.5;

expression = "(engineOn*(1-camPos))*gmeterZ";

};

class AccelerationOut {

sound[] = {"\mad_landroverpol\sound\v8_engine_engine", db-8, 1.0};

limit = 0.5;

expression = "(engineOn*camPos)*gmeterZ";

};

};

class eventhandlers {

init = "";

};

class Sounds {

class Engine {

sound[] = {"\mad_landroverpol\sound\v8_engine_engine", db-8, 1.0};

frequency = "(randomizer*0.05+0.95)*rpm";

volume = "engineOn*camPos*(rpm factor[0.6, 0.2])";

};

class EngineHighOut {

sound[] = {"\mad_landroverpol\sound\v8_engine_high", db-8, 1.0};

frequency = "(randomizer*0.05+0.98)*rpm";

volume = "engineOn*camPos*(rpm factor[0.45, 0.9])";

};

class IdleOut {

sound[] = {"\mad_landroverpol\sound\v8_engine_idle", db-8, 1.0};

frequency = "1";

volume = "engineOn*camPos*(rpm factor[0.3, 0])";

};

class TiresRockOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-rock2", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*rock*(speed factor[2, 20])";

};

class TiresSandOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-sand2", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*sand*(speed factor[2, 20])";

};

class TiresGrassOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-grass3", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*grass*(speed factor[2, 20])";

};

class TiresMudOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-mud2", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*mud*(speed factor[2, 20])";

};

class TiresGravelOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-gravel2", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*gravel*(speed factor[2, 20])";

};

class TiresAsphaltOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-asphalt3", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*asphalt*(speed factor[2, 20])";

};

class NoiseOut {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Noises\ext\int-noise3", 0.1, 1.0, 30};

frequency = "1";

volume = "camPos*(damper0 max 0.04)*(speed factor[0, 8])";

};

class EngineLowIn {

sound[] = {"\mad_landroverpol\sound\v8_engine_low", db-8, 1.0};

frequency = "(randomizer*0.05+0.95)*rpm";

volume = "((engineOn*thrust) factor[0.65, 0.2])*(1-camPos)";

};

class EngineHighIn {

sound[] = {"\mad_landroverpol\sound\v8_engine_high", db-8, 1.0};

frequency = "(randomizer*0.05+0.95)*rpm";

volume = "((engineOn*thrust) factor[0.55, 0.95])*(1-camPos)";

};

class IdleIn {

sound[] = {"\mad_landroverpol\sound\v8_engine_idle", db-8, 1.0};

frequency = "1";

volume = "engineOn*(rpm factor[0.3, 0])*(1-camPos)";

};

class TiresRockIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-rock2", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*rock*(speed factor[2, 20])";

};

class TiresSandIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-sand2", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*sand*(speed factor[2, 20])";

};

class TiresGrassIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-grass3", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*grass*(speed factor[2, 20])";

};

class TiresMudIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-mud2", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*mud*(speed factor[2, 20])";

};

class TiresGravelIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-gravel2", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*gravel*(speed factor[2, 20])";

};

class TiresAsphaltIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-asphalt3", 0.1, 1.0};

frequency = "1";

volume = "(1-camPos)*asphalt*(speed factor[2, 20])";

};

class NoiseIn {

sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\BUS\int\noise3", 0.177828, 1.0};

frequency = "1";

volume = "(damper0 max 0.04)*(speed factor[0, 8])*(1-camPos)";

};

class Movement {

sound = "soundEnviron";

frequency = "1";

volume = "0";

};

};

class Exhausts {

class exhaust1 {

position = "exhaust1start";

direction = "exhaust1end";

effect = "ExhaustsEffect";

};

class exhaust2 : exhaust1 {

position = "exhaust2start";

direction = "exhaust2end";

};

};

class Reflectors {

class Left {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "l svetlo";

direction = "konec l svetla";

hitpoint = "l svetlo";

selection = "l svetlo";

size = 0.5;

brightness = 0.5;

};

class Right {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "p svetlo";

direction = "konec p svetla";

hitpoint = "p svetlo";

selection = "p svetlo";

size = 0.5;

brightness = 0.5;

};

class alight1 {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "Alight1a";

direction = "Alight1b";

hitpoint = "Alight1a";

selection = "Alight1a";

size = 0.5;

brightness = 0.5;

};

class alight2 {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "Alight2a";

direction = "Alight2b";

hitpoint = "Alight2a";

selection = "Alight2a";

size = 0.5;

brightness = 0.5;

};

class TDlight1 {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "TDlight1a";

direction = "TDlight1b";

hitpoint = "TDlight1a";

selection = "TDlight1a";

size = 0.5;

brightness = 0.5;

};

class TDlight2 {

color[] = {0.9, 0.8, 0.8, 1.0};

ambient[] = {0.1, 0.1, 0.1, 1.0};

position = "TDlight2a";

direction = "TDlight2b";

hitpoint = "TDlight2a";

selection = "TDlight2a";

size = 0.5;

brightness = 0.5;

};

};

class MarkerLights {

class taillightL {

name = "taillightL";

color[] = {1.0, 0.1, 0.1, 1};

ambient[] = {0.1, 0.01, 0.01, 1};

brightness = 0.004;

blinking = "false";

};

class taillightr {

name = "taillightr";

color[] = {1.0, 0.1, 0.1, 1};

ambient[] = {0.1, 0.01, 0.01, 1};

brightness = 0.004;

blinking = "false";

};

};

class HitEngine {

armor = 0.4;

material = 60;

name = "motor";

visual = "motor";

passThrough = true;

};

class HitBody {

armor = 1;

material = 51;

name = "karoserie";

visual = "karoserie";

passThrough = true;

};

class HitFuel {

armor = 0.4;

material = 51;

name = "palivo";

passThrough = true;

};

class HitLFWheel {

armor = 0.38;

material = -1;

name = "levy predni tlumic";

visual = "levy predni";

passThrough = false;

};

class HitRFWheel {

armor = 0.38;

material = -1;

name = "pravy predni tlumic";

visual = "pravy predni";

passThrough = false;

};

class HitLBWheel {

armor = 0.38;

material = -1;

name = "levy zadni tlumic";

visual = "levy zadni";

passThrough = false;

};

class HitRBWheel {

armor = 0.38;

material = -1;

name = "pravy zadni tlumic";

visual = "pravy zadni";

passThrough = false;

};

class AnimationSources : AnimationSources {

class door_rotate {

source = "user";

animPeriod = 3;

initPhase = 0;

};

class ZeroSecondAnim {

source = "user";

animPeriod = 1e-005;

initPhase = 0;

};

class OneSecondAnim {

source = "user";

animPeriod = 1;

initPhase = 0;

};

class FiveSecondAnim {

source = "user";

animPeriod = 5;

initPhase = 0;

};

};

hiddenSelections[] = {"paint"};

};

class mad_landroverpol : mad_car {

scope = public;

vehicleClass = "Mad_Vehicles";

displayName = "Landrover Police";

//icon = "\mad_landroverpol\icons\fordcv.pac";

model = "\mad_landroverpol\mad_landrover_patrol.p3d";

nameSound = "car";

accuracy = 0.9; // accuracy needed to recognize type of this target

canlock = LockCadet;

crew = "Civilian11";

side = TCivilian;

type = VArmor;

typicalCargo[] = {};

cargoIsCoDriver[] = {1, 0};

weapons[] = {"SportCarHorn"};

magazines[] = {};

unloadInCombat = false;

class TransportWeapons {};

transportSoldier = 3;

transportMaxMagazines = 30;

transportMaxWeapons = 8;

viewCargoShadow = true;

acceleration = 65;

maxSpeed = 209; // max speed on level road, km/h

turnCoef = 2.85;

terrainCoef = 1.65;

brakeDistance = 4.0; // vehicle movement precision

fuelCapacity = 40;

cost = 30000;

armor = 20;

armorEngine = 2.2;

selectionBackLights = "light_back";

selectionBrakeLights = "brzdove svetlo";

dammageHalf[] = {"\mad_landroverpol\windows1_ca.paa", "\mad_landroverpol\windowsB_ca.paa", "\mad_landroverpol\windows_ca.paa", "\mad_landroverpol\windowsB_ca.paa"};

dammageFull[] = {"\mad_landroverpol\windows1_ca.paa", "\mad_landroverpol\windowsC_ca.paa", "\mad_landroverpol\windows_ca.paa", "\mad_landroverpol\windowsC_ca.paa"};

hiddenSelections[] = {"paint"};

hiddenSelectionsTextures[] = {"led1","led2","led1_rear","led2_rear","BLANK",};

class Damage {

tex[] = {};

mat[] = {"mad_landroverpol\effects\bottom.rvmat", "mad_landroverpol\effects\bottom.rvmat", "mad_landroverpol\effects\bottom_destruct.rvmat", "mad_landroverpol\effects\body.rvmat", "mad_landroverpol\effects\body_mud.rvmat", "mad_landroverpol\effects\body_destruct.rvmat", "mad_landroverpol\effects\interior.rvmat", "mad_landroverpol\effects\interior.rvmat", "mad_landroverpol\effects\interior_destruct.rvmat", "mad_landroverpol\effects\dash.rvmat", "mad_landroverpol\effects\dash.rvmat", "mad_landroverpol\effects\dash_destruct.rvmat"};

};

};

class mad_lrd_police : mad_landroverpol

{

displayName = "Land Rover - Traffic";

model = "\mad_landroverpol\mad_landrover_traffic.p3d";

hiddenSelections[] = {"BLANK","strobe1","strobe2","led1","led2","strobe_rear1","strobe_rear2","led1_rear","led2_rear"};

hiddenSelectionsTextures[] = {"","","","","","","","",""};

class UserActions {

class StrobesOn {

displayName = "Strobe Lights - Turn On";

position = "";

radius = 2;

onlyForplayer = 0;

condition = "!(this getvariable [""rpp_strobeson"", false]) && (player == driver this)";

statement = "this setvariable [""rpp_strobeson"", true, true]; this execVm ""\mad_landroverpol\Scripts\lights.sqf"";";

};

class StrobesOff {

displayName = "Strobe Lights - Turn Off";

position = "";

radius = 2;

onlyForplayer = 0;

condition = "(this getvariable [""rpp_strobeson"", false]) && (player == driver this)";

statement = "this setVariable [""rpp_strobeson"", false, true]; ";

};

class SirenOn {

displayName = "Sirens on";

onlyforplayer = "true";

position = "";

radius = 5;

condition = "!(this getvariable [""rpp_sirenon"", false]) && (player == driver this)";

statement = "this setvariable [""rpp_sirenon"", true, true]; this execVm ""\mad_landroverpol\Scripts\siren.sqf"";";

};

class SirenOff {

displayName = "Siren off";

onlyforplayer = "true";

position = "";

radius = 5;

condition = "(this getvariable [""rpp_sirenon"", false]) && (player == driver this)";

statement = "this setVariable [""rpp_sirenon"", false, true]; ";

};

};

class eventhandlers {

init = "_this select 0 setVariable [""rpp_strobeson"", false, true]; hint format [""%1"", _this];_this select 0 setVariable [""rpp_sirenon"", false, true]; hint format [""%1"", _this];";

};

};

};

In game I have the options for Strobes on/off and Siren on/off.

Lightbar script

_veh = _this;

_ledoff = "";

_strobeon = "#(argb,8,8,3)color(0.270588,0.866667,0.894118,1.0,CO)";

_rearstrobeon = "#(argb,8,8,3)color(0.992157,0.541176,0.243137,1.0,co)";

_delay = 0.0425;

_lightBrightness = 0.11;

_light = "#lightpoint" createVehicle getpos _veh;

_light setLightBrightness _lightBrightness;

_light setLightAmbient[0, 0, 0.04];

_light setLightColor[0, 0.06, 1.0];

_light lightAttachObject [_veh, [0,0,0]];

while {_veh getVariable ["rpp_strobeson",false]} do

{

_light setLightBrightness _lightBrightness;

for [{_p = 0},{_p < 2},{_p = _p + 0.5}] do

{

_veh setObjectTexture [1,_strobeon];

_veh setObjectTexture [3,_strobeon];

_veh setObjectTexture [6,_rearstrobeon];

_veh setObjectTexture [7,_rearstrobeon];

_veh setObjectTexture [2,_ledoff];

_veh setObjectTexture [4,_ledoff];

sleep _delay;

_veh setObjectTexture [1,_ledoff];

_veh setObjectTexture [3,_ledoff];

_veh setObjectTexture [6,_ledoff];

sleep _delay;

};

_light setLightBrightness 0;

_veh setObjectTexture [7,_ledoff];

for [{_p = 0},{_p < 2},{_p = _p + 0.5}] do

{

_veh setObjectTexture [4,_strobeon];

_veh setObjectTexture [2,_strobeon];

_veh setObjectTexture [5,_rearstrobeon];

_veh setObjectTexture [8,_rearstrobeon];

_veh setObjectTexture [1,_ledoff];

_veh setObjectTexture [3,_ledoff];

sleep _delay;

_veh setObjectTexture [4,_ledoff];

_veh setObjectTexture [2,_ledoff];

_veh setObjectTexture [5,_ledoff];

sleep _delay;

};

_veh setObjectTexture [8,_ledoff];

};

_veh setObjectTexture [1,_ledoff];

_veh setObjectTexture [2,_ledoff];

_veh setObjectTexture [3,_ledoff];

_veh setObjectTexture [4,_ledoff];

_veh setObjectTexture [5,_ledoff];

_veh setObjectTexture [6,_ledoff];

_veh setObjectTexture [7,_ledoff];

_veh setObjectTexture [8,_ledoff];

deleteVehicle _light;

Siren script

_car = _this select 0;

for [{_i=0}, {_i < 1}, {_i=_i}] do

{

waitUntil {_car setVariable "rpp_strobeson" >= 0.5};

_car say "\mad_landroverpol\sound\siren.ogg";

Sleep 6.75;

};

Any help and pointers would be greatly appreciated.

Share this post


Link to post
Share on other sites

Did you add any addons like PBO files to your ArmA II. If so, that could be the problem. PBO files are apparently addons for ArmA II which you can see but others cannot see.

Its best to alert your friends what addon your using so they can download it and then enjoy the new FX mission or coop you made.

Share this post


Link to post
Share on other sites
Did you add any addons like PBO files to your ArmA II. If so, that could be the problem. PBO files are apparently addons for ArmA II which you can see but others cannot see.

Its best to alert your friends what addon your using so they can download it and then enjoy the new FX mission or coop you made.

I'm not sure you've understood the request for help.

It's a request to get a lightbar and siren working globally on an addon via scripts and the config, rather than a pbo file not being given to others.

Not to be a complete arse, but I'd think 9 years on this forum would've at least taught me that a pbo file is an addon, and that to play with others I need to send them the same addon.

Edit: That's not to say I don't appreciate your suggestion and offer of assistance, it's just a bit..."off" for the request's purpose.

Edited by somebloke

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×