Game Development Community

Need player to die when walk below certain elevation

by Nmuta Jones · in Torque Game Engine · 06/26/2009 (8:31 am) · 9 replies

I need a simply solution to cause a player to die if they go below a certain elevation.

I have a HUGE world so I can't use waterblocks or lava or whatever.... i just want to have pits where if you go below a certain level, you die.

I can't use damage because it should apply to people who walk into the pit, not just people who fall.

Please advise, thanks.


#1
06/26/2009 (8:38 am)

If it's a fixed height for the entire level, just make it part of the player update logic.

Otherwise place one or more triggers. These can cover huge areas if needed.
#2
06/26/2009 (9:07 am)
Which player update logic should I put it in? I don's see any player.onTick() function or any function that seems to be called repeatedly and is not based on a callback.

#3
06/26/2009 (10:09 am)

I was thinking engine-side here. If staying script-side, triggers are probably the easiest solution (other than some ugly hack schedule-based stuff).
#4
06/26/2009 (10:11 am)

Ah, BTW, you probably could also use the mission area here. Just set the area appropriate and check for the player height in onMissionAreaLeave.
#5
06/26/2009 (10:45 am)
Triggers are an elegant solution, because you can set several different areas (for example, you might want some pits to be shallower than others, etc.).
#6
06/26/2009 (11:18 am)
Thanks for the input, guys. Triggers seem to be the best solution. I was worried about making them so big, but if big triggers will not slow things down too much, then I can implement that.
#7
06/26/2009 (8:54 pm)
Triggers are definitely the easiest and most versatile in usage, though I've done something like Rene's suggestion for using the Mission Area before that worked well.

I don't recall any problems when I experimented with massively sized triggers...
#8
06/27/2009 (1:35 am)
i would definitely use a trigger/triggers.
#9
06/27/2009 (10:19 am)
Yep. Using very very large triggers and they work fine. Seems to be the best thing in terms of optimizing engine performance rather that schedules which I agree would be an ugly and unnecessary hack.