Forum

watertype / slime

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

watertype / slime

Postby redrum » Mon Jan 14, 2008 3:39 am

Guys, I need a little help.
I have proportional fall damage.
I want to change it so that you take no damage when you fall into slime or water.
I was able to get it so that you take no damage when you fall in water, but the slime is giving me trouble.
Take a look at this bit of code and tell me what you think:

Code: Select all
            if (self.jump_flag <= -450 && self.jump_flag >= -600)
            if (self.watertype != CONTENT_WATER)
            if (self.watertype != CONTENT_SLIME)
      {
         r = self.jump_flag - (self.jump_flag * 2);
         r = r / 80;                                                                         
         sound (self, CHAN_VOICE, "player/land2.wav", .8, ATTN_NORM);
                        self.deathtype = "falling";
                        T_Damage (self, world, world, r);
 
      }

Thanks!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby jim » Tue Jan 15, 2008 9:35 pm

Maybe this would work:

This zeroes the damage if it's water or slime and only play sounds and damage self if there's something in r
Code: Select all
if (self.jump_flag <= -450 && self.jump_flag >= -600)
{
   r = self.jump_flag - (self.jump_flag * 2);
   r = r / 80;
   if (self.watertype == CONTENT_WATER || self.watertype == CONTENT_SLIME)
      r = 0;
   if (r > 0)
   {
      sound (self, CHAN_VOICE, "player/land2.wav", .8, ATTN_NORM);
      self.deathtype = "falling";
      T_Damage (self, world, world, r);
   }
}


I haven't tested it, but it might make thin layers of water or slime remove the falling damage.
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby redrum » Tue Jan 15, 2008 9:50 pm

Thanks jim, I'll give it a shot!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Spike » Wed Jan 16, 2008 1:45 am

jim wrote:I haven't tested it, but it might make thin layers of water or slime remove the falling damage.

You might want to use the waterlevel field too. I don't remember its exact values though.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest