g_lightStates and CFS2

Klein

Members +
Hello dear CFS2 simmers and modders
I have a question about "g_lightstates" in CFS2, I have heared it can cause drops to desk when used on CFS2 models, for peoples experimenting it, when and where does it occur, for what models created with which soft ? I ask this question to perhaps find a fix, does it occurs on models made by FSDS only ?

Some questions that can seem stupid in a first time may be helpfull at the end...

Cheers
Martin
 
Hi Martin,

G_lightstates seems to cause a CTD when loading the aircraft for Quick Combat (&/or Free Flight?).

I believe it can also interfere with trying to use the aircraft in Missions.

It's most often present in aircraft made for FS9 & converted for use in CFS2. My guess is it's for using the landing light runway effect in FS9?

I only have limited experience modelling with G-Max, but have never come across this in the G-Max software, so I'm guessing it's an FSDS or SCASM command thing?
 
May I suggest searching this forum for threads containing the word "lightstates" ? I think you will find several times a post which has a solution involving editting the .MDL file with SCASM . . .
 
Hi Gents
Thanks for your quick answer, I wonder if the problem doesn't come from the "last animation" kind of malediction, in FSDS models, g_lightstates seems to be the last animation present on the animation list once the model converted to a SCASM file, I know all last animation listed at the end of this list doesn't work, the fix I use is to add at the list end a fake "userdefined0". Could it fix too the g_lightstates problem ?

;g_lightStates UINT32 0x0250 4 {57F0E99D-0523-4E9C-BCB6-12BB2FE73F06}
;userdefined0 FLOAT32 0x0254 4 {861C234E-CCDA-4837-970B-EA3C9D27E351}

where 0x0254 is 0x0250 + 4 in hexadecimal

Once the model re-compiled, is the g_lightstates problem still there ?

Just an idea, it could be interesting to use switches for nav lights, landing lights sparely.

If you know a guilty model, I can try to apply this fix, just to see...

Cheers
Martin
 
Yes, "userdefined0" will it fix the g_lightstates problem. Back when I was pretty active in uploading FS9 conversions I encountered this lightstates entry throughout the FS9 universe in a great number of models when viewing them in SCASM. I just overwrote the entries with a "userdefined0" code before re-compiling.
 
Many thanks Bearcat, my idea is not to eradicate the g_lightstates, but to know if it can be "tamed" with ending the animation list with a fake animation.

I'm working actually on Stuart Green's Sopwith Snipe complete conversion with SCAMS, control surfaces, wires and stick with the key framed animations replaced with left_ailer, right_ailer, elevator and rudder, and I'll have the answer once finished cause in this plane all the light states are used to light individually each panel lamp, I keep you all in touch...

Cheers
Martin
 
Hello CFS2 world

I have a partial answer, g_lightstates doesn't crash the game any more, even in quick combat as AI, or in a mission involving eleven AI Snipes, but no joy with what to do with it, sometimes a landing light is seen, and on other time it's not there, depending on I don't know what, no control on it with gauges to toggle the LANDING_LIGHTS. I keep on my experiments...

Cheers
Martin
 
hello Gents

g_lightstates following and end...
Ok, g_lightstates doesn't crash the sim itself, but isn't of any use in CFS2, the lights appear in total random, and no success to try to control it via a relevant gauge, or the keyboard key "Ctrl+L", and forcing the trigger_key_events "KEY-LIGHT..." in the gauges with a MODULE_VAR crashes the sim, so I totally give up g_lightstates. :(
It can be replaced with SCASM by any key framed animation mask not in use elsewhere, with the use of "IfInf", with a preference to spoilers cause you can set up the timing to 0 and the value for the mask to react with a gauge that triggers "KEY_SPOILERS_SET".

Cheers
Martin :jump:
 
Thank you Martin for doggedly pursuing this, even though the result is not what you hoped for.
And thank you for sharing your findings with the Community - it is appreciated.
 
Martin,

I updated my asm compiler back in October last year to add landing lights or nav lights to spoiler keys. Works well with no crashes in QC. I’m using it for my Spitfire’s and P-40’s. Downside is that both landing and nav lights are either on or off and I haven’t found a way to separate the two.

I set a toggle gauge using the Concorde nose to lower/raise the landing lights. I never released it because I didn’t think there would be much use for it as most use scasm not asm for tweaking. I would also need to adjust the program so it’s in a releasable state but have been working on my gauge background creator and dp editor.

Cheers
Aussie
 
Hi Gents
Sharing knowledge is very important for me, I would have saved a lot of time with more exchanges between people interested on how to tweak.

Aussie, the tweak in the SCASM code can be done as it, you'll quickly adapt it to the ASM code ;)


;uName: g_lightStates uOffset: 0x0180
IfVarAnd
( :L156744 0x0180 0x01 )
Light( m 4 0.0329999998 -0.0769999996 -0.0649999976 20 0.6000000238 0.4000000060 E5 0 0 255 0.0000000000 0.0000000000 1.0000000000 )

0x0180 is the offset for g_lightstates for this file, different for any file made by Gmax ( search it in the top animation list on the SCASM file ), 0x01 indicates it's for nav lights (nav lights 0x01, landing lights 0x04, strobe lights 0x10, ....)
m 4 defines nav lights in the light itself, E5 0 0 255 is the colour.

You have to change what is red with what is blue for a use with tailhook (only an example, can be done with an other key-framed animation, concorde_nose, f_canopy, ...)

;uName: tailhook uOffset: 0xD4
IfInf
( :L156744 0xD4 1 200 )
Light( m 4 0.0329999998 -0.0769999996 -0.0649999976 20 0.6000000238 0.4000000060 E5 0 0 255 0.0000000000 0.0000000000 1.0000000000 )

1 200 in the IfInf table means the nav light will show when the key framed tailhook animation will be between 1 to 200, it won't show if the value is 0 ( you don't need to have this key framed animation set up in the model for it to work ) the problem with tailhook is that the animation is timed, so if the light will switch on immediately, it will switch off at the end of the animation timing.
You have a text to add to the aircraft.cfg for the tailhook animation to work.

For landing lights the code is this one:
;uName: g_lightStates uOffset: 0x0180
IfVarAnd
( :L2600D0 0x0180 0x04 )
Light( m 11 0.0920000002 -0.1019999981 0.0560000017 20 0.6000000238 0.4000000060 FF 255 255 255 0.0000000000 0.0000000000 1.0000000000 )

You have to change to have it working with l_spoiler:


;uName: l_spoiler uOffset: 0xF2
IfInf
( :L2600D0 0xF2 1 200 )
Light( m 5 0.0920000002 -0.1019999981 0.0560000017 20 0.6000000238 0.4000000060 FF 255 255 255 0.0000000000 0.0000000000 1.0000000000 )

Not tested, but I believe Light(m 11 won't work in CFS2, replace it with 5.
1 200 is the fork for the landing lights to show, you can change it to 99 200 by example if your landing light is mounted on a moving pad, the light will show at the pad animation's end.

You have to give a value in the air file for the spoilers animation to work, record 320, enter an angle in the Spoilers Angle Limit (1 by example ), no necessity to have spoilers available in record 327, it won't affect the flight dynamics. You can set up the timing in record 1101 primary aerodynamics, Spoilers Cycle Time.

Hope that helps, cheers
Martin
 
Last edited:
Back
Top