Members | Sign In
All Forums > Hardware and LBE construction
avatar

DMX Fade in for "Shields Up" and strobing "Red Alert"

posted Jan 22, 2013 19:37:56 by KatoKatonian
I recently started playing with the DMX lighting commands for Artemis (thank you Thom, it's a really cool addition!) I wanted to add a fade-in to the "Shield Up" command, as well as a strobe for the "Red Alert" command. Here's what I did:

SHIELDS UP FADE IN
Inside of dat\DMXcommands.xml, under the existing code for PLAYER_SHIELDS_ON I added the following (after the end event tag):
<event type="PLAYER_SHIELDS_ON">
   <!-- Fade In Blue -->
   <!-- Time matches length of dat/shieldsUp.wav -->
   <timeblock mseconds="1772">
      <!-- Set RED value to 0 -->
      <setvalue index="0" value="0" change="0"/>
      <!-- Set GREEN value to 0 -->
      <setvalue index="1" value="0" change="0"/>
      <!-- Set BLUE value to change by 200 over course of timeblock, starting at 0 -->
      <setvalue index="2" value="0" change="200"/>
   </timeblock>
</event>


Even though the existing Shields Up code sets the light to bright blue as soon as the condition is fulfilled, this block of code overrides that, changing the blue value from 0 to 200 over the course of about 2 seconds (the length of the shields up sound effect). In order for this to work, this block of code has to come *after* the other shields up code.

STROBING RED ALERT
Inside of dat\DMXcommands.xml, I changed the RED_ALERT to the following:
<event type="RED_ALERT" continuous="yes">
   <!-- Slow Strobing Red Light -->
   <!-- Two second fade in -->
   <timeblock mseconds="2000">
      <!-- Set RED value to change by 200 over course of timeblock, starting at 0 -->
      <setvalue index="0" value="0" change="200"/>
      <!-- Set GREEN value to 0 -->
      <setvalue index="1" value="0" change="0"/>
      <!-- Set BLUE value to 0 -->
      <setvalue index="2" value="0" change="0"/>
   </timeblock>
</event>

<event type="RED_ALERT">
   <!-- Initial Fast Strobe Red Light -->
   <!-- Short fade in to match each repeat in dat/alarm4.wav -->
   <timeblock mseconds="581">
      <!-- Set RED value to change by 200 over course of timeblock, starting at 0 -->
      <setvalue index="0" value="0" change="200"/>
      <!-- Set GREEN value to 0 -->
      <setvalue index="1" value="0" change="0"/>
      <!-- Set BLUE value to 0 -->
      <setvalue index="2" value="0" change="0"/>
   </timeblock>
   <!-- Repeat 3 more times... -->
   <timeblock mseconds="581">
      <setvalue index="0" value="0" change="200"/>
      <setvalue index="1" value="0" change="0"/>
      <setvalue index="2" value="0" change="0"/>
   </timeblock>
   <timeblock mseconds="581">
      <setvalue index="0" value="0" change="200"/>
      <setvalue index="1" value="0" change="0"/>
      <setvalue index="2" value="0" change="0"/>
   </timeblock>
   <timeblock mseconds="581">
      <setvalue index="0" value="0" change="200"/>
      <setvalue index="1" value="0" change="0"/>
      <setvalue index="2" value="0" change="0"/>
   </timeblock>
</event>


As with the Shields Up code, I used the "change" parameter to adjust the value steadily over time, and put the code that would only execute once *after* the code that just sets a repeating strobe for the red light.
page   1
7 replies
avatar
MarkBell said Jan 24, 2013 15:42:37
So you just declare a second event that matches an existing one, and you have one continuous and one not? Nice! I was wondering if that would work or not, good to hear that it does. That opens up quite a few ideas now...
avatar
KatoKatonian said Jan 24, 2013 15:57:38
Yup, it looks like the events in the file are applied in order, so in the case of the Shields Up example above, the steady blue light is applied to the lights, then the fade-in effect is applied (effectively cancelling out the steady blue effect until the fade is done). I got the idea to try it when I saw the damage effects later on in the file which temporarily change the lighting conditions.
avatar
AlexVanPatten said Feb 03, 2013 13:59:54
I was about to ask what the change="" variable was for. Perfect!
avatar
DeaneGeiken said Feb 27, 2013 18:46:25
What you have coded here replaces the core coding or you are adding this to shields and red alert events?
Commander -TSN Belisarius (BS 108)
avatar
MichaelMesich said Mar 01, 2013 07:29:50
It took me a little to figure this out too.

This code is IN ADDITION to the base code and follows after it.

avatar
Auto_Pilot said Apr 29, 2013 15:37:36
Is there a similar set up for when the shields go down?
avatar
MarkBell said Apr 29, 2013 18:16:11
Nope - the events are triggered when the shields are activated. When the shields go down, the events simply don't trigger anymore, so the effects would end abruptly.
Login below to reply: