Jump to content
Sign in to follow this  
chaseh27

Setting Color of Offroad?

Recommended Posts

Me and Soolie are attempting to creating a better version of his original script like you saw in the video.

Share this post


Link to post
Share on other sites
Me and Soolie are attempting to creating a better version of his original script like you saw in the video.

do you think you could make it have a hard top? or would that involve customly making it?.

Share this post


Link to post
Share on other sites

This was posted for the cop lights in a other thread.

_vehicle = _this select 0; 
_lightRed = [5, 0.5, 0.5];
_lightBlue = [0.5, 0.5, 5];

lightleft = "#lightpoint" createVehicle getpos _vehicle;  
lightleft setLightColor _lightRed;
lightleft setLightBrightness 0.4; 
lightleft setLightAmbient _lightRed;
lightleft lightAttachObject [_vehicle, [-3, 0.8, 0]]; 
lightleft setLightAttenuation [3, 0, 0, 0.6];

lightright = "#lightpoint" createVehicle getpos _vehicle;  
lightright setLightColor _lightBlue;
lightright setLightBrightness 0.4; 
lightright setLightAmbient _lightBlue;
lightright lightAttachObject [_vehicle, [3, 0.8, 0]]; 
lightright setLightAttenuation [3, 0, 0, 0.6];

// playSound "AlarmCar";	
_leftRed = true; 
while{ (alive _vehicle)} do 
{ 
  if(_leftRed) then 
 { 
	_leftRed = false; 
	lightleft setLightColor _lightRed;
	lightleft setLightAmbient _lightRed;
	lightright setLightColor _lightBlue;
	lightright setLightAmbient _lightBlue;
	//playSound "AlarmCar";
 } 
 else 
 { 
	_leftRed = true; 
	lightleft setLightColor _lightBlue;
	lightleft setLightAmbient _lightBlue;
	lightright setLightColor _lightRed;
	lightright setLightAmbient _lightRed;
 }; 
  sleep 1; 
};

Only "issue" with it was that the lights aren't resembling cones.

Share this post


Link to post
Share on other sites

This was posted for the cop lights in a other thread.

(...)

Only "issue" with it was that the lights aren't resembling cones.

OMG, thats ugly.

I made a few changes, thats make it more real-looklike

Blue Coplights BlingBling:

fnCJ_PoliceBlink = {
Private ["_vehicle","_lightRed","_lightBlue","_lightleft","_lightright","_leftRed"];
// _this select 0 : objVehicle
// _this select 1 : blingspeed
//[_carobj,0.25] spawn fnCJ_PoliceBlink;

   _vehicle = _this select 0;  
   _lightRed = [0.1, 0.1, 20]; 		//color left
   _lightBlue = [0.1, 0.1, 20]; 		//color right

   _lightleft = "#lightpoint" createVehicle getpos _vehicle;   
   sleep 0.2;
   _lightleft setLightColor _lightRed; 
   _lightleft setLightBrightness 0.2;  
   _lightleft setLightAmbient [0.1,0.1,1]; 
   _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.54]];  //exact position of leftlight
   //helperSphere1 attachTo [_vehicle, [-0.37, 0.0, 0.54]];	 //positiontest with 10cm helpersphere
   _lightleft setLightAttenuation [0.181, 0, 1000, 130]; 
   _lightleft setLightIntensity 10;
   _lightleft setLightFlareSize 0.38;
   _lightleft setLightFlareMaxDistance 150;
   _lightleft setLightUseFlare true;

   _lightright = "#lightpoint" createVehicle getpos _vehicle;   
   sleep 0.2;
   _lightright setLightColor _lightBlue; 
   _lightright setLightBrightness 0.2;  
   _lightright setLightAmbient [0.1,0.1,1]; 
   _lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.54]];  //exact position of rightlight
   //helperSphere1_1 attachTo [_vehicle, [0.37, 0.0, 0.54]]; //positiontest with 10cm helpersphere
   _lightright setLightAttenuation [0.181, 0, 1000, 130]; 
   _lightright setLightIntensity 10;
   _lightright setLightFlareSize 0.38;
   _lightright setLightFlareMaxDistance 150;
   _lightright setLightUseFlare true;

   _leftRed = true;  
   while{ (alive _vehicle)} do  
   {  
     if(_leftRed) then  
    {  
       _leftRed = false;  
_lightright setLightBrightness 0.0;  
sleep 0.05;
_lightleft setLightBrightness 2;  
    }  
    else  
    {  
       _leftRed = true;  
_lightleft setLightBrightness 0.0;  
sleep 0.05;
_lightright setLightBrightness 2;  
    };  
     sleep (_this select 1);  
   };  
   deleteVehicle _lightleft;
   deleteVehicle _lightright;
};

best viewed @ Night

Picture: //steamcommunity.com/sharedfiles/filedetails/?id=166301461

1024x544.resizedimage

happy fun,

C.Joke

Edited by CJoke
bettercode

Share this post


Link to post
Share on other sites

Cjoke, how would one go about Calling your script for a vehicle?

... or anyone else who might have an idea on how to do it :D?

Edited by Tand3rsson

Share this post


Link to post
Share on other sites

@ Tand3rsson: I don't know if I understand what you mean...

anyway here is the code to create a policar:

create a marker on Map called "CarPos"

_pos = getMarkerPos "CarPos";
_carobj = "C_Offroad_01_F" createVehicle (_pos);
_carobj setDir (markerDir "CarPos");
sleep 0.3;
_carobj animate ["HidePolice", 0]; 
_carobj animate ["HideServices", 1]; 
_carobj animate ["HideBackpacks", 1]; 
_carobj animate ["HideBumper1", 1]; 
_carobj animate ["HideBumper2", 0]; 
_carobj animate ["HideConstruction", 0]; 
_carobj animate ["HideDoor1", 0];  
_carobj animate ["HideDoor2", 0]; 
_carobj animate ["HideDoor3", 0]; 
_carobj animate ["HideGlass2", 0];		
_carobj setObjectTexture [0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE03_CO.paa"]; //Carcolor Blue

[_carobj,0.25] spawn fnCJ_PoliceBlink; //Make it Bling

Edited by CJoke

Share this post


Link to post
Share on other sites

Thank you, I have a finished car in editor which I want to make put on sirens after a while. So, I save your script as "fnCJ_PoliceBlink.sqf" in the mission folder, correct so far?

Then in the trigger I put [carName, 0.25] spawn fnCj_PolceBlink;

Would this work? Cause if I do it like you have above, the sirens will be on from the start.

Tested, did not get it to work

EDIT:

Ok, I solved it to work like I needed.

First I pasted the whole fnCj_policeBlink into my init.sqf.

Then i created a simple policelights.sqf:

_carobj = _this select 0;

[_carobj,0.25] spawn fnCJ_PoliceBlink;

So when I wanted it to switch on lights I have a trigger:

on act: null = [carName] execVm "policelights.sqf"

THANK YOU for your help man!

Edited by Tand3rsson
I aint all that bright

Share this post


Link to post
Share on other sites

cursorTarget animate ["HidePolice", 0];
cursorTarget animate ["HideServices", 1];
cursorTarget animate ["HideBackpacks", 1];
cursorTarget animate ["HideBumper1", 1];
cursorTarget animate ["HideBumper2", 1];
cursorTarget animate ["HideConstruction", 1];
[color="#FF0000"]cursorTarget animate ["BeaconsStart", 1];[/color]

Now you only need to broadcast the animation to your clients!

Share this post


Link to post
Share on other sites

Is it just the offroad that has these functions? There was a mention of a Hunter Riot Police in the files.

Share this post


Link to post
Share on other sites

Sorry guys I am new to editing and just couldn´t figure out where I need to put this PHP codes and scripts? In the init field of the offroad?

Share this post


Link to post
Share on other sites

Here's how to do the Police Offroad:

Init of the Offroad:

_police = this execVM "policeOffroad.sqf";

policeOffroad.sqf:

/*
File: policeOffroad.sqf
Author: Adapted from code by pettka

Description:
Sets proxies for the car to police, adds actions for sirens.

Parameter(s):
None

Returns:
Nothing
*/

if (isServer) then {
_this animate ["HidePolice", 0];
_this animate ["HideServices", 1];
_this animate ["HideBackpacks", 1];
_this animate ["HideBumper1", 1];
_this animate ["HideBumper2", 0];
_this animate ["HideConstruction", 0];
};

_this setObjectTexture [0, "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE02_CO.paa"];

_this setObjectTexture [1, "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE02_CO.paa"];

_this addAction ["Beacons On",{(_this select 0) animate ["BeaconsStart",1]},[],50,false,true,"","_target animationPhase 'BeaconsStart' < 0.5 AND Alive(_target) AND driver _target == _this"];
_this addAction ["Beacons Off",{(_this select 0) animate ["BeaconsStart",0]},[],51,false,true,"","_target animationPhase 'BeaconsStart' > 0.5 AND Alive(_target) AND driver _target == _this"];

Share this post


Link to post
Share on other sites

Never mind I'm an idiot.

Nice job on finding this :)

