Forum

my cheaplittle watersplash effect

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

my cheaplittle watersplash effect

Postby MeTcHsteekle » Wed Jul 29, 2009 3:13 pm

yep im trying to use the te_teleport effect for when you enter water..kinda so this is what i got

in client qc in playerpost think:

Code: Select all
// check to see if player landed and play landing sound   
   if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
   {
      local   vector   org;
      
      if (self.watertype == CONTENT_WATER)
      {
         sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
         WriteByte (MSG_BROADCAST, TE_TELEPORT);
         WriteCoord (MSG_BROADCAST, org_x);
         WriteCoord (MSG_BROADCAST, org_y);
         WriteCoord (MSG_BROADCAST, org_z);
      }
      else if (self.jump_flag < -650)
......


it compiles and wnt crash the server, but it splash :\
????
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Re: my cheaplittle watersplash effect

Postby Team Xlink » Wed Jul 29, 2009 11:51 pm

MeTcHsteekle wrote:yep im trying to use the te_teleport effect for when you enter water..kinda so this is what i got

in client qc in playerpost think:

Code: Select all
// check to see if player landed and play landing sound   
   if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
   {
      local   vector   org;
      
      if (self.watertype == CONTENT_WATER)
      {
         sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
         WriteByte (MSG_BROADCAST, TE_TELEPORT);
         WriteCoord (MSG_BROADCAST, org_x);
         WriteCoord (MSG_BROADCAST, org_y);
         WriteCoord (MSG_BROADCAST, org_z);
      }
      else if (self.jump_flag < -650)
......


it compiles and wnt crash the server, but it splash :\
????



You really mean that this code will create water splash's without crashing the server?

Awesome!
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Spike » Thu Jul 30, 2009 12:59 am

(self.flags & FL_ONGROUND)
your player is unlikely to be on the ground when entering in to water.

even if the pool is shallow.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby MeTcHsteekle » Thu Jul 30, 2009 1:18 am

ah i see, thanks spike :O.

Team: no not yet, i tried to communicate that i had a problem, but didn't quite put it in writing correctly
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Team Xlink » Thu Jul 30, 2009 2:15 am

Oh well.


Good luck!

You could submit this as a tutorial here as well.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby MeTcHsteekle » Thu Jul 30, 2009 2:21 am

alright, i separtated it from te landing sound part
so now in playerpostthink in client qc i got this under it

and it still wont work

Code: Select all
//  cheack to see if player landed in water and make splash
   if ((self.jump_flag < -300) && (self.flags & FL_INWATER) && (self.health > 0))
   {
      vector   org;
      
      if (self.watertype == CONTENT_WATER)
      {
         spawn_tfog (org);
      }
      else if (self.watertype == CONTENT_SLIME)
      {
         spawn_tfog (org);
      }
      else if (self.watertype == CONTENT_LAVA)
      {
         spawn_lburn (org);
   }
   


and for the lburn i made this lil shit in triggers.qc in hope to have the orange particle effect from the lighting gun.. i mean thunderbolt:


Code: Select all
void(vector org) spawn_lburn =
{
   s = spawn ();
   s.origin = org;
   s.nextthink = time +0.2;
   s.think = play_teleport;
   
   WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
   WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
   WriteCoord (MSG_BROADCAST, org_x);
   WriteCoord (MSG_BROADCAST, org_y);
   WriteCoord (MSG_BROADCAST, org_z);
};


i think that s.think there might not be good, perhaps a sub_remove or something would be better?

any more thoughts, im trying to learn from mistakes :S
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MeTcHsteekle » Thu Jul 30, 2009 3:35 am

alright update:

this works it a bit:
Code: Select all
if (self.waterlevel == 1)
   {
      vector   org;
      
instead of what i had for the start before

but it makes the teleport zing sounds somewhere, so i assume the particle effect is with it, just not on the player

the lava one just crashes the server ..with a bad sever message, whatevah that is
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MeTcHsteekle » Thu Jul 30, 2009 9:08 pm

hmm i think i made a step in the right direction, buit it still isn;t working :?

this is what i got in playerprethink this time:

Code: Select all
   if ( !(self.flags & FL_INWATER) )
   {   
   
      //player enter water effects
      if (self.watertype == CONTENT_LAVA)
         self.effects = self.effects + EF_BRIGHTFIELD;
      else if (self.watertype == CONTENT_WATER)
         self.effects = self.effects + TE_TELEPORT;
      else if (self.watertype == CONTENT_SLIME)
         self.effects = self.effects + TE_TELEPORT;
      else
         self.effects = self.effects;
      
// player enter water sound

      if (self.watertype == CONTENT_LAVA)
         sound (self, CHAN_BODY, "player/inlava.wav", 1.............................


all i can get is bright field for some reason, and i guess somehow ill neeed to make it only show up for a second

hmm.. i think removal will have to be worked in at playerpostthink???
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MauveBib » Thu Jul 30, 2009 9:13 pm

You're not checking if your effects already contain the effects bits you're adding. Bad move.
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby Tomaz » Fri Jul 31, 2009 12:20 pm

First off, TE_LIGHTNING2 is not a particle effect, unless you use an engine that has it as a particle effect, but it still just a long beam and takes more input that just 1 origin, it takes an entitynum, a start origin and an end origin, hence why it crashed for you.

Secondly, you can not add TE_TELEPORT as an effect, its not an effect, its a temporary entity.
Tomaz
 
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Postby MeTcHsteekle » Fri Jul 31, 2009 12:35 pm

..wait, so then which part makes the particle effect? :?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Tomaz » Fri Jul 31, 2009 12:38 pm

That depends on which particle effect youre after.
Tomaz
 
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Postby MauveBib » Fri Jul 31, 2009 12:39 pm

The orange particle effect from lightning is just done using the particle() function, in the same way as blood.
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby MeTcHsteekle » Fri Jul 31, 2009 5:46 pm

MauveBib wrote:The orange particle effect from lightning is just done using the particle() function, in the same way as blood.


iii AY MICARDO !!!

alright i got it going here with that :D:

Code: Select all
      //player enter water effects
      if (self.watertype == CONTENT_LAVA)
         particle(self.origin,'0 0 0',222,30);
         particle(self.origin,'0 0 5',221,30);
         particle(self.origin,'0 0 5',220,30);

      if (self.watertype == CONTENT_WATER)
         particle(self.origin,'0 0 0',225,30);
         particle(self.origin,'0 0 5',225,30);
         particle(self.origin,'0 0 5',225,30);

      if (self.watertype == CONTENT_SLIME)
         particle(self.origin,'0 0 0',64,30);
         particle(self.origin,'0 0 5',63,30);
         particle(self.origin,'0 0 5',62,30);


but the issue stands now that even with the content things it only does orange particles :? am i not doing the right checks?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MauveBib » Fri Jul 31, 2009 6:36 pm

you need to bracket off the if statements:


Code: Select all
      //player enter water effects
      if (self.watertype == CONTENT_LAVA)
      {
         particle(self.origin,'0 0 0',222,30);
         particle(self.origin,'0 0 5',221,30);
         particle(self.origin,'0 0 5',220,30);
      }
      if (self.watertype == CONTENT_WATER)
      {
         particle(self.origin,'0 0 0',225,30);
         particle(self.origin,'0 0 5',225,30);
         particle(self.origin,'0 0 5',225,30);
      }
      if (self.watertype == CONTENT_SLIME)
      {
         particle(self.origin,'0 0 0',64,30);
         particle(self.origin,'0 0 5',63,30);
         particle(self.origin,'0 0 5',62,30);
      }
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest