Page 1 of 1

Area Damage

Posted: Sat Jul 26, 2003 1:28 pm
by sirkilroy
I am trying to make the deep water in my map to slowly kill a player like he is drowning.

I have it set up as follows
trigger_multiple (around the area I want to kill)
targetname/hurtme
setthread/pain
wait/1

then the script added to the scr file (after the 'level waittill spawn')

pain:
$hurtme volumedamage 15
end

but the setthread/pain doesn't look right in the map editor and the area won't kill (see picture)


Image


any ideas?

Posted: Sat Jul 26, 2003 2:24 pm
by TheShiznaeSpe
hmm i don't really know the answer, but i can tell you that the setthread looks as is it should in the editor

so that's not your problem :D

Posted: Sat Jul 26, 2003 4:27 pm
by Bjarne BZR
Replace the

Code: Select all

pain:
$hurtme volumedamage 15
end
with

Code: Select all

pain:
parm.other hurt 10
end
...and insert wait / 1 in the trigger_multiple ( if not the player will be killed more or less instantly ).

Death_water

Posted: Sun Jul 27, 2003 7:49 am
by tltrude
Duncan Weir made this script, from the minefield script, a long time ago. It is a seperate script from your map's main script and goes in the global folder in main.

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 10 secs
//*** if he's still in the water he'll start to drown.
//
//*** The main thread is called by this script and should not be called by the
//*** level script itsself.  Use "exec global/death_water.scr::deathwater_setup"
//*** in your level script and place this script in global.
//
//*** syntax ------------------------------------
//
//	trigger_multiple settings
//	targetname = deathwater<index number for the array of deathwater triggers>
//	#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 damage per second

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

	deathwater_loop:

		thread debugtext "THREAD: deathwater_loop"

		$deathwater[local.index] waittill trigger 

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

		thread debugtext "  deathwater triggered"

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

		wait ( local.startdrowntime ) 

		deathwater_drown_loop:

			if (local.sucker istouching $deathwater[local.index] == 1)
			{
				thread debugtext "  Player is drowning"

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

				wait 1 // wait 1 second

				goto deathwater_drown_loop
			}

			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
Even if you don't use it, there should be things in it you can study. The trigger goes where the player can only trip it, if his head is under water. The script has to be named "death_water.scr".