---------- Post added at 11:34 PM ---------- Previous post was at 09:59 PM ----------

Kylania how would you add a say3d action to that (providing everything is set up in description etc. Been scratching my head to no avail.

---------- Post added at 11:49 PM ---------- Previous post was at 11:34 PM ----------

I can add the action ok.

this addAction ["Siren", "siren.sqf", "", 0, false, false, "", "_this in _target"];

siren.sqf isnt working.

_police say3d "siren";

Share this post


Link to post
Share on other sites

Is there a way to get the black offroad with police lights, backpacks and stuff on the model + the .50 BMG on it?

Share this post


Link to post
Share on other sites

I tried to set a color for my car but it didnt work. i put this into the init field of an empty offroad:

this setObjectTexture ["\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa" ]

Share this post


Link to post
Share on other sites

You missed a 0. :)

this setObjectTexture [[color="#FF0000"]0,[/color] "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa"][color="#FF0000"];[/color]

Share this post


Link to post
Share on other sites

Furthermore, at least before, they didn't work directly from the object init, since Bohemia's randomisation script runs right after that. Larrow posted a simple workaround using spawn earlier in this thread: http://forums.bistudio.com/showthread.php?156120-Setting-Color-of-Offroad&p=2408318&viewfull=1#post2408318

I guess a script executes late enough as well, since people have been using them without problems?

Share this post


Link to post
Share on other sites

Thanks for replying guys but--

I don´t get it. I tried it with these codes but it didn´t work. It spawned in another color and changed with every respawn :D What I need is a car that stays the same color, no matter what it is, no matter how often a mission is restarted.

All the vehicle textures changed with the last classname changes
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_co.paa",        //red
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_BASE01_CO.paa",  //yellow
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_BASE02_CO.paa",  //white
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_BASE03_CO.paa",  //blue
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_BASE04_CO.paa",  //darkred
"\A3\soft_F\Offroad[color="#FF0000"]_01[/color]\Data\Offroad[color="#FF0000"]_01[/color]_ext_BASE05_CO.paa"   //darkblue

Share this post


Link to post
Share on other sites

As Magirot said in his link, you need to set the color after the vehicle spawns to override the random settings.

_null = this spawn {_this setObjectTexture [0, "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa"]};

Share this post


Link to post
Share on other sites

what If I want to change the color of the civilian truck to red ? :)

Share this post


Link to post
Share on other sites
what If I want to change the color of the civilian truck to red ? :)

_truck setObjectTexture [0, "\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE04_CO.paa"];

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  

×