Inside3D!
     

watertype / slime

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Mon Jan 14, 2008 3:39 am    Post subject: watertype / slime Reply with quote

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:
            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 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
jim



Joined: 05 Aug 2005
Posts: 400
Location: In The Sun

PostPosted: Tue Jan 15, 2008 9:35 pm    Post subject: Reply with quote

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:

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!
Back to top
View user's profile Send private message Visit poster's website
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Tue Jan 15, 2008 9:50 pm    Post subject: Reply with quote

Thanks jim, I'll give it a shot!
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Jan 16, 2008 1:45 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group