Home   Help Search Login Register  

Advertisement

Author Topic: Flashing light  (Read 2660 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Flashing light
« on: 23 May 2009, 21:29:09 »
Hey everyone,

I've been trying to get a flashing strobe light onto a BIS vehicle I have. I have a basic strobe light I have made (a simple box for now with a texture), but how would I make it switch between 2 or 3 textures (assuming this is the best way to make something flash).

I looked around and saw that model animations would be good place to start. That's as far as I have got. I have basic O2 and configing skills. I could probably make the script but actually saying how to animate it is beyond me. I couldn't find anything too relevent to what I want to do using search.

Any direction I can start walking in ?

Thanks for your help,
Jason
« Last Edit: 23 May 2009, 21:53:07 by JasonO »

Offline modEmMaik

  • Members
  • *
Re: Flashing light
« Reply #1 on: 23 May 2009, 22:14:47 »
Well, some flashing lights are implemented in the helicopters (check the memory LOD for "cerveny /  bily / zeleny/ modry pozicni blik" named verticles).

When you want to implement a static un/hidden section, you may use the time as source. I used it once for a radar animation:

Code: [Select]
class smurfc_m2a2_adats_Radar_2
{
type="rotation";
source="time";
selection="radar_2";
axis="osa_radar_2";
memory="false";
minValue=0;
maxValue=2;
sourceAddress="loop";
angle0=0;
angle1="rad 360";
};

You may give it a try to use 1.0 as hiddenthreshold in a hide typ like this:

Code: [Select]
class test_time_hide
{
type="hide";
source="time";
selection="front_texture";
minValue=0;
maxValue=2;
sourceAddress="loop";
                                hideValue=1.0;
};

I do not know, if this works...

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Flashing light
« Reply #2 on: 23 May 2009, 22:26:11 »
The selection has to be made within the Memory LOD I take it?

Walter_E_Kurtz

  • Guest
Re: Flashing light
« Reply #3 on: 24 May 2009, 01:03:45 »
Colonel Klink's Animated Nav Lights tutorial might be what you're after. It is from the early days of OFP, though.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Flashing light
« Reply #4 on: 24 May 2009, 02:36:26 »
Thanks for the link + info. I had a fiddle around and didn't really get a result lol. Colonel Klink's tutorial is outdated for ArmA I believe. At least I got a lot of errors with it.

I was told I would be better off (and possibly easier going) using setObjectTexture.

Well? Great result!
http://www.youtube.com/watch?v=FgUtM5TXpJM&fmt=22

Here is the configing behind it below. It allows me to change the front texture (where the lights are) to different textures using the setObjectTexture command.

config.cpp
Code: [Select]
class CfgPatches {

class lightbar {
Units[] = {"lightbar1"};
Weapons[] = {};
requiredVersion = 1.000000;
requiredAddons[] = {};
};
};

class CfgVehicles
{
class RoadCone;
class lightbar1 : RoadCone
{
displayName="Lightbar Test 1";
model="\lightbar\lightbar1";

hiddenSelections[] = {"lightbar_front"};
};
};

model.cfg
Code: [Select]
class CfgSkeletons
{
class Default
{
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};

class lightbar1 : Default
{
skeletonBones[]=
{  
"lightbar_front"
};
};
};


class CfgModels
{
class lightbar1
{
      sectionsInherit="";
      sections[]=
      {
      "lightbar_front"
      };
      skeletonName="lightbar1";
};
};

The script simply loops through a set of setObjectTexture commands like so:

Code: [Select]
...
~0.1
_veh setObjectTexture [0,"\lightbar\data\lightbar_front_on1.paa"]
~0.2
_veh setObjectTexture [0,"\lightbar\data\lightbar_front_on3.paa"]
~0.3

...

I have made a selection called lightbar_front in my model (called lightbar1.p3d) in all LOD's as well.

Hope this helps some people :)
« Last Edit: 24 May 2009, 03:03:48 by JasonO »