Apr 24, 2017, 10:36 AM
Running Lights
Start with setting up your table. It's like your EMV table from before.
PI.Meta
It's the exact same as the meta for emergency lights.
Here's an example for the Crown Victoria's tail light.
PI.Positions
Again, the same as emergency lighting. Set the positions of your lights.
An example, for the Crown Victoria's tail light.
Breaking this down.
PI.States
This is the equivalent of the combination of EMV.Sections, EMV.Patterns and EMV.Sequences.
There are 6 states. Headlights, Breaks, Blink_Left, Blink_Right, Reverse and Running.
Headlights are not working, so I don't bother filling them in.
Inside the brackets you fill in the lights and colours, similar to EMV.Sections.
The blinkers toggle on and off, with a pattern similar to 1,1,1,0,0,0.
Hazards are created by toggling both left and right blinkers.
Here's an example from the Crown Victoria's lights.
Finally
Fill all those in, then stick this at the end of your code.
Depending on what you're doing, you'll generally do the first, and sometimes the second.
If you're doing multiple vehicles with the same base model, you can set the Vehicle Library.
An example from my Crown Victoria, inside the vehicle list.
However, if you're only doing one vehicle, you can also set it in the same file.
An example from my Merc Sprinter.
Both methods work, so there is no "best practice". Do what's best for you.
. Sorry I posted it anyway. You posted about 20 seconds before I did.
smells. :3
Start with setting up your table. It's like your EMV table from before.
Code:
local PI = {}
PI.Meta
It's the exact same as the meta for emergency lights.
Here's an example for the Crown Victoria's tail light.
Code:
tail_light = { -- Set the name of the light.
AngleOffset = 90, -- The anglular offset.
W = 8.5, -- Size of the sprite.
H = 9,
Sprite = "sprites/emv/crownvic_tail", -- The material.
Scale = 1, -- The glow multiplier.
WMult = 1, -- Not a clue.
},
PI.Positions
Again, the same as emergency lighting. Set the positions of your lights.
An example, for the Crown Victoria's tail light.
Code:
[1] = {Vector(-31.8,-111.15,41.1), Angle(0,-20,-10), "tail_light"},
Breaking this down.
Code:
[lightIndex :: Integer] = {Position :: Vector, Rotation :: Angle, Light Meta :: String}
PI.States
This is the equivalent of the combination of EMV.Sections, EMV.Patterns and EMV.Sequences.
There are 6 states. Headlights, Breaks, Blink_Left, Blink_Right, Reverse and Running.
Headlights are not working, so I don't bother filling them in.
Inside the brackets you fill in the lights and colours, similar to EMV.Sections.
The blinkers toggle on and off, with a pattern similar to 1,1,1,0,0,0.
Hazards are created by toggling both left and right blinkers.
Here's an example from the Crown Victoria's lights.
Code:
PI.States = {
["Headlights"] = {}, -- Doesn't work. Leave them.
["Brakes"] = {{1, DR}, {2, DR}, {3, DR}, {4, DR}, {5, DR}}, -- Rear Lights, Breaking.
["Blink_Left"] = {{1, DR}, {3, DR}, {14, A}, {16, SW}}, -- Left Blinkers
["Blink_Right"] = {{2, DR}, {4, DR}, {15, A}, {17, SW}}, -- Right Blickers
["Reverse"] = {{10, SW}, {11, SW}}, -- Reverse Lights
["Running"] = {
{1, DR, .25}, {2, DR, .25}, {3, DR, .25}, {4, DR, .25}, {12, DR, .25}, {13, DR, .25},
{6, SW}, {7, SW}, {8, A, .8}, {9, A, .8} -- General Running Lights.
-- For the tail lights, I set them to be a quarter of the brightness of the "real" break lights.
},
}
Finally
Fill all those in, then stick this at the end of your code.
Depending on what you're doing, you'll generally do the first, and sometimes the second.
Code:
if Photon then
Photon:OverwriteIndex("2011 Ford Crown Vic Police", PI)
Photon.VehicleLibrary["sgm_2011fcvpho"] = PI
end
If you're doing multiple vehicles with the same base model, you can set the Vehicle Library.
An example from my Crown Victoria, inside the vehicle list.
Code:
IsEMV = true,
EMV = EMV,
HasPhoton = true,
Photon = "sgm_2011fcvpho"
However, if you're only doing one vehicle, you can also set it in the same file.
An example from my Merc Sprinter.
Code:
IsEMV = true,
EMV = EMV,
HasPhoton = true,
Photon = PI
...
if Photon then Photon:OverwriteIndex( name, PI ) end
Both methods work, so there is no "best practice". Do what's best for you.