Jump to content
Sign in to follow this  
der bastler

Flashlight

Recommended Posts

I want to define a flashlight. I know I need:

- two vertices defining base and direction of the light with proper names ("L svetlo", "konec L svetla")

- a class reflectors in my config:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class Reflectors

{

  class Reflector

  {

     color[] = {0.800000,0.800000,1.000000,1.000000};

     ambient[] = {0.070000,0.070000,0.070000,1.000000};

     position = "L svetlo";

     direction = "konec L svetla";

     hitpoint = "L svetlo";

     selection = "L svetlo";

     size = 0.500000;

     brightness = 1.000000;

 };

};

<span id='postcolor'>

And now for the things I don't know:

- What means "selection"?

- Do I need to define something else in my model?

Share this post


Link to post
Share on other sites

I tried to build a search light => OFP crashed.

Perhaps the light cannot be mounted on a turret?

Share this post


Link to post
Share on other sites

Ok, I mounted a flashlight to my new weapon, but I cannot activate it.

Weapon + light = not possible?

Share this post


Link to post
Share on other sites

Lights CANNOT go on weapons.

Share this post


Link to post
Share on other sites

So'n Scheiß!

mad.gif

No chance? No work-around-thingy possible? Something like the laserpointer? sad.gif

Share this post


Link to post
Share on other sites

Didn't someone make a gun that hand a flashlight on the front of it? confused.gif Or was that some fraud fake?

I'm sure there was...

wow.gif PEACE

Share this post


Link to post
Share on other sites

Vipersheart's HK MP5A3 has got a tactical flashlight, but it doesn't work. I'm trying someting with proxies now...

Share this post


Link to post
Share on other sites

1.) Ok, I defined a proxy consisting of...

...a resolution lod with a flashlight texture and...

...a memory lod with vertices "svetlo L" and "konec svetla L"

2.) I placed the proxy at the end of the weapon's muzzle.

3.) This proxy is registered in CfgNonAIVehicles according to Suma's instructions (seems to work: no error message is presented, OFP doesn't crash)

4.) There's a class tacticalflashlight in CfgVehicles:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class tacticalflashlight: Car

{

    side = 1;

    model = "\m41apr\taclight_proxy.p3d";

    hasdriver = 1;

    crew = "logic";

    maxSpeed = 1;

    fuelCapacity = 0;

    transportSolider = 0;

    transportAmmo = 0;

    weapons[] = {};

    magazines[] = {};

    typicalCargo[] = {};

    transportMaxMagazines = 0;

    transportMaxWeapons = 0;

    class reflectors

    {

         class Reflector

         {

              color[] = {0.900000,0.800000,0.800000,1.000000};

              ambient[] = {0.100000,0.100000,0.100000,1.000000};

              position = "svetlo L";

              direction = "konec svetla L";

              hitpoint = "svetlo L";

              selection = "svetlo L";

              size = 0.12500000;

              brightness = 0.250000;

         };

    };

};

<span id='postcolor'>

The Idea: The flashlight behaves like a car with a logic driver. It's behaviour is my status variable and trigger ("Safe" = light; "STEALTH" = darkness).

5.) In my weapon's class I've defined two UserActions:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class UserActions

{

     class myaction1

     {

          displayName = "flashlight on";

          position = "konec hlavne";

          radius = 0.5;

          condition = "(behaviour nearestObject [this, ""tacticalflashlight""]) != ""SAFE""";

          statement = "(nearestObject[this,""tacticalflashlight""]) setBehaviour ""SAFE""";

     };

     class myaction2

     {

          displayName = "flashlight off";

          position = "konec hlavne";

          radius = 0.5;

          condition = "(behaviour nearestObject [this, ""tacticalflashlight""]) == ""SAFE""";

         statement = "(nearestObject[this,""tacticalflashlight""]) setBehaviour ""STEALTH""";

    };

};

<span id='postcolor'>

But these actions don't appear ingame! Why?

If it's not possible, I want to try a "streetlamp"-proxy and the switchLight/Lightison-Commands. Any comments before I start the work again?

Share this post


Link to post
Share on other sites

You can add actions to your weapons? wow.gif

Be right back, hehehe.... tounge.gif

I know this is totally unrelated to your question bastler, but do you know where i could get all the config.cpp commands? Feel free to bad mouth me for intruding, but i'm supporting you all the way on this one as i'd love to see swat type weapons with flashlights on the front.

Besides, if i knew all the commands i could help you wink.gif

tounge.gif PEACE

Share this post


Link to post
Share on other sites

Read this. I've successfully created a garage with working doors using this UserActions. Perhaps it's not possible at guns? Hm, perhaps I should add this action to the tacticalflashlight itself...

Share this post


Link to post
Share on other sites

Thanks Der Bastler, but i actually meant the .cpp comands like "maxSpeed = 1" and "fuelCapacity = 0" and things like that. Ill check out OFPEC and see if they have any...

wow.gif PEACE

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×