Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → cog needed
cog needed
2003-06-04, 2:56 PM #1
Could someone give me a cog that Produces Lightning and plays a Thunder sound? (like in a lightning storm)

------------------
I and only I know what I'm thinking.
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-06-04, 3:03 PM #2
There may be a COG here at Massassi for it.

I made an animated lightning MAT some two years ago, which you can find here:

http://massassi.net/mats/list_mats.php3?cat=9

[This message has been edited by Emon (edited June 04, 2003).]
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-06-04, 3:16 PM #3
need a little more info.
do you want it to create lightning things like force lightning does, or change a mat some place like Emon was saying using his mat?

------------------
Famous last words - "It seemed like a good idea at the time."
Famous last words - "It seemed like a good idea at the time."
2003-06-04, 4:04 PM #4
Force Lightning. And it needs to Play a Sound when the Lightning strikes. I also need it to be random, like your rain COG.

------------------
I and only I know what I'm thinking.
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-06-04, 5:08 PM #5
hmmm...
i dont know if it would be a good idea to have it like the rain cog. the rain cog makes the rain_tpl for every surface, if i did it like that and you had a lot of sky surfaces it would make for a lot of lightning everytime it wanted to strike. if you like that idea or want to try it heres the cog.
Code:
#####
# Written By DSLS_DeathSythe
# surf_lightning01.COG
#####
flags=0x240
symbols
#=====
message   startup
message   timer
flex      x_maxr=1.0
flex      y_maxr=1.0
template  lightning_tpl=+force_lightning
flex      p=-90.0
flex      y=0.0
flex      minLightng_delay=10.0
flex      maxLightng_delay=30.0
flex      range=3.0
sound     lightng_snd
thing     player=-1     local
vector    pyr_vec     local
surface   a     local
vector    surf_vec     local
vector    rand_Svec     local
sector    surf_sec     local
flex      surf_Vx     local
flex      surf_Vy     local
flex      surf_Vz     local
flex      delay=0.0     local
#-----
end
#=====
code
#-----
startup:
  Sleep(2.0);
  player = GetLocalPlayerThing();
  //-Setup the PYR of the lightning_tpl...
  pyr_vec = VectorSet(p, y, 0.0);
  //-START the rain timers...
  delay = (((maxLightng_delay - minLightng_delay) * Rand()) + minLightng_delay);
  SetTimer(delay);
return;
#-----
timer:
  PlaySoundLocal(lightng_snd, 1.0, 0, 0x100);
  for(a=0; a<GetSurfaceCount(); a=a+1)
    {
    //-Look for all surfaces that are flaged as SKY...
    if((GetSurfaceFlags(a) & 0x200) || (GetSurfaceFlags(a) & 0x400))
      {
      //-Get the surfaces center vec, and the surfaces sector...
      surf_sec = GetSurfaceSector(a);
      surf_vec = GetSurfaceCenter(a);
      surf_Vx = VectorX(surf_vec);
      surf_Vy = VectorY(surf_vec);
      surf_Vz = VectorZ(surf_vec);
      surf_Vz = surf_Vz - 0.025;
      //-Randomize the vector...
      rand_Svec = VectorSet(((surf_Vx + (Rand() - 0.5) * x_maxr)), ((surf_Vy + (Rand() - 0.5) * y_maxr)), surf_Vz);
      //-Check to see if the rand_Svec is within the range...
      if((VectorDist(rand_Svec01, GetThingPos(player)) <= range))
        {
        CreateThingAtPos(lightning_tpl, surf_sec, rand_Svec, pyr_vec);
        }
      }
    }
  //-Reset the random timer...
  delay = (((maxLightng_delay - minLightng_delay) * Rand()) + minLightng_delay);
  SetTimer(delay);
return;
#=====
end

it works ok if you only have a few sky surfaces. setup is mostly the same as the rain cog. the sound plays local, meaning it plays everywhere on the level.
but...
if your level isnt too big there are two other choices for makeing less lightning.
---
1- use ghosts to mark lightning places and the lightning would choose one or two of those ghosts at random to make the lightning from.
2- i could make is so you choose some sky surfaces and the lightning would be made randomly around one or two of those surfaces.
---
the the first method would almost be the easiest but the second would save on the thing count.
the second method would also need little more setup because you would have to manually input the surfaces want lightning to come from.
which do you want if any?

------------------
Famous last words - "It seemed like a good idea at the time."
Famous last words - "It seemed like a good idea at the time."
2003-06-04, 6:47 PM #6
This should work fine. I only Have 1 sky texture in this level so that shouldnt be to many. I'll go try it out.

------------------
I and only I know what I'm thinking.
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-06-04, 7:34 PM #7
YYYYEEEEEHHHHAAAA!!!!!!!!!!!!!!! WE have Lightning! Thank you and you will get teh due credit.

------------------
I and only I know what I'm thinking.
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"

↑ Up to the top!