User Tools

Site Tools


led_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
led_examples [2021/11/28 20:10] – [Using Triggers] hnegled_examples [2022/03/05 13:15] (current) hneg
Line 110: Line 110:
 **//Play Scenario//**, switch to 3rd person and run towards the triggers. You will notice the lights light up only when you activate the trigger: **//Play Scenario//**, switch to 3rd person and run towards the triggers. You will notice the lights light up only when you activate the trigger:
 {{:led_xmpl_006_002.png|}} {{:led_xmpl_006_002.png|}}
 +
 +Next, a bit more complex trigger controlled situation.
 +If you own for example the **//Laws of War DLC//** it comes with an ambulance that has the emergency lights on it.
 +Well, they look absolutely ridiculous compared to the real thing because in the dark you can see those things light up blocks away. Just Google some emergency vehicle images/videos at night and compare to this:
 +{{:led_xmpl_007_001.png|}}
 +
 +So, let’s put a couple of light emitters and triggers to emulate what they should kinda look like. I say "should kinda" because this is very crude and ugly looking still.
 +Start a new scenario, put down some car, doesn’t have to be the previously mentioned ambulance, this is just an example.
 +{{:led_xmpl_007_003.png|}}
 +
 +Place down a light emitter, set the class **//Chemlight_red//** for it, change the intensity to **//40000//** (add one 0 to it) and the **//Attenuation start//** to **//2//**. Select the **//Global attach//** mode and move the emitter to the roof of the vehicle (or drag and ``SHIFT + ALT + A``). You can fine-tune the attach position either by inputting data into the position field or with the Eden //Translation widget// (as explained in the [[led_examples#ufo|UFO]] example).
 +Fine-tune the emitter position so that it lights up the outside roof instead of the insides of the vehicle.
 +Place down another light emitter with class **//Chemlight_blue//**, intensity to **//40000//** and attenuation start to **//2//**. **//Global attach//** the emitter to the other side of the roof of the vehicle, fine-tune like the previous one.
 +
 +Place five 0x0 triggers.
 +One next to each emitter, name the two to //blue// and //red// according to the color of the emitter. In the **//Condition//** field of the //blue// trigger write:
 +<code>triggerActivated light_ctrl</code>
 +and set it //Repeatable//. Use the tools "special sync" to sync it with the blue emitter (``SHIFT + ALT + S``).
 +In the **//Condition//** field of the //red// trigger write:
 +<code>!(triggerActivated light_ctrl) && !(missionNamespace getVariable ["do_lightctrl", false])</code>
 +and set it //Repeatable//. Sync it with the red emitter (``SHIFT + ALT + S``).
 +
 +Then name one trigger to //start// (just to keep things easier to follow), in it’s **//Condition//** field write
 +<code>true</code>
 +In it’s **//On Activation//** field write:
 +<code>do_mainctrl = true</code>
 +
 +Then name the next trigger to //main_ctrl//.
 +Set it //Repeatable// and in it’s **//Condition field//** write
 +<code>missionNamespace getVariable ["do_mainctrl", false]</code>
 +In it’s **//On Activation//** field write
 +<code>do_lightctrl = true</code>
 +and in it’s **//On Deactivation//** field
 +<code>do_lightctrl = false</code>
 +Set the three **//Timer Values//** (min – mid - max) to **//0.1//**.
 +
 +Name the last trigger to //light_ctrl//. Set it //Repeatable// and in its **//Condition//** field write
 +<code>missionNamespace getVariable ["do_lightctrl", false]</code>
 +In its **//On Activation//** field write
 +<code>do_mainctrl = false</code>
 +and in it’s **//On Deactivation//** field write
 +<code>do_mainctrl = true</code>
 +Set the three **//Timer Values//** (min – mid - max) to 0.05.
 +
 +Place down a player entity to observe and **//Play Scenario//**.
 +You should see the lights blinking (badly) on the vehicle roof, looking more like the real thing than the vanilla blinking textures:
 +{{:led_xmpl_007_002.png|}}
 +
 +Of course setting **//Use Flare//** and adjusting it’s size would make them look more real.
 +
 +This example points out that the when synced with a trigger using the tool’s sync (``SHIFT + ALT + S``) the emitter follows the triggers activation/deactivation. On activation the emitter is "on" and on deactivation emitter is "off".
 +
 +Obviously making these lights look better it would require some scripting in-scenario.
 +Such a script is included in an example at the end of this manual in the section [[todo|In-Game Functions –> Examples]], but it is quite crude and not really meant top be used, especially not tested in MP.
 +
 +
 +===== Directional =====
 +<WRAP todo>TODO</WRAP>
led_examples.1638130223.txt.gz · Last modified: 2021/11/28 20:10 by hneg