Page 1 of 1

Invisible pits

Posted: Thu Nov 22, 2012 11:20 pm
by SharinaDarkstar
Not that I want to overuse this feature, as it could easily drive people crazy, but can anyone suggest the best way to make an invisible pit. IE: A normal bit of floor that you suddenly fall through unexpectedly. At the moment, I place a pit on the same square as a drain - works fine, except for slight graphics weirdness when you fall through and see the drain pipe whiz by - but not perfect. At least with a drain, you can imagine that it opened under you.

Re: Invisible pits

Posted: Thu Nov 22, 2012 11:46 pm
by pferguso
I dynamically spawned the pit in the place where a hidden pressure switch was. It was kind of tricky because I had to have a means of removing it when the player fell through. So create a hidden pressure switch, and connect it to a script entity that checks to see if the pressure plate is down or up, like this:
SpoilerShow
function checkPressureSwitch()
local trapPlate = findEntity("theTrapPlate");
if trapPlate:isDown() == false then
createPit()
else
removePit()
end
end

function createPit()
local isPit = "false"
for d in allEntities(party.level) do
if d.id == "pit1" then
isPit = "true"
end
end
if isPit == "false" then
local pit1 = spawn("temple_pit", self.level, 8, 23, 2, "pit1")
end
end

function removePit()
local pit1 = findEntity("pit1");
if pit1 ~= null then
--print("found pit");
pit1:destroy()
end
end
Also, make sure your floor underneath has a ceiling shaft, or you'll get weird geometry during the fall.

Re: Invisible pits

Posted: Thu Nov 22, 2012 11:51 pm
by SharinaDarkstar
Excellent, just what I needed. Thanks.

The hidden pits in DM and CSB are pretty much just virtually invisible outlines, rather than the obvious closed trapdoor used in Grimrock.