OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: ModestNovice on 21 Oct 2008, 02:19:48

Title: Need help with light script
Post by: ModestNovice on 21 Oct 2008, 02:19:48
I am having problems getting my lights to flash on my cop car.

They work fine if the car is sitting still, but once it starts to move, it still create correctly, but goes the 'light' goes behind the car after it creates  >:(

Any ideas how to fix this?

I tried to use particle effects but couldnt get it to create the same way/look. Maybe someone who knows alot more about particles could shed some light?


================================================

Code: [Select]
_car = _this select 0;
_blue = [0,0.313725,0.705882,1];
_red = [0.77,0.05,0.23,1];
_perm = 999999;



_duration = 0.2;


if (DCV_Lights) then
{
DCV_Lights = false;
}
else
{
DCV_Lights = true;

while {DCV_Lights} do
{
_pos01 = _car modelToWorld [-0.6,-0.1,1.7];
_pos02 = _car modelToWorld [+0.6,-0.1,1.7];
_pos03 = _car modelToWorld [+0.2,+0.3,1.7];
_pos04 = _car modelToWorld [+0.4,+0.1,1.7];
_pos05 = _car modelToWorld [-0.2,+0.3,1.7];
_pos06 = _car modelToWorld [-0.4,+0.1,1.7];
_pos07 = _car modelToWorld [0,+0.3,1.7];


drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos01,[0,0,0],0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos02,[0,0,0],0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
Sleep 0.3;
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos03,[0,0,0],0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos04,[0,0,0],0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
Sleep 0.3;
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos07,[0,0,0],0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
Sleep 0.3;
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos05,[0,0,0],0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos06,[0,0,0],0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
Sleep 0.3;
};
};
   
      
      

   
   
Title: Re: Need help with light script
Post by: Luke on 21 Oct 2008, 02:45:43
You need to update the pos in the script.

you could also set the velocities of the lights to that of the car.

So try:

Code: [Select]
_car = _this select 0;
_blue = [0,0.313725,0.705882,1];
_red = [0.77,0.05,0.23,1];
_perm = 999999;



_duration = 0.2;


if (DCV_Lights) then
{
DCV_Lights = false;
}
else
{
DCV_Lights = true;

while {DCV_Lights} do
{
_pos01 = _car modelToWorld [-0.6,-0.1,1.7];
_pos02 = _car modelToWorld [+0.6,-0.1,1.7];

_vel = velocity _car;
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos01,_vel,0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos02,_vel,0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
Sleep 0.3;
_vel = velocity _car;
_pos03 = _car modelToWorld [+0.2,+0.3,1.7];
_pos04 = _car modelToWorld [+0.4,+0.1,1.7];

drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos03,_vel,0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos04,_vel,0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
Sleep 0.3;
_vel = velocity _car;
_pos07 = _car modelToWorld [0,+0.3,1.7];

drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos07,_vel,0,1.275,1,0,[1.5],[_blue],[0,0,0],0,0,"","",""];
Sleep 0.3;
_vel = velocity _car;
_pos05 = _car modelToWorld [-0.2,+0.3,1.7];
_pos06 = _car modelToWorld [-0.4,+0.1,1.7];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos05,_vel,0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
drop["\ca\data\kouleSvetlo","","Billboard",1,_duration,_pos06,_vel,0,1.275,1,0,[1.5],[_red],[0,0,0],0,0,"","",""];
Sleep 0.3;
};
};
   

Luke
Title: Re: Need help with light script
Post by: ModestNovice on 21 Oct 2008, 03:03:23
Ohhhhh mmyyy GODDD!!!!!!!!!!!!!!!!!!!!111111


THANK YOU Luke.

Your awesome m8, REALLY appreciate it  :clap: :clap: :clap:  :)
Title: Re: Need help with light script
Post by: Luke on 21 Oct 2008, 05:22:16
No problem, all that I changed was the update pattern.

Your script before would update the position only every one-point-two seconds.

Now it updates the positions every flash (point-three seconds).

And adding the velocity allows the particle to travel with the same speed as the car, for its short lifetime.

Once again, glad to help.

Luke
Title: Re: Need help with light script
Post by: ModestNovice on 21 Oct 2008, 06:11:43
righto, I will keep that in mind.

Once again, thank you very much.  :)