Home   Help Search Login Register  

Author Topic: Multiple lights per Object  (Read 2067 times)

0 Members and 2 Guests are viewing this topic.

Offline Pilot

  • Contributing Member
  • **
Multiple lights per Object
« on: 14 Sep 2005, 03:43:29 »
Ok, I have come across a problem with a small addon I'm working on.  I am trying to make an ILS appoach system for use with OFP airports.  Without going to much into details, ILS systems use both single flashing lights lined up in a row and groups of five steady burning lights in between the flashing lights.  I have the flashing lights working, but I can't get the group of 5 to work.  Am I just doing something wrong, or is only one light per object allowed in OFP?

Here is my config:
Code: [Select]
#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 true 1
#define false 0
#define private 0
#define protected 1
#define public 2

class CfgPatches
{
     class PILOT_AppLights
 Â Â Â {
              worlds[] = {};
            units[] = {PILOT_AppLight1, PILOT_AppLight2};
              requiredVersion = 1.85;
     };
};
class cfgModels
{
   class Default
       {
                sections[]={""};
                sectionsInherit="";
       };
     class All {};
         class Static: All {};
         class Building: Static {};
         class NonStrategic: Building  {};
   class PILOT_AppLight1: NonStrategic
     {
            sectionsInherit="";
     Â Â Â     sections[]={};
     };
   class PILOT_AppLight2: NonStrategic
     {
            sectionsInherit="";
     Â Â Â     sections[]={};
     };
};

class CfgVehicles
{
   Â Â Â class All{};
   Â Â Â class Static: All{};
   Â Â Â class Building: Static{};
   Â Â Â class NonStrategic: Building{};
   class Fire: NonStrategic {};
   class PILOT_AppLight1: Fire
   Â Â Â {
            vehicleClass="PILOT OBJECTS";
            displayName="Approach Light 1";
            model="\PILOT_AppLights\PILOT_AppLight1.p3d";
     Â Â Â Â Â Â audible=1;
            simulation="fire";
            sound="empty";        
            class smoke
            {
         Â Â Â Â Â Â Â Â Â interval=0;
         Â Â Â Â Â Â Â Â Â timetolive=0;
         Â Â Â Â Â Â Â Â Â cloudletDuration=10;
         Â Â Â Â Â Â Â Â Â cloudletAnimPeriod=0;
         Â Â Â Â Â Â Â Â Â cloudletSize=0;
         Â Â Â Â Â Â Â Â Â cloudletAlpha=0;
         Â Â Â Â Â Â Â Â Â cloudletGrowUp=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeIn=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeOut=0;
         Â Â Â Â Â Â Â Â Â cloudletAccY=0;
         Â Â Â Â Â Â Â Â Â cloudletMinYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletMaxYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletShape=koulesvetlo;
         Â Â Â Â Â Â Â Â Â cl_basic=0;
         Â Â Â Â Â Â Â Â Â cloudletColor[]={0,0,0,0};
         Â Â Â Â Â Â Â Â Â initT=0;
         Â Â Â Â Â Â Â Â Â deltaT=0;
         Â Â Â Â Â Â Â Â Â maxT=0;
         Â Â Â Â Â Â Â Â Â class table{};
         Â Â Â Â Â Â Â Â Â density=0;
                 size=0;
         Â Â Â Â Â Â Â Â Â in=0;
         Â Â Â Â Â Â Â Â Â out=0;
         Â Â Â Â Â Â Â Â Â initYSpeed=0;
            };
            class Light
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .1;
            };  
   Â Â Â };
   class PILOT_AppLight2: Fire
   Â Â Â {
            vehicleClass="PILOT OBJECTS";
            displayName="Approach Light 2";
            model="\PILOT_AppLights\PILOT_AppLight2.p3d";
     Â Â Â Â Â Â  audible=1;
            simulation="fire";
            sound="empty";        
            class smoke
            {
         Â Â Â Â Â Â Â Â Â interval=0;
         Â Â Â Â Â Â Â Â Â timetolive=0;
         Â Â Â Â Â Â Â Â Â cloudletDuration=10;
         Â Â Â Â Â Â Â Â Â cloudletAnimPeriod=0;
         Â Â Â Â Â Â Â Â Â cloudletSize=0;
         Â Â Â Â Â Â Â Â Â cloudletAlpha=0;
         Â Â Â Â Â Â Â Â Â cloudletGrowUp=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeIn=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeOut=0;
         Â Â Â Â Â Â Â Â Â cloudletAccY=0;
         Â Â Â Â Â Â Â Â Â cloudletMinYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletMaxYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletShape=koulesvetlo;
         Â Â Â Â Â Â Â Â Â cl_basic=0;
         Â Â Â Â Â Â Â Â Â cloudletColor[]={0,0,0,0};
         Â Â Â Â Â Â Â Â Â initT=0;
         Â Â Â Â Â Â Â Â Â deltaT=0;
         Â Â Â Â Â Â Â Â Â maxT=0;
         Â Â Â Â Â Â Â Â Â class table{};
         Â Â Â Â Â Â Â Â Â density=0;
                 size=0;
         Â Â Â Â Â Â Â Â Â in=0;
         Â Â Â Â Â Â Â Â Â out=0;
         Â Â Â Â Â Â Â Â Â initYSpeed=0;
            };
            class Light1
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light1";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .007;
            };  
            class Light2
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light2";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .07;
            };  
            class Light3
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light3";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .07;
            };  
            class Light4
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light4";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .07;
            };  
            class Light5
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light5";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .07;
            };  
   Â Â Â };
};
I get no error on startup, and when I turn on the lights all that appears is a single orangish light halfway up the mast.  I can supply a picture if needed.

-Student Pilot

EDIT:
I have come to the conclusion that what I want to do is not possible the way I want to do it.  Please feel free to correct me ;D

...So, what I want to do is define the group of five lights as an object and call a script which camcreates invisible lights in the proper places.  My question is, how do I call the script.  I have the following in the config:
Code: [Select]
   class PILOT_AppLight2: NonStrategic
   Â Â Â {
      armor=20;
      scope=2;      
      destrType="DestructTree";
            vehicleClass="PILOT OBJECTS";
            displayName="Approach Light 2";
            model="\PILOT_AppLights\PILOT_AppLight2.p3d";
 Â Â Â Â Â Â class UserActions
      {
         class Lights
         {
            displayName="";
            position="Light3";
            radius=0;
            condition="player distance _this < 3000";
            statement="[_this] exec ""\PILOT_AppLights\lights.sqs""";
         };
      };         
   };
The reason I am using UserActions is, I want this to work with WRP placed objects, and eventhandlers don't work with WRP placed objects.  My problem is, the script is not being run.  How do I pass variables to the script so I can get the script working, and how do I call the script in the config?
« Last Edit: 14 Sep 2005, 05:02:36 by Student Pilot »

swift88

  • Guest
Re:Multiple lights per Object
« Reply #1 on: 14 Sep 2005, 14:01:31 »
i had the impression that the lights where under this (i may of got the wrong end of the stick?)
      
Quote
class Reflectors
      {
         class Left
         {
            color[]={0.900000,0.800000,0.800000,1.000000};
            ambient[]= {0.100000,0.100000,0.100000,1.000000};
            position="svetlo L";
            direction="konec L svetla";
            hitpoint="svetlo PL";
            selection="svetlo L";
            size=0.500000;
            brightness=0.250000;
         };
         class Right
         {
            color[]={0.900000,0.800000,0.800000,1.000000};
            ambient[]={0.100000,0.100000,0.100000,1.000000};
            position="svetlo P";
            direction="konec P svetla";
            hitpoint="svetlo PP";
            selection="svetlo P";
            size=0.500000;
            brightness=0.250000;
         };

if thats true i would Put a few other points similar to this
                                                              Class Light2: Right
                                                              {
                                                                position="Light";
            direction="Light";
            hitpoint="Light";
            selection="Light";
be worth a try imho


or if the one light is working..... use that as a base class and elaborate the rest using that one base class
« Last Edit: 14 Sep 2005, 14:04:19 by swift88 »

Offline Pilot

  • Contributing Member
  • **
Re:Multiple lights per Object
« Reply #2 on: 14 Sep 2005, 16:29:15 »
Thanks for the reply!

I thought the reflectors class was just fo non-static vehicles ???

I'll give it a try and see what I come up with.

-Student Pilot

EDIT:
I gave it a try but it didn't work.  There was no way I could turn on the lights.

EDIT EDIT:
What is wrong with my code for calling the script?  No matter what I try, the script will not run. :'(
« Last Edit: 14 Sep 2005, 17:08:22 by Student Pilot »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Multiple lights per Object
« Reply #3 on: 14 Sep 2005, 21:06:36 »
I made some airfield and runway lighting sets a while ago.

One is a model which has 5 lights, unfortunately you can only have one memory point for light position per model.

So the only way to have 5 lights is to create lights at the relevant positions.

My lights were .wrp inserted so you needed an external script to light up the other 4.

These lights also used the 'streetlight' simulation, so they only came on at night, the problem with that is the light cone, which I have never really managed to get rid of.

I'll try and post a picture later.   ;D

I ended up using 5 separate lights instead of the group of 5 model.


Planck
« Last Edit: 14 Sep 2005, 21:07:52 by Planck »
I know a little about a lot, and a lot about a little.

Offline Pilot

  • Contributing Member
  • **
Re:Multiple lights per Object
« Reply #4 on: 15 Sep 2005, 05:10:53 »
Thanks for the reply, Planck.  I think I have figured out how to do what I want to do.  I have ended up making the basic light model, and I cam camcreating five lights in the relevant positions.  I just have to work out the positions now.  Thank God I know trig... :P

I am not sure if the person who wants the lights wants them as streetlamp or fire, but it shouldn't be too hard changing it over (I hope... ::))

-Student Pilot

Offline Pilot

  • Contributing Member
  • **
Re:Multiple lights per Object
« Reply #5 on: 15 Sep 2005, 06:27:17 »
Ok, I have worked out the positions, I have the brightness and size about where I want them and the models are done.  However, I have run across another problem.  When I tried the several different light fixtures on one map, only the first one had lights.  I think this may be a limitation in the way the script is called.  Any help on this would be greatly appreciated!
Here is the config:
Code: [Select]
#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 true 1
#define false 0
#define private 0
#define protected 1
#define public 2

class CfgPatches
{
     class PILOT_AppLights
 Â Â Â {
              worlds[] = {};
            units[] = {PILOT_AppLight1, PILOT_AppLight2, PILOT_InvisLigh1};
              requiredVersion = 1.85;
     };
};
class cfgModels
{
   class Default
       {
                sections[]={""};
                sectionsInherit="";
       };
     class All {};
         class Static: All {};
         class Building: Static {};
         class NonStrategic: Building  {};
   class PILOT_AppLight1: NonStrategic
     {
            sectionsInherit="";
     Â Â Â     sections[]={};
     };
   class PILOT_AppLight2: NonStrategic
     {
            sectionsInherit="";
     Â Â Â     sections[]={};
     };
   class PILOT_InvisLight: NonStrategic
     {
            sectionsInherit="";
     Â Â Â     sections[]={};
     };
};
class CfgVehicles
{
   Â Â Â class All{};
   Â Â Â class Static: All{};
   Â Â Â class Building: Static{};
   Â Â Â class NonStrategic: Building{};
   class Fire: NonStrategic {};
   class PILOT_AppLight1: Fire
   Â Â Â {
            vehicleClass="PILOT OBJECTS";
            displayName="Approach Light 1";
            model="\PILOT_AppLights\PILOT_AppLight1.p3d";
     Â Â Â Â Â Â audible=1;
            simulation="fire";
            sound="empty";        
            class smoke
            {
         Â Â Â Â Â Â Â Â Â interval=0;
         Â Â Â Â Â Â Â Â Â timetolive=0;
         Â Â Â Â Â Â Â Â Â cloudletDuration=10;
         Â Â Â Â Â Â Â Â Â cloudletAnimPeriod=0;
         Â Â Â Â Â Â Â Â Â cloudletSize=0;
         Â Â Â Â Â Â Â Â Â cloudletAlpha=0;
         Â Â Â Â Â Â Â Â Â cloudletGrowUp=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeIn=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeOut=0;
         Â Â Â Â Â Â Â Â Â cloudletAccY=0;
         Â Â Â Â Â Â Â Â Â cloudletMinYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletMaxYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletShape=koulesvetlo;
         Â Â Â Â Â Â Â Â Â cl_basic=0;
         Â Â Â Â Â Â Â Â Â cloudletColor[]={0,0,0,0};
         Â Â Â Â Â Â Â Â Â initT=0;
         Â Â Â Â Â Â Â Â Â deltaT=0;
         Â Â Â Â Â Â Â Â Â maxT=0;
         Â Â Â Â Â Â Â Â Â class table{};
         Â Â Â Â Â Â Â Â Â density=0;
                 size=0;
         Â Â Â Â Â Â Â Â Â in=0;
         Â Â Â Â Â Â Â Â Â out=0;
         Â Â Â Â Â Â Â Â Â initYSpeed=0;
            };
            class Light
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light";
         Â Â Â Â Â Â Â Â Â size = 0.8;
         Â Â Â Â Â Â Â Â Â brightness = .1;
            };  
   Â Â Â };
   class PILOT_AppLight2: NonStrategic
   Â Â Â {
      armor=20;
      scope=2;      
      destrType="DestructTree";
            vehicleClass="PILOT OBJECTS";
            displayName="Approach Light 2";
            model="\PILOT_AppLights\PILOT_AppLight2.p3d";

      class UserActions
      {
         class Lights
         {
            displayName="Nil";
            position="Light3";
            radius=3000;
            condition="call {private ""_t"";_T=True;If PILOT_LightOn Then {_T=False};If _T Then {PILOT_LightOn=True; [This] Exec ""\PILOT_AppLights\Lights.sqs""};_T}";
            statement="";
         };
      };         
   };
   class PILOT_InvisLight: Fire
   {
            vehicleClass="PILOT OBJECTS";
            displayName="Invisible Light";
      scope=private;
      model="\PILOT_AppLights\PILOT_InvisLight.p3d";
     Â Â Â Â Â Â audible=1;
            simulation="fire";
            sound="empty";        
            class smoke
            {
         Â Â Â Â Â Â Â Â Â interval=0;
         Â Â Â Â Â Â Â Â Â timetolive=0;
         Â Â Â Â Â Â Â Â Â cloudletDuration=10;
         Â Â Â Â Â Â Â Â Â cloudletAnimPeriod=0;
         Â Â Â Â Â Â Â Â Â cloudletSize=0;
         Â Â Â Â Â Â Â Â Â cloudletAlpha=0;
         Â Â Â Â Â Â Â Â Â cloudletGrowUp=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeIn=0;
         Â Â Â Â Â Â Â Â Â cloudletFadeOut=0;
         Â Â Â Â Â Â Â Â Â cloudletAccY=0;
         Â Â Â Â Â Â Â Â Â cloudletMinYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletMaxYSpeed=0;
         Â Â Â Â Â Â Â Â Â cloudletShape=koulesvetlo;
         Â Â Â Â Â Â Â Â Â cl_basic=0;
         Â Â Â Â Â Â Â Â Â cloudletColor[]={0,0,0,0};
         Â Â Â Â Â Â Â Â Â initT=0;
         Â Â Â Â Â Â Â Â Â deltaT=0;
         Â Â Â Â Â Â Â Â Â maxT=0;
         Â Â Â Â Â Â Â Â Â class table{};
         Â Â Â Â Â Â Â Â Â density=0;
                 size=0;
         Â Â Â Â Â Â Â Â Â in=0;
         Â Â Â Â Â Â Â Â Â out=0;
         Â Â Â Â Â Â Â Â Â initYSpeed=0;
            };
            class Light
            {
         Â Â Â Â Â Â Â Â Â Shape="koulesvetlo";
         Â Â Â Â Â Â Â Â Â color[] = {1.0, 1.0, 1.0, 1.0};
         Â Â Â Â Â Â Â Â Â ambient[] = {0.1, 0.1, 0.1, 1.0};
         Â Â Â Â Â Â Â Â Â position = "Light";
         Â Â Â Â Â Â Â Â Â size = 0.2;
         Â Â Â Â Â Â Â Â Â brightness = .01;
   Â Â Â };
};
Here is the script:
Code: [Select]
_T = _this select 0

_dir = getdir _T
_light1 = "PILOT_InvisLight" camcreate [(((getpos _T select 0) + (cos _dir*.05)) + ((cos _dir)*1.5)), (((getpos _T select 1) - (sin _dir*.05)) - ((sin _dir)*1.5)), (getpos _T select 2)+1.85]
_light1 setdir _dir
_light1 inflame true
_light2 = "PILOT_InvisLight" camcreate [(((getpos _T select 0) + (cos _dir*.05)) + ((cos _dir)*.75)), (((getpos _T select 1) - (sin _dir*.05)) - ((sin _dir)*.75)), (getpos _T select 2)+1.85]
_light2 setdir _dir
_light2 inflame true
_light3 = "PILOT_InvisLight" camcreate [(getpos _T select 0) + (cos _dir*.05), (getpos _T select 1) - (sin _dir*.05), (getpos _T select 2)+1.85]
_light3 setdir _dir
_light3 inflame true
_light4 = "PILOT_InvisLight" camcreate [(((getpos _T select 0) + (cos _dir*.05)) - ((cos _dir)*.75)), (((getpos _T select 1) - (sin _dir*.05)) + ((sin _dir)*.75)), (getpos _T select 2)+1.85]
_light4 setdir _dir
_light4 inflame true
_light5 = "PILOT_InvisLight" camcreate [(((getpos _T select 0) + (cos _dir*.05)) - ((cos _dir)*1.5)), (((getpos _T select 1) - (sin _dir*.05)) + ((sin _dir)*1.5)), (getpos _T select 2)+1.85]
_light5 setdir _dir
_light5 inflame true
exit

-Student Pilot
« Last Edit: 15 Sep 2005, 06:32:08 by Student Pilot »

Offline Pilot

  • Contributing Member
  • **
Re:Multiple lights per Object
« Reply #6 on: 25 Sep 2005, 21:56:14 »
The person I am working with decided to use the fire simulation, so my current problem just disappeared ;D

Actually, I have no problems now, so I guess I'll solve this. ::)

Thanks everybody!

-Student Pilot