Page 1 of 1

Water?

Posted: Wed Mar 17, 2004 6:32 pm
by Yarik
I really want water in Mohaa, where you can actually float in and so that you can die if you stay under too long.
Is this possible?

Posted: Thu Mar 18, 2004 10:09 am
by M&M
do u mean something like the omaha beach water?but 2 die in it if u spend more time or u actually mean go under water?
if u mean under water then i guess u should make the water brush bigger so that the player is conained in it .4 the death part maybe make him hurt every second until he dies (looses breathe)

Posted: Fri Mar 19, 2004 12:59 am
by omniscient
u cant walk under water in mohaa. u can only fall under. just keep that in mind.

Posted: Sat Mar 20, 2004 7:43 am
by dcoshea
What do you mean, you can't walk in water, you can only fall? As far as I know, when you make water like in Omaha beach, it's just a brush which has a water texture on the top and a land texture on the bottom (the sea floor), and the brush is not solid but you can't move as fast while you're in it. I'm pretty sure you can still walk in it - I think I've done this on a custom map I made. I do seem to remember that when you're completely submerged it doesn't really look like you're under water - not like it does in Quake. You can still see perfectly well through it.

Regards,
David

water

Posted: Sat Mar 20, 2004 8:41 am
by tltrude
The water brush should have texture on the top and bottom faces with nodraw on the other four faces. Doing that makes it a water voulme and, when your head is under the surface, the screen will squirm around a bit. In Quake3, the water volume can look foggy, but "surfaceparm fog" does not work in mohaa.

To drown players, make a thread in the script that will hurt the player--if he is touching a trigger 96 units below the surface. Here is one I did for gas.

gaskill:

local.sucker = parm.other
if (local.sucker istouching $gas_killer2)
{
radiusdamage local.sucker.origin 10 16 // damage 10 point per sec in a 16 unit radius
}
wait 1
goto gaskill

end

The trigger has a setthread to call that thread in the script.

Hope that helps!

Re: water

Posted: Sat Mar 20, 2004 10:35 am
by dcoshea
tltrude wrote:The water brush should have texture on the top and bottom faces with nodraw on the other four faces. Doing that makes it a water voulme and, when your head is under the surface, the screen will squirm around a bit.
Ahh, cool, I guess my mistake was not having 'nodraw' on the other four faces. In fact, my brush might not have had six faces, it might have been a wedge shape. Is that allowable?

Regarding hurting the player when they are under the water, maybe it'd be nicer to not hurt them the moment they are submerged - after all, people can hold their breath a little while, right?

Also, regarding that 96 units under the water thing, that is how far the water has to be above the player's feet for their head to be under water, right? I guess that doesn't account for the player crouching, in which case I suppose the height is less. It might be nicer to have the drowning kick in earlier if they are crouching.

Regards,
David

Posted: Mon Mar 22, 2004 4:23 am
by kai0ty
mohaa wont allow u to be submereged in water unles u fall in it. check that in omaha it'l force u back up if u become submerged. also if u try to crouch while the water is high up its will say u cant go in water.

Posted: Mon Mar 22, 2004 10:10 am
by dcoshea
kai0ty wrote:mohaa wont allow u to be submereged in water unles u fall in it. check that in omaha it'l force u back up if u become submerged. also if u try to crouch while the water is high up its will say u cant go in water.
Ahh, I guess this is what omniscient was trying to tell me!

I did a bit of a test with Spearhead were I had a wedge-shaped water brush simulating a sloped ocean bed up to a beach. I was able to walk from the beach down into the water until I was under it. I saw the issue from Omaha Beach where you can't duck under the water, but I was able to keep walking until my head was under the water. However, when I was under water it didn't seem like I was, possibly due to choice of textures - I couldn't see the surface and it didn't have the "squirm" thing tltrude mentioned.

So I looked at the water tutorial on this site (http://map.moh-central.net/t.php?id=47) and tried using the textures it mentioned for the ocean floor (riverbed) and the water itself. I could see the surface while in the water, but still no "squirming" :) I followed tltrude's suggestion of only having textures on the top and bottom and having nodraw on the other four surfaces even though the tutorial didn't mention that. When I applied it to all four surfaces it didn't help.

Does anyone know of a map I could look at where this is working? I'd just like to see the effect so at least I know what I'm trying to achieve :)

Thanks in advance,
David

Posted: Tue Mar 23, 2004 3:45 am
by kai0ty
dcoshea wrote:What do you mean, you can't walk in water, you can only fall? As far as I know, when you make water like in Omaha beach, it's just a brush which has a water texture on the top and a land texture on the bottom (the sea floor), and the brush is not solid but you can't move as fast while you're in it. I'm pretty sure you can still walk in it - I think I've done this on a custom map I made. I do seem to remember that when you're completely submerged it doesn't really look like you're under water - not like it does in Quake. You can still see perfectly well through it.

Regards,
David
wha ti mean is u cant completely submerge yourself in water withought falling in it. it wont go above ur head if u just walk in.

Posted: Tue Mar 23, 2004 4:20 am
by dcoshea
kai0ty wrote:
dcoshea wrote:What do you mean, you can't walk in water, you can only fall? As far as I know, when you make water like in Omaha beach, it's just a brush which has a water texture on the top and a land texture on the bottom (the sea floor), and the brush is not solid but you can't move as fast while you're in it. I'm pretty sure you can still walk in it - I think I've done this on a custom map I made. I do seem to remember that when you're completely submerged it doesn't really look like you're under water - not like it does in Quake. You can still see perfectly well through it.

