View previous topic :: View next topic |
Author |
Message |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Mon Jan 14, 2008 3:39 am Post subject: watertype / slime |
|
|
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 |
|
 |
jim

Joined: 05 Aug 2005 Posts: 400 Location: In The Sun
|
Posted: Tue Jan 15, 2008 9:35 pm Post subject: |
|
|
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 |
|
 |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Tue Jan 15, 2008 9:50 pm Post subject: |
|
|
Thanks jim, I'll give it a shot! _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Wed Jan 16, 2008 1:45 am Post subject: |
|
|
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 |
|
 |
|