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 → ok, how would i do this?
ok, how would i do this?
2003-05-07, 4:03 AM #1
i want to make sprites appear below a surface, and then fall to the ground, (like rain "doh that gave away far to mutch") well any way i was wondering how.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-07, 4:26 AM #2
maybe This will help, if your trying to make rain, or some thing rain like

or maybe this cog
------------------
hypocrisy is what Separates man and animals

current lvl= Pyramid Battle


[This message has been edited by Rabid Zombie (edited May 07, 2003).]
hypocrisy is what Separates man and animals

current lvl= Pyramid Battle
2003-05-07, 6:05 AM #3
that meathod is too labor intecive mine is going to kick it to the ground five times over before it drops dead.

do you have any idea how cool that is? no ghosts, no nothing. juse one cog. one sprite template, and one flag. and its done.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-07, 5:49 PM #4
[http://forums.massassi.net/html/biggrin.gif] i never knew that cogging could be so much fun.

i just made a cog that does this, its a cool effect. i made it rain mines [http://forums.massassi.net/html/biggrin.gif]
*whoa death*
do you want the cog or do you want me to tell you how to make it?

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited May 07, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-05-08, 2:45 AM #5
-pjb thinks-

ill have the cog now coz i am on a time limit. but i would love to know how to make it too incase i have to make a cool thing like snow!


p.s. could someone explain sprites?

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-08, 3:08 AM #6
If you want to Make snow go to the 1st link I gave.

and for sprites go here

I think most every thing can be found in the tutorials

------------------
hypocrisy is what Separates man and animals

current lvl= Pyramid Battle
hypocrisy is what Separates man and animals

current lvl= Pyramid Battle
2003-05-08, 8:30 AM #7
no no, i meant snow useing my kick *** method.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-08, 4:40 PM #8
ok here it is, took me a while because i had to test it and add a few things.
Code:
#####
# Written By DSLS_DeathSythe
# SURF_RAIN01.COG
#####
flags=0x240
symbols
#=====
message   startup
message   timer
#-----
flex      x_maxr=1.0
flex      y_maxr=1.0
template  rain_tpl=+repeaterball
flex      p=0.0
flex      y=0.0
flex      maxrain_delay=0.5
int       rain_drips=3
flex      range=3.0
#-----
thing     player=-1     local
vector    pyr_vec     local
surface   a     local
int       d=0     local
vector    surf_vec01     local
vector    rand_Svec01     local
sector    surf_sec01     local
flex      surf_Vx01     local
flex      surf_Vy01     local
flex      surf_Vz01     local
flex      delay1=0.0     local
surface   b     local
int       e=0     local
vector    surf_vec02     local
vector    rand_Svec02     local
sector    surf_sec02     local
flex      surf_Vx02     local
flex      surf_Vy02     local
flex      surf_Vz02     local
flex      delay2=0.0     local
surface   c     local
int       f=0     local
vector    surf_vec03     local
vector    rand_Svec03     local
sector    surf_sec03     local
flex      surf_Vx03     local
flex      surf_Vy03     local
flex      surf_Vz03     local
flex      delay3=0.0     local
#-----
end
#=====
code
#-----
startup:
  Sleep(2.0);
  player = GetLocalPlayerThing();
  //-Setup the PYR of the rain_tpl...
  pyr_vec = VectorSet(p, y, 0.0);
  //-START the rain timers...
  SetTimerEx(0.25, 1, 0, 0);
  SetTimerEx(0.5, 2, 0, 0);
  SetTimerEx(0.75, 3, 0, 0);
return;
#-----
timer:
  //-TIMER - (1)
  if(GetSenderID() == 1)
    {
    for(a=0; a<GetSurfaceCount(); a=a+1)
      {
      //-Look for all surfaces that are flaged as SKY...
      if((GetSurfaceFlags(a) & 0x200) || (GetSurfaceFlags(a) & 0x400))
        {
        //-Check to see if the surface is flat and aiming down...
        if(VectorZ(GetSurfaceNormal(a)) == -1.0)
          {
          //-Get the surfaces center vec, and the surfaces sector...
          surf_sec01 = GetSurfaceSector(a);
          surf_vec01 = GetSurfaceCenter(a);
          surf_Vx01 = VectorX(surf_vec01);
          surf_Vy01 = VectorY(surf_vec01);
          surf_Vz01 = VectorZ(surf_vec01);
          surf_Vz01 = surf_Vz01 - 0.025;
          for(d=0; d<rain_drips; d=d+1)
            {
            //-Randomize the vector...
            rand_Svec01 = VectorSet(((surf_Vx01 + (Rand() - 0.5) * x_maxr)), ((surf_Vy01 + (Rand() - 0.5) * y_maxr)), surf_Vz01);
            //-Check to see if the rand_Svec is within the range...
            if((VectorDist(rand_Svec01, GetThingPos(player)) <= range))
              {
              CreateThingAtPos(rain_tpl, surf_sec01, rand_Svec01, pyr_vec);
              }
            }
          }
        }
      }
    //-Reset the random timer...
    delay1 = Rand();
    if(delay1 > maxrain_delay)
      delay1 = maxrain_delay;
    SetTimerEx(delay1, 1, 0, 0);
    return;
    }
  //-TIMER - (2)
  else
  if(GetSenderID() == 2)
    {
    for(b=0; b<GetSurfaceCount(); b=b+1)
      {
      //-Look for all surfaces that are flaged as SKY...
      if((GetSurfaceFlags(b) & 0x200) || (GetSurfaceFlags(b) & 0x400))
        {
        //-Check to see if the surface is flat and aiming down...
        if(VectorZ(GetSurfaceNormal(b)) == -1.0)
          {
          //-Get the surfaces center vec...
          surf_vec02 = GetSurfaceCenter(b);
          surf_sec02 = GetSurfaceSector(b);
          surf_Vx02 = VectorX(surf_vec02);
          surf_Vy02 = VectorY(surf_vec02);
          surf_Vz02 = VectorZ(surf_vec02);
          surf_Vz02 = surf_Vz02 - 0.025;
          //-Make the amount of rain_drips for each surface...
          for(e=0; e<rain_drips; e=e+1)
            {
            //-Randomize the vector...
            rand_Svec02 = VectorSet(((surf_Vx02 + (Rand() - 0.5) * x_maxr)), ((surf_Vy02 + (Rand() - 0.5) * y_maxr)), surf_Vz02);
            //-Check to see if the rand_Svec is within the range...
            if((VectorDist(rand_Svec02, GetThingPos(player)) <= range))
              {
              CreateThingAtPos(rain_tpl, surf_sec02, rand_Svec02, pyr_vec);
              } 
            }
          }
        }
      }
    //-Reset the random timer...
    delay2 = Rand();
    if(delay2 > maxrain_delay)
      delay2 = maxrain_delay;
    SetTimerEx(delay2, 2, 0, 0);
    return;
    }
  //-TIMER - (3)
  else
  if(GetSenderID() == 3)
    {
    for(c=0; c<GetSurfaceCount(); c=c+1)
      {
      //-Look for all surfaces that are flaged as SKY...
      if((GetSurfaceFlags(c) & 0x200) || (GetSurfaceFlags(c) & 0x400))
        {
        //-Check to see if the surface is flat and aiming down...
        if(VectorZ(GetSurfaceNormal(c)) == -1.0)
          {
          //-Get the surfaces center vec...
          surf_sec03 = GetSurfaceSector(c);
          surf_vec03 = GetSurfaceCenter(c);
          surf_Vx03 = VectorX(surf_vec03);
          surf_Vy03 = VectorY(surf_vec03);
          surf_Vz03 = VectorZ(surf_vec03);
          surf_Vz03 = surf_Vz03 - 0.025;
          //-Make the amount of rain_drips for each surface...
          for(f=0; f<rain_drips; f=f+1)
            {
            //-Randomize the vector...
            rand_Svec03 = VectorSet(((surf_Vx03 + (Rand() - 0.5) * x_maxr)), ((surf_Vy03 + (Rand() - 0.5) * y_maxr)), surf_Vz03);
            //-Check to see if the rand_Svec is within the range...
            if((VectorDist(rand_Svec03, GetThingPos(player)) <= range))
              {
              CreateThingAtPos(rain_tpl, surf_sec03, rand_Svec03, pyr_vec);
              }
            }
          }
        }
      }
    //-Reset the random timer...
    delay3 = Rand();
    if(delay3 > maxrain_delay)
      delay3 = maxrain_delay;
    SetTimerEx(delay3, 3, 0, 0);
    return;
    }
return;
#=====
end

basically what it does is this. when the level starts it sets three timers. when one of the timers go off the cog then goes through all the surfaces looking for sky flags. when it finds one it gets the vector at the center of the surface and the sector it is in. it then takes the vector and randomizes its X and Y values. once it has that it checks to see if the new vector is within range of the player, if it is it makes a thing using CreateThingAtPos. once it is done with all the sky surfaces it sets the timer randomly and the whole thing starts over. i added comments to it so you can read through it to see what its doing and when.

these are the params you need to mess with.
-----
flex x_maxr=1.0
flex y_maxr=1.0
template rain_tpl=+repeaterball
flex p=0.0
flex y=0.0
flex maxrain_delay=0.5
int rain_drips=3
flex range=3.0
-----
the top two help to make the rain fall in a more spred out pattern. it has to be geater than 1.
'rain_tpl' is the rain template. (duh)
the 'p' and 'y' param make it so that the rain can fall at an angle. the 'p' moves the angle up and down (if you try a weapon tpl it would need to be set to -90 for it to fall straight down). the 'y' will move the angle back and forth.
'maxrain_delay' is the max wait before the timer goes off again. the timers are set by rand() so the max that the delay can be is 1. setting it to a low number will make the rain fall more frequently. wouldnt set it too low or it may slow thing down trying to go that fast.
'rain_drips' is how many rain tpls it creates per surface each time a timer goes off. making too many might slow things down too.
'range' is the max range that the rain tpl will be created around the player. it makes the rain kind of follow the player around the level, and helps so that it isnt trying to make it rain all over where there player cant even see it.

it works pretty good but if you make it rain too may things at once it can slow things down a bit and it reaches the thing limit fast.

if the sky surface isnt flat and aiming down at the ground then it wont make the rain. so if you have a slanted sky or a vertical one it wont rain there.

i only tried making it create weapon projectiles that have forward vels. the TPL you make has to have a vel to it otherwise the rain wont move.

try it see if you like it, its the best i could do. it may even make a good trap having doom rain down from the sky. [http://forums.massassi.net/html/smile.gif]

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited May 09, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-05-09, 12:46 PM #9
ok, so how eactly would i make a sprite that it coudl use? soz a mate of mine called strike says that you have to enbed them or some thing. and that confused me and the tutors.... lets jsut say i never realy had to do templates by hand. EVER. in my entire life.

------------------
I am pjb.
Another post......
another moment of my life wasted.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

↑ Up to the top!