Regards,
David
wha ti mean is u cant completely submerge yourself in water withought falling in it. it wont go above ur head if u just walk in.
I was able to do that, though, in Spearhead anyway. See my previous post. It wouldn't let me duck once I'd walked in so it definitely knew I was inside a water brush, but perhaps I stuffed it up somehow. I'm not a mapper heheh :)

Regards,
David

volume

Posted: Tue Mar 23, 2004 6:25 am
by tltrude
From what I have read, water brushes should not be cut into irregular shapes or the "water volume" effects may not work correctly. It is ok to overlap other brushes and patch mesh with water brushes.

I don't know what they are talking about with "jump only" to get under water. All the water brushes I have made, you can walk under. Crouching under water is not allowed in the game, and it will tell you so on the screen if you try it.

Here is a "death_water" script that can be placed in main/global to drown players slowly. It uses the trigger I spoke of. Copy it to Notepad and name it "death_water.scr". It works for any triggers named "deathwater".

Code: Select all

//***********************************************************
//*** death_water script
//*** modifed version of the MOHAA minefield
//*** modifed by Duncan Weir May 2002
//*** The player enters the water, and within 15 secs
//*** if he's still in the water he'll start to drown.
//
//*** This main thread is called by this script and should not be called by the
//*** level script itsself.  The level script should call deathwater_setup
//*** syntax ------------------------------------
//*** deathwater <this is the index number for the array of deathwater triggers>
//	script_object -> trigger multiple
//	targetname = deathwater
//	#startdrowntime = set to number of seconds a player can be in the water before drowning starts // default 10
//      #timetodrown = set to number of seconds a player takes to drown // default 10
//***********************************************************
deathwater local.index:

	thread debugtext ("THREAD: deathwater = " + local.index)
	
	if ($deathwater[local.index].startdrowntime == NIL)
		local.startdrowntime = 10
	else
		local.startdrowntime = $deathwater[local.index].startdrowntime

	if ($deathwater[local.index].timetodrown == NIL)
		local.timetodrown = 10
	else
		local.timetodrown = $deathwater[local.index].timetodrown

	local.radius = 40 // radius of the damage - only in local player area

	thread debugtext ("  Radius = " + local.radius)

	local.damage = 100 / local.timetodrown // calculate how much damage per second

	thread debugtext ("  Damage = " + local.damage)

	deathwater_loop:

		thread debugtext "THREAD: deathwater_loop"

		$deathwater[local.index] waittill trigger // wait till this field is triggered

		local.sucker = parm.other // gets the player info

		thread debugtext "  deathwater triggered"

		thread debugtext ("  local.sucker = " + local.sucker)

		wait ( local.startdrowntime ) // wait a set amount of time before starting to drown

		deathwater_drown_loop:

			if (local.sucker istouching $deathwater[local.index] == 1) // check player is still in the deathwater
			{
				thread debugtext "  Player is drowning"

//				local.spawn_drown = (local.sucker.targetname + "_drown")

//	      			spawn animate/fx_mortar_water targetname local.spawn_mine

//		      	  	local.spawn_drown = $(local.sucker.targetname + "_drown")
//      		  		local.spawn_drown.origin = local.sucker.origin
        	
//	        		local.spawn_drown anim start
//		        	local.spawn_drown playsound grenade_exp_water

        			radiusdamage local.sucker.origin local.damage local.radius

				wait 1 // wait 1 second
//				local.spawn_drown remove //*** remove the effect

				goto deathwater_drown_loop // go back and see if player is still drowning
			}

			goto deathwater_loop

	thread debugtext ("END THREAD: deathwater = " + local.index)

end

//*************************************************
//*** setup the deathwater(s)
//*** the level scripts should call this thread
//*************************************************
deathwater_setup:
	thread debugtext "THREAD: deathwater_setup"

	if ($deathwater == NULL)
	{
		thread debugtext "  There is no deathwater in the map!!!"
		local.deathwaters = 0
		goto deathwater_setup_end
	}
	else
		local.deathwaters = $deathwater.size

	thread debugtext ("  There are " + local.deathwaters + " deathwaters in this map")

	for (local.i = 1 ; local.i <= $deathwater.size ; local.i ++)
	{
		thread deathwater local.i
	}

	deathwater_setup_end:

	thread debugtext "END THREAD: deathwater_setup"
end

// text only output if debug mode is turned on
debugtext local.text:

	if (level.debug == 1)
		println local.text
end
So, in your script, you only need this line in prespawn.

exec global/death_water.scr::deathwater_setup

And, it will setup all your underwater triggers named "deathwater". The players feet should not touch a trigger until his head is underwater (player is 96 units tall).

You can set the timing in the triggers with:

Key: #startdrowntime
Value: 15 // whatever number you wish

Key: #timetodrown
Value: 12 // whatever number you wish

But, you can also change the default times in script above if you want to use the same timing for all the triggers.

Re: volume

Posted: Tue Mar 23, 2004 12:00 pm
by dcoshea
tltrude wrote:From what I have read, water brushes should not be cut into irregular shapes or the "water volume" effects may not work correctly.
They weren't working for me with a normal-shaped brush either, but I guess talk about that belongs on the mapping forum not the scripting forum :)

Thanks,
David

Posted: Wed Mar 24, 2004 6:04 pm
by Yarik
Wow thanks a lot. But what I was really going for is like RTCW where the person actually swims in the water.
I was wandering if it is possible to somehow set a trigger in the water that makes the player wheightless?
Like set the gravity to 300 in the water?

I believe you guys are half way finished with this,

Finished script
1) Player slowly drowns if he is in the water too long with his head submerged.

yet to be done
2) Player can swim in the water, is this possible? (Not nesseceraly Animations, just so you can float like if you have the gravity settings set to 300.