Home   Help Search Login Register  

Author Topic: Lightning Bugs! (Fireflies)  (Read 7521 times)

0 Members and 2 Guests are viewing this topic.

Offline Pilot

  • Contributing Member
  • **
Lightning Bugs! (Fireflies)
« on: 09 Jul 2005, 01:12:53 »
Here is a sure winner for the most useless script award ;D.  I have been playing around with the drop command and came up with this.  This script produces "lightning bugs" more properly known as fireflies (am I the only one that calls them lightning bugs? :P).  Of course, this script is meant to be used for night-time missions ::)  I think it adds a lot of atmosphere to the OFP night world, but that may be me.  Try it out and tell me what you think.

Addons Required: None
Useable in MP: I have no idea

Call the script in the following format:
[NumberOfFireflies, RadiusAroundPlayer] exec "firefly.sqs"

NumberOfFireflies is the number of fireflies you want created at any one time
RadiusAroundPlayer is the radius around the player you want the fireflies to be created.

-Student Pilot

Get V1.45 below!
« Last Edit: 19 Jul 2005, 04:07:10 by Student Pilot »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Lightning Bugs! (Fireflies)
« Reply #1 on: 09 Jul 2005, 04:07:31 »
Heh. I'd hardly call this a useless script. It's actually a pretty nice effect. I'm surprised it hasn't been done before (unless it has....), considering how visible and plentiful those things seem to be at night. Then again, we don't have those around my area, and maybe most people don't.

The effect looks great. I honestly was ready to look at the script and give you a ton of comments (based on my "expert opinion" after having only seen them a few times), but it looks awesome.

I do have a few suggestions, however:
  1) Make the flies appear ALL around the player, not just in front of him. It looks pretty odd when I turn my head and don't see any behind me (let alone when using the command view).
  2) Add a parameter to determine the frequency of the flies (the random delay).
  3) Add another parameter that determines what object the flies will be centered on. This way an editor could anchor the flies around a specific area on the map, or could use the script during cutscenes.
  4) Add a way to exit the script (via a global variable, or other means).

Also, one more thing. I thought fireflies (and I have heard them called "lightning bugs") were greenish? The ones I've seen were that color, at least. Are there different species with different colors or something?

Nice job. :)

EDIT

Ack! I just saw the 'bugs' up close, and they look terrible! I'd suggest you use the "kouleSvetlo" particle instead of the "cl_fire" one. It looks much nicer, although you might need to re-adjust the size and color of the particles.

« Last Edit: 09 Jul 2005, 04:13:38 by General Barron »
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #2 on: 09 Jul 2005, 14:23:39 »
Quote
1) Make the flies appear ALL around the player, not just in front of him. It looks pretty odd when I turn my head and don't see any behind me (let alone when using the command view).
Oh, I never thought the player would turn his head ::).  Ok, that is an easy fix

Quote
2) Add a parameter to determine the frequency of the flies (the random delay).
Ok, that should also be easy

Quote
3) Add another parameter that determines what object the flies will be centered on. This way an editor could anchor the flies around a specific area on the map, or could use the script during cutscenes.
Good idea

Quote
4) Add a way to exit the script (via a global variable, or other means).
Ok, I'll look into it

Quote
I thought fireflies (and I have heard them called "lightning bugs") were greenish? The ones I've seen were that color, at least. Are there different species with different colors or something?
I'm glad I'm not the only one that calls then lightning bugs ;D.

GREEN?!!  Whoa, I would love to see those! ;D  The fireflies in Indiana all seem to appear yellowish.

Should I add an option for different colors then?

Quote
Ack! I just saw the 'bugs' up close, and they look terrible! I'd suggest you use the "kouleSvetlo" particle instead of the "cl_fire" one. It looks much nicer, although you might need to re-adjust the size and color of the particles.
I was afraid they would be seen up close.  I never thought about using kouleSvetlo for them.  Thanks for the suggestion :)

-Student Pilot

EDIT:
I have been doing some looking around and found that the wavelength og the light that is transmitted by fireflies is between 510 and 670 nanometers.  Apparently that equates from pale yellow to reddish green ::)
« Last Edit: 09 Jul 2005, 14:42:10 by Student Pilot »

bdfy1

  • Guest
Re:Lightning Bugs! (Fireflies)
« Reply #3 on: 09 Jul 2005, 16:00:58 »
Quote
Should I add an option for different colors then?
Yes, with black color we will get usual flies :)

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Lightning Bugs! (Fireflies)
« Reply #4 on: 09 Jul 2005, 16:18:31 »
http://ase.tufts.edu/biology/Firefly/

 ::)

can't find anything about any different colour of fireflies :-\

http://www.backyardnature.net/lightbug.htm

seems there's a diffrence in how the different species flash :P
« Last Edit: 09 Jul 2005, 16:22:12 by Garcia »

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #5 on: 09 Jul 2005, 16:56:45 »
@bdfy1
I'm not sure how the flies would look in the daytime as black flies.  These fireflies are created for about one second, then are destroyed.

@Garcia
Thanks for the links.  I did find the second page on my own, but not the first.

I remember going through all those pages and thinking to myself, All I want to know is what color the light is! ;D ::)  Fortunately I was able to find some page that gave the range in nanometers of the waves of light produced by the fireflies.  The color supposedly ranges from pale yellow to reddish-green.

@All
I have posted a new version of the script in the first post.  I have changed the type of particle from cl_fire to kouleSvetlo.  It looks much better that way.  I have also added two more parameters to the script.  See the readme for more info.

-Student Pilot

EDIT:
I have also added a Global variable, that when set to false, exits the script.  The variable is:
PILOT_Firefly

This is not mentioned in the readme, I will add it at a later date.

EDIT EDIT:
I have posted V1.2 in the first post.  I thought the fireflies were flying way too fast so I slowed them down a bit.  Other than that no other changes have been made.
« Last Edit: 09 Jul 2005, 17:43:14 by Student Pilot »

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:Lightning Bugs! (Fireflies)
« Reply #6 on: 09 Jul 2005, 18:58:01 »
nice script but dont they last a little short, i see them and they dont flash on and off every second, they stay on and fly around in random directions, or am i mistaken.


Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #7 on: 09 Jul 2005, 19:13:34 »
@pengiunman
Well, the fireflies here in Indiana flash on, stay on for a second or two, then turn off.  But maybe the fireflies in Indiana are messed up, they wouldn't be the only thing ::)

I have added another color to my firefly script (green) and will post the new version sometime today.  I just have to iron out any bugs I might find (lol, get it, iron out any bugs, hahahahaha. :tomato:  Oi, I need to get more sleep ::))

-Student Pilot

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #8 on: 09 Jul 2005, 21:09:37 »
Ok, here is V1.3 of my firefly script!!!  (I know all of you are just so excited :P)

Changes include:
I have increased the average lifetime of each bug by about .4 seconds.
I have added green fireflies!
I have added one more parameter to the script.

call the script like this:
[NumberOfFireflies, DistanceFromObject, Frequency, Object, "Color"] exec "Firefly.sqs"

NumberOfFireflies is the number of fireflies you want created at any one time
DistanceFromObject is the radius around the object you want the fireflies to be created.
Frequency is the random time between each set of fireflies being created.  Eg: If a 1 is entered, the game will wait between 0 and 1 seconds to create the nect group of fireflies
Object is the object you wish to have the fireflies fly around
"Color" is the color of the fireflies.  It can be either "Yellow", "Green", or "Mixed".  This is a string and requires the quotes to work properly.  Not case sensitive.

I have never seen green fireflies before, so if they look bad, tell me how to improve them.

-Student Pilot
« Last Edit: 11 Jul 2005, 04:34:43 by Student Pilot »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Lightning Bugs! (Fireflies)
« Reply #9 on: 10 Jul 2005, 01:15:42 »
Neat little script! I like the way you actually get the illusion that they're all around you, especially so when you're moving.

Halflight is a good choice for drop particle, undoubtedly the best for what you are trying to achieve

The only suggestion I might make, and it's small, is that you increase the weight of the fireflies slightly, because most of them seem to be travelling straight up, and few of them stay at the same level, or move down.

Apart from that....  :thumbsup:

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #10 on: 10 Jul 2005, 04:20:41 »
@Fragorl
The suggestion you made touched upon a part of the script I was a bit uneasy about.  I will add a little bit more weight to them so they don't all rocket skywards :P

-Student Pilot

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #11 on: 11 Jul 2005, 04:34:26 »
Version 1.35 is here.

The only change is:
I have increased the weight of the fireflies slightly.  Although many still fly upwards, more of the fireflies will fly sideways or stay where they are.  I think the effect is quite realistic (at least from what I see here in Indiana).  Again, please feel free to make any suggestions or criticisms.

-Student Pilot
« Last Edit: 14 Jul 2005, 14:11:53 by Student Pilot »

klavan

  • Guest
Re:Lightning Bugs! (Fireflies)
« Reply #12 on: 14 Jul 2005, 13:05:19 »
Nice script Student Pilot! I'm going to put it in my new mission.
Again, good work.
Klavan

Offline Pilot

  • Contributing Member
  • **
Re:Lightning Bugs! (Fireflies)
« Reply #13 on: 14 Jul 2005, 14:11:11 »
Thanks klavan!

@All
I made a few more adjustments, and am now releasing V1.4 of the firefly script.  Changes are:
1: Lifetime has been adjusted, now the fireflies aren't lit as long.  I was outside yesterday (that doesn't happen too often ::)), and realized my scripted fireflies stay lit up too long.  If anyone thinks I made a mistake by doing this, tell me and I will change it back.
2: I adjusted the height that the fireflies will appear at.  Now they can range from .7 meters to 2.3 meters.

And now for a poll, the question:
Who thinks Student Pilot is spending way too much time adjusting this script?
 ::)

-Student Pilot
« Last Edit: 18 Jul 2005, 22:50:45 by Student Pilot »

klavan

  • Guest
Re:Lightning Bugs! (Fireflies)
« Reply #14 on: 14 Jul 2005, 15:10:33 »

And now for a poll, the question:
Who thinks Student Pilot is spending way too much time adjusting this script?
 ::)

-Student Pilot

Not me! Thinking to all those night missions that take place in empty, flat environments..... This script, just like Petroizki's seagulls script and the recent dynamic grass scripts and addons would make the difference in terms of atmosphere and even gameplay if used with cognition of cause.
Downloading version 1.4 now.
Klavan