Jump to content
Divinitize

Reflector lights

Recommended Posts

EDIT : still need help, i check back everyday, see latest post.

Does anyone know how to do reflector lights, i cant seem to find much info about them on google, this is what im currently doing.

i have put memory points for the start and end(direction) and i have named the selection in both the main LOD and the memory lod

	class Reflectors
	{
		class red
		{

			color[] = {1.0, 1.0, 1.0, 1.0};
			ambient[] = {0.1, 0.1, 0.1, 1.0};
			position = "red_start";
			direction = "red_end";
			hitpoint = "red";
			selection = "red";
			size = 0.0;
			brightness = 40.0;
		};
	};

im well aware that the current colour isn't red, i wanted to get it working first. i think im doing the part that says "class red" wrong, im not sure what i should be defining there, ive tried the selection and the actual model class name and no luck. thanks in advance

Edited by Divinitize

Share this post


Link to post
Share on other sites

In arma, reflectors are headlights.

In order to make new reflectors, you need to inherit the reflector class.

something like

class reflectors: reflectors
{
    class new_reflector:reflector
    {
         [... reflector shit ...]
    };
    class new_reflector2:reflector
    {
         [... different reflector shit ...]
    };
};

I'm a bit rusty, but then I think you need to trace your unit class inheritance back all the way to where reflectors first appeared in BI's vehicle tree.

class some_BI_superclass;
class some_BI_Base: some_BI_superclass
{
class Reflectors
{
	class Reflector;
};
};
class some_BI_vehicle: some_BI_Base
{
class Reflectors: Reflectors;
{
	class Reflector: Reflector;
};
};
class my_vehicle: some_BI_vehicle
{
    class reflectors: reflectors
    {
         [ ... ]
         class new_Reflector:Reflector
         {
              [...]
         };
         class new_Reflector2:Reflector
         {
              [...]
         };
    };
};

Share this post


Link to post
Share on other sites

Im still finding it hard to understand, this is what the ingame lighthouse has in its config

class Reflectors
	{
		class Reflector_1
		{
			color[] = {1,0.9,0.8,1};
			ambient[] = {0,0,0,0};
			position = "Light_1_pos";
			direction = "Light_1_dir";
			hitpoint = "Main_Light_hitpoint";
			selection = "Main_Lights";
			size = 1;
			innerAngle = 5;
			outerAngle = 30;
			coneFadeCoef = 1;
			intensity = 10000;
			flareSize = 25;
			flareMaxDistance = 2500;
			dayLight = 0;
			useFlare = 1;
			blinking = 0;
			class Attenuation
			{
				start = 0;
				constant = 0;
				linear = 0;
				quadratic = 1;

just that simple thing, but when i try i get nothing

Share this post


Link to post
Share on other sites

Houses are not vehicles. Maybe you should give more information about your thing.

In this case I would say that the reflector class was introduced in the lighthouse class for that config tree.

Share this post


Link to post
Share on other sites

i have modelled very basic emergency lights to go ontop of the offroad

this is my current config for the item

#define _ARMA_

class CfgPatches
{
class crg_police_lights
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {};
};
};
class CfgVehicleClasses
{
class crg_police_lights
{
	displayName = "crg_police_lights";
};
};
class CfgFactionClasses
{
class crg_police_lights
{
	displayName = "crg_police_lights";
	priority = 100;
	side = 3;
};
};
class CfgVehicles
{
class Thing;
class Strategic;
class Building;
class crg_police_lights: Thing
{
	scope = 2;
	model = "\crg_police_lights\crg_police_lights.p3d";
	displayName = "crg_police_lights";
	mapSize = 1;
	vehicleclass = "crg_police_lights";
	faction = "crg_police_lights";
	destrType = "DestructNo";
	nameSound = "";
	accuracy = 1000;
	camouflage = 0.6;
	threat[] = {0,0,0};
	ladders[] = {};
	cost = 0;
	armor = 1e+011;
};
};
  	class Reflectors
	{
		class Reflector_01
		{

			color[] = {1.0, 1.0, 1.0, 1.0};
			ambient[] = {0.1, 0.1, 0.1, 1.0};
			position = "red_start";
			direction = "red_end";
			hitpoint = "red";
			selection = "red";
			size = 0.0;
			brightness = 40.0;
		};
	};
//};

I know you guys are only here to give advice, and i really appreciate it, but im not very smart when it comes to this sort of thing, so if its at all possible to try do it for me thats the best way for me to learn. the way i have the reflector set up at the moment isn't working. thanks again

Share this post


Link to post
Share on other sites

Certain kinds of things can't have reflectors. We had a lot of problems with our street lights. I believe if you define your object in cfgnonaivehicles you can have reflectors on static objects, but other limitations surface, like lights that you can't shoot out.

Share this post


Link to post
Share on other sites
i have modelled very basic emergency lights to go ontop of the offroad

this is my current config for the item

I assume that your lights are part of the offroad model? If so than you want their configuration to be in config class of the car, not an object on it's own.

Assuming you do want the lights to be a standalone object (eg. for testing purposes), you could try the following (please keep in mind I'm writing this from the top of my head, so there may be things I overlooked :) ):

class CfgVehicles
{
class Thing;
class Strategic;
class Building;
class crg_police_lights: [b][s][color=#ff0000]Thing[/color][/s][/b] [color=#009f00]Building[/color]
{
	scope = 2;
	model = "\crg_police_lights\crg_police_lights.p3d";
	displayName = "crg_police_lights";
	[color=#9f9f00]mapSize = 1;
	vehicleclass = "crg_police_lights";
	faction = "crg_police_lights";
	destrType = "DestructNo";
	nameSound = "";
	accuracy = 1000;
	camouflage = 0.6;
	threat[] = {0,0,0};
	ladders[] = {};
	cost = 0;
	armor = 1e+011;[/color]
[b][s][color=#ff0000]};
};[/color][/s][/b]
  	class Reflectors
	{
		class Reflector_01
		{

			color[] = {1.0, 1.0, 1.0, 1.0};
			ambient[] = {0.1, 0.1, 0.1, 1.0};
			position = "red_start";
			direction = "red_end";
			hitpoint = "red";
			selection = "red";
			size = 0.0;
			brightness = 40.0;
		};
	};
[b][color=#009f00]};[/color][/b]
[b][s][color=#ff0000]//[/color][/s][/b]};

1. I've highlighted in yellow parameters that you probably don't need to worry about while getting the lights to work at all (maybe except for vehicleClass, if you do want to have it in a specific category in editor).

2. Don't use class Thing as a parent, because that means you will inherit simulation=thing and that simulation doesn't support dynamic lights. Class Building has simulation=house and that simulation includes dynamic lights (eg. lighthouse or streetlamps).

3. Class Reflectors should be part of the object's definition; you had it outside of it because of the two }; just before it.

4. In terms of which parameters are needed for the light to work, try copypasting the lighthouse reflector ones (the code by Divinitize posted above) and just adjust the values for your model.

If this still doesn't work, then there are two possible reasons. Either there is still something wrong about the config or the light is there but just too dim to be visible. Don't be afraid to overshoot the light intensity for testing purposes to confirm whether the lights are working or not. Check out configurations of some existing objects in the Config Viewer (accessed by the "Cog" button in ingame editor) for inspiration.

If you have the lights as part of the offroad model, just put the class Reflectors into the config class of your car like this:

[color=#7f00ff]class[/color] cfgVehicles
{
...
[color=#7f00ff]class[/color] MyOffroadCar: <parent class>
{
	displayName = [color=#8f8f8f]"My Offroad"[/color];
	model = ...;
	...
	[color=#7f00ff]class[/color] Reflectors
	{
		...
	};
};
};

You don't need to inherit class Reflectors from the parent class if you define all mandatory parameters.

Good luck!

<insert a disclaimer about the game still being in development and stuff possibly changing> :)

Share this post


Link to post
Share on other sites

Thank's for your detailed post, it is infact a seperate object and not part of the offroad, i'm just using the attachto to get it on the roof ;) ill give this a try later and get back to you thanks alot for the time and effort.

---------- Post added at 13:08 ---------- Previous post was at 12:49 ----------

Iv'e tried all the stuff that Tilion mentioned but i still cant get it to work, here is my current config

class CfgPatches
{
class MY_OBJECT
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {};
};
};
class CfgVehicleClasses
{
class MY_OBJECT
{
	displayName = "MY_OBJECT";
};
};
class CfgFactionClasses
{
class MY_OBJECT
{
	displayName = "MY_OBJECT";
	priority = 100;
	side = 3;
};
};
class CfgVehicles
{
class Thing;
class Strategic;
class Building;
class MY_OBJECT: Building
{
	scope = 2;
	model = "\MY_OBJECT\MY_OBJECT.p3d";
	displayName = "MY_OBJECT";
	mapSize = 1;
	vehicleclass = "MY_OBJECT";
	faction = "MY_OBJECT";
	destrType = "DestructNo";
	nameSound = "";
	accuracy = 1000;
	camouflage = 0.6;
	threat[] = {0,0,0};
	ladders[] = {};
	cost = 0;
	armor = 1e+011;

class Reflectors
	{
		class Reflector_1
		{
			color[] = {1,0.9,0.8,1};
			ambient[] = {0,0,0,0};
			position = "light_start";
			direction = "light_end";
			hitpoint = "Main_Light_hitpoint";
			selection = "Light";
			size = 1;
			innerAngle = 5;
			outerAngle = 30;
			coneFadeCoef = 1;
			intensity = 10000;
			flareSize = 25;
			flareMaxDistance = 2500;
			dayLight = 0;
			useFlare = 1;
			blinking = 0;
			class Attenuation
			{
				start = 0;
				constant = 0;
				linear = 0;
				quadratic = 1;
		};
	};
};
};
};

Share this post


Link to post
Share on other sites

If you check the ingame config viewer, can you see the classes you've created?

Share this post


Link to post
Share on other sites

Sorry for the silence on my end.

I've tried your config and it seems the solution is to boost up the intensity some more. I added two more zeros ( intensity = 1000000; ). Other than that, I only changed model, position and direction parameters (all just to fit the model I was testing it on).

If you can't see the light even with the intensity changes, then my next hunch would be that selection names for the position and direction parameters don't match the names used in your model.

Let me know if it still doesn't work, we can try figure out something else. :)

Edited by Tilion
fixed a missing word :)

Share this post


Link to post
Share on other sites

I really apretiate the help that you are offering, i doubt other games companys have devs that do this sort of thing so thanks, however still no luck on my object...

To make sure i'm not making a fool of myself, which i likely am here is how my object in oxygen is set up;

I have 3 mempoints = light_start, light_end, light.

for the "selection" was not sure if i had to do that in memory or the main lod, so i did it in both and called them "light"

i have added a hitpoint aswell.

I really cant thank you enough for this, and take your time replying i check back daily.

Share this post


Link to post
Share on other sites

Eureka! :) It seems that destrType = "DestructNo"; causes lights to not function. I'll consult our programmers to see if there is a reason for this behavior or if it's a bug. You can hotfix it by deleting that line from your config - which means it will inherit destrType = "DestructDefault";

Share this post


Link to post
Share on other sites
...how would i correct the cone issue, should i have both memory points on top of another..
The memory point you assign to position parameter is where the light source itself will be. The one you put to direction is the way your light will shine. The cone itself is set using innerAngle, outerAngle and coneFadeCoef.

innerAngle sets the cone in which the light has it's full intensity.

outerAngle sets the cone outside of which the light has zero intensity.

coneFadeCoef is a coefficient that describes attenuation of the light between innerAngle and outerAngle. 1 equals linear attenuation, higher or lower value changes it, meaning how sharp/blurred will the edge of the lightcone as a whole be.

Note that both the angles represent full angle of the cone, not just "angular offset" from direction of the light. If you set it to 90 degrees, it means the cone is 45 degrees to the "left" and 45 to the "right" of the direction specified by your memory points.

In your case, having the direction memory point directly above the position means your light is pointed up in the sky. If you want an "all-direction" light, you might want to use MarkerLights instead of Reflectors (Reflectors are spotlights) that are configured somewhat similarly.

i changed the cone to 360 x 360 and that seems to work in all directions, i have 2 small questions one is i have to have the intensity at around 100000000 for it to be as bright as i want it, which isn't really that bright, and secondly the "blinking" in the config i assumed that meant it would actually blink, but changing the ammount from 0 to 1 didn't do anything, is there a way to make it blink/flash, thanks alot
360-360 cones for reflectors can do it, though you may encounter some artifacts "behind the light" because as a spot light, reflectors are not made for cones above 180 degrees.

Some time ago we made changes to the lighting system to allow for higher light variety during night time. One of the effects it had on configs of lights was that you need to set higher intensity than before the change to get the same results.

About blinking: that parameter slipped into the config of reflectors due to copy-paste from MarkerLights. If you want to have blinking reflectors, you could probably do it by running a script to periodically setHit it form 0 to 1 and back (destroying the light and mending it again). But if you want to have a blinking all-direction light, I'd just use MarkerLights instead.

Share this post


Link to post
Share on other sites
I'll consult our programmers to see if there is a reason for this behavior or if it's a bug.
As far as I know, this should be now fixed (in the development branch). So you can have destrType = "DestructNo"; and lights should still work if configured right.

Share this post


Link to post
Share on other sites

May I ask you a for a little follow-up about the value range and meaning of certain parameters when you find the time please.

Especially color[] and ambient[] seem to have changed from RGB from 0-1 to way higher values.

intensity, size, useFlare, flareSize, flareMaxDistance and the Attenuation params would be great too

Share this post


Link to post
Share on other sites

As far as I know, this should be now fixed (in the development branch). So you can have destrType = "DestructNo"; and lights should still work if configured right.

 

 

After testing this has not been fixed, it still stops lights from working when destruct is set to no

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